1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "MacabStatement.hxx"
23 #include "MacabResultSetMetaData.hxx"
24 #include <com/sun/star/sdbc/XRow.hpp>
25 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
26 #include <com/sun/star/sdbc/XColumnLocate.hpp>
27 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
28 #include <com/sun/star/sdbc/XRowUpdate.hpp>
29 #include <com/sun/star/sdbcx/XRowLocate.hpp>
30 #include <com/sun/star/sdbcx/XDeleteRows.hpp>
31 #include <cppuhelper/compbase.hxx>
32 #include <cppuhelper/basemutex.hxx>
34 namespace connectivity::macab
39 typedef ::cppu::WeakComponentImplHelper
< css::sdbc::XResultSet
,
41 css::sdbc::XResultSetMetaDataSupplier
,
42 css::util::XCancellable
,
43 css::sdbc::XWarningsSupplier
,
44 css::sdbc::XResultSetUpdate
,
45 css::sdbc::XRowUpdate
,
46 css::sdbcx::XRowLocate
,
47 css::sdbcx::XDeleteRows
,
48 css::sdbc::XCloseable
,
49 css::sdbc::XColumnLocate
,
50 css::lang::XServiceInfo
> MacabResultSet_BASE
;
53 class MacabResultSet
: public cppu::BaseMutex
,
54 public MacabResultSet_BASE
,
55 public ::cppu::OPropertySetHelper
,
56 public comphelper::OPropertyArrayUsageHelper
<MacabResultSet
>
59 ::rtl::Reference
< MacabCommonStatement
> m_xStatement
; // the statement that has created this result set
60 ::rtl::Reference
< MacabResultSetMetaData
> m_xMetaData
; // the description of the columns in this result set
61 MacabRecords
* m_aMacabRecords
; // address book entries matching the query
62 sal_Int32 m_nRowPos
; // the current row within the result set
63 bool m_bWasNull
; // last entry retrieved from this result set was NULL
64 OUString m_sTableName
;
66 // OPropertyArrayUsageHelper
67 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const override
;
70 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
72 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
73 css::uno::Any
& rConvertedValue
,
74 css::uno::Any
& rOldValue
,
76 const css::uno::Any
& rValue
) override
;
77 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
79 const css::uno::Any
& rValue
) override
;
80 virtual void SAL_CALL
getFastPropertyValue(
81 css::uno::Any
& rValue
,
82 sal_Int32 nHandle
) const override
;
84 // you can't delete objects of this type
85 virtual ~MacabResultSet() override
;
88 DECLARE_SERVICE_INFO();
90 explicit MacabResultSet(MacabCommonStatement
*pStmt
);
92 css::uno::Reference
< css::uno::XInterface
> operator *()
94 return css::uno::Reference
< css::uno::XInterface
>(*static_cast<MacabResultSet_BASE
*>(this));
97 void allMacabRecords();
98 void someMacabRecords(const class MacabCondition
*pCondition
);
99 void sortMacabRecords(const class MacabOrder
*pOrder
);
100 void setTableName(const OUString
& _sTableName
);
102 // ::cppu::OComponentHelper
103 virtual void SAL_CALL
disposing() override
;
106 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
107 virtual void SAL_CALL
acquire() noexcept override
;
108 virtual void SAL_CALL
release() noexcept override
;
111 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
114 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
117 virtual sal_Bool SAL_CALL
isBeforeFirst( ) override
;
118 virtual sal_Bool SAL_CALL
isAfterLast( ) override
;
119 virtual sal_Bool SAL_CALL
isFirst( ) override
;
120 virtual sal_Bool SAL_CALL
isLast( ) override
;
121 virtual void SAL_CALL
beforeFirst( ) override
;
122 virtual void SAL_CALL
afterLast( ) override
;
123 virtual sal_Bool SAL_CALL
first( ) override
;
124 virtual sal_Bool SAL_CALL
last( ) override
;
125 virtual sal_Int32 SAL_CALL
getRow( ) override
;
126 virtual sal_Bool SAL_CALL
absolute( sal_Int32 row
) override
;
127 virtual sal_Bool SAL_CALL
relative( sal_Int32 rows
) override
;
128 virtual sal_Bool SAL_CALL
next( ) override
;
129 virtual sal_Bool SAL_CALL
previous( ) override
;
130 virtual void SAL_CALL
refreshRow( ) override
;
131 virtual sal_Bool SAL_CALL
rowUpdated( ) override
;
132 virtual sal_Bool SAL_CALL
rowInserted( ) override
;
133 virtual sal_Bool SAL_CALL
rowDeleted( ) override
;
134 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
getStatement( ) override
;
137 virtual sal_Bool SAL_CALL
wasNull( ) override
;
138 virtual OUString SAL_CALL
getString( sal_Int32 columnIndex
) override
;
139 virtual sal_Bool SAL_CALL
getBoolean( sal_Int32 columnIndex
) override
;
140 virtual sal_Int8 SAL_CALL
getByte( sal_Int32 columnIndex
) override
;
141 virtual sal_Int16 SAL_CALL
getShort( sal_Int32 columnIndex
) override
;
142 virtual sal_Int32 SAL_CALL
getInt( sal_Int32 columnIndex
) override
;
143 virtual sal_Int64 SAL_CALL
getLong( sal_Int32 columnIndex
) override
;
144 virtual float SAL_CALL
getFloat( sal_Int32 columnIndex
) override
;
145 virtual double SAL_CALL
getDouble( sal_Int32 columnIndex
) override
;
146 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getBytes( sal_Int32 columnIndex
) override
;
147 virtual css::util::Date SAL_CALL
getDate( sal_Int32 columnIndex
) override
;
148 virtual css::util::Time SAL_CALL
getTime( sal_Int32 columnIndex
) override
;
149 virtual css::util::DateTime SAL_CALL
getTimestamp( sal_Int32 columnIndex
) override
;
150 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
getBinaryStream( sal_Int32 columnIndex
) override
;
151 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
getCharacterStream( sal_Int32 columnIndex
) override
;
152 virtual css::uno::Any SAL_CALL
getObject( sal_Int32 columnIndex
, const css::uno::Reference
< css::container::XNameAccess
>& typeMap
) override
;
153 virtual css::uno::Reference
< css::sdbc::XRef
> SAL_CALL
getRef( sal_Int32 columnIndex
) override
;
154 virtual css::uno::Reference
< css::sdbc::XBlob
> SAL_CALL
getBlob( sal_Int32 columnIndex
) override
;
155 virtual css::uno::Reference
< css::sdbc::XClob
> SAL_CALL
getClob( sal_Int32 columnIndex
) override
;
156 virtual css::uno::Reference
< css::sdbc::XArray
> SAL_CALL
getArray( sal_Int32 columnIndex
) override
;
158 // XResultSetMetaDataSupplier
159 virtual css::uno::Reference
< css::sdbc::XResultSetMetaData
> SAL_CALL
getMetaData( ) override
;
162 virtual void SAL_CALL
cancel( ) override
;
165 virtual void SAL_CALL
close( ) override
;
168 virtual css::uno::Any SAL_CALL
getWarnings( ) override
;
169 virtual void SAL_CALL
clearWarnings( ) override
;
172 virtual void SAL_CALL
insertRow( ) override
;
173 virtual void SAL_CALL
updateRow( ) override
;
174 virtual void SAL_CALL
deleteRow( ) override
;
175 virtual void SAL_CALL
cancelRowUpdates( ) override
;
176 virtual void SAL_CALL
moveToInsertRow( ) override
;
177 virtual void SAL_CALL
moveToCurrentRow( ) override
;
179 virtual void SAL_CALL
updateNull( sal_Int32 columnIndex
) override
;
180 virtual void SAL_CALL
updateBoolean( sal_Int32 columnIndex
, sal_Bool x
) override
;
181 virtual void SAL_CALL
updateByte( sal_Int32 columnIndex
, sal_Int8 x
) override
;
182 virtual void SAL_CALL
updateShort( sal_Int32 columnIndex
, sal_Int16 x
) override
;
183 virtual void SAL_CALL
updateInt( sal_Int32 columnIndex
, sal_Int32 x
) override
;
184 virtual void SAL_CALL
updateLong( sal_Int32 columnIndex
, sal_Int64 x
) override
;
185 virtual void SAL_CALL
updateFloat( sal_Int32 columnIndex
, float x
) override
;
186 virtual void SAL_CALL
updateDouble( sal_Int32 columnIndex
, double x
) override
;
187 virtual void SAL_CALL
updateString( sal_Int32 columnIndex
, const OUString
& x
) override
;
188 virtual void SAL_CALL
updateBytes( sal_Int32 columnIndex
, const css::uno::Sequence
< sal_Int8
>& x
) override
;
189 virtual void SAL_CALL
updateDate( sal_Int32 columnIndex
, const css::util::Date
& x
) override
;
190 virtual void SAL_CALL
updateTime( sal_Int32 columnIndex
, const css::util::Time
& x
) override
;
191 virtual void SAL_CALL
updateTimestamp( sal_Int32 columnIndex
, const css::util::DateTime
& x
) override
;
192 virtual void SAL_CALL
updateBinaryStream( sal_Int32 columnIndex
, const css::uno::Reference
< css::io::XInputStream
>& x
, sal_Int32 length
) override
;
193 virtual void SAL_CALL
updateCharacterStream( sal_Int32 columnIndex
, const css::uno::Reference
< css::io::XInputStream
>& x
, sal_Int32 length
) override
;
194 virtual void SAL_CALL
updateObject( sal_Int32 columnIndex
, const css::uno::Any
& x
) override
;
195 virtual void SAL_CALL
updateNumericObject( sal_Int32 columnIndex
, const css::uno::Any
& x
, sal_Int32 scale
) override
;
198 virtual sal_Int32 SAL_CALL
findColumn( const OUString
& columnName
) override
;
201 virtual css::uno::Any SAL_CALL
getBookmark( ) override
;
202 virtual sal_Bool SAL_CALL
moveToBookmark( const css::uno::Any
& bookmark
) override
;
203 virtual sal_Bool SAL_CALL
moveRelativeToBookmark( const css::uno::Any
& bookmark
, sal_Int32 rows
) override
;
204 virtual sal_Int32 SAL_CALL
compareBookmarks( const css::uno::Any
& firstItem
, const css::uno::Any
& secondItem
) override
;
205 virtual sal_Bool SAL_CALL
hasOrderedBookmarks( ) override
;
206 virtual sal_Int32 SAL_CALL
hashBookmark( const css::uno::Any
& bookmark
) override
;
209 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
deleteRows( const css::uno::Sequence
< css::uno::Any
>& rows
) override
;
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */