Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _CONNECTIVITY_FILE_FRESULTSET_HXX_
21 : #define _CONNECTIVITY_FILE_FRESULTSET_HXX_
22 :
23 : #include <com/sun/star/sdbc/XResultSet.hpp>
24 : #include <com/sun/star/sdbc/XRow.hpp>
25 : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
26 : #include <com/sun/star/sdbc/XCloseable.hpp>
27 : #include <com/sun/star/sdbc/XColumnLocate.hpp>
28 : #include <com/sun/star/util/XCancellable.hpp>
29 : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
30 : #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
31 : #include <com/sun/star/sdbc/XRowUpdate.hpp>
32 : #include <cppuhelper/compbase12.hxx>
33 : #include <comphelper/proparrhlp.hxx>
34 : #include "file/FStatement.hxx"
35 : #include "connectivity/CommonTools.hxx"
36 : #include <comphelper/propertycontainer.hxx>
37 : #include "file/fanalyzer.hxx"
38 : #include "file/FTable.hxx"
39 : #include "file/filedllapi.hxx"
40 : #include <comphelper/broadcasthelper.hxx>
41 : #include "connectivity/StdTypeDefs.hxx"
42 : #include "TSortIndex.hxx"
43 : #include "TSkipDeletedSet.hxx"
44 : #include <com/sun/star/lang/XEventListener.hpp>
45 :
46 : namespace connectivity
47 : {
48 : namespace file
49 : {
50 : /*
51 : ** java_sql_ResultSet
52 : */
53 : typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
54 : ::com::sun::star::sdbc::XRow,
55 : ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
56 : ::com::sun::star::util::XCancellable,
57 : ::com::sun::star::sdbc::XWarningsSupplier,
58 : ::com::sun::star::sdbc::XResultSetUpdate,
59 : ::com::sun::star::sdbc::XRowUpdate,
60 : ::com::sun::star::sdbc::XCloseable,
61 : ::com::sun::star::sdbc::XColumnLocate,
62 : ::com::sun::star::lang::XServiceInfo,
63 : ::com::sun::star::lang::XEventListener,
64 : ::com::sun::star::lang::XUnoTunnel> OResultSet_BASE;
65 :
66 : class OOO_DLLPUBLIC_FILE OResultSet :
67 : public comphelper::OBaseMutex,
68 : public ::connectivity::IResultSetHelper,
69 : public OResultSet_BASE,
70 : public ::comphelper::OPropertyContainer,
71 : public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
72 : {
73 :
74 : protected:
75 : ::std::vector<void*> m_aBindVector;
76 : ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime
77 :
78 : ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
79 : ::std::vector<TAscendingOrder> m_aOrderbyAscending;
80 :
81 : OValueRefRow m_aSelectRow;
82 : OValueRefRow m_aRow;
83 : OValueRefRow m_aEvaluateRow; // contains all values of a row
84 : OValueRefRow m_aParameterRow;
85 : OValueRefRow m_aInsertRow; // needed for insert by cursor
86 : ORefAssignValues m_aAssignValues; // needed for insert,update and parameters
87 : // to compare with the restrictions
88 : TIntVector* m_pEvaluationKeySet;
89 : TIntVector::iterator m_aEvaluateIter;
90 :
91 :
92 : // TInt2IntMap m_aBookmarks; // map from bookmarks to logical position
93 : // ::std::vector<TInt2IntMap::iterator> m_aBookmarksPositions;// vector of iterators to bookmark map, the order is the logical position
94 : OSkipDeletedSet m_aSkipDeletedSet;
95 :
96 : ::rtl::Reference<OKeySet> m_pFileSet;
97 : OKeySet::Vector::iterator m_aFileSetIter;
98 :
99 :
100 :
101 : OSortIndex* m_pSortIndex;
102 : ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; // this are the select columns
103 : ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns;
104 : OFileTable* m_pTable;
105 : connectivity::OSQLParseNode* m_pParseTree;
106 :
107 : OSQLAnalyzer* m_pSQLAnalyzer;
108 : connectivity::OSQLParseTreeIterator& m_aSQLIterator;
109 :
110 : sal_Int32 m_nFetchSize;
111 : sal_Int32 m_nResultSetType;
112 : sal_Int32 m_nFetchDirection;
113 : sal_Int32 m_nResultSetConcurrency;
114 :
115 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement;
116 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
117 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
118 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns
119 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xColsIdx; // table columns
120 :
121 :
122 : ::rtl::OUString m_aTableRange;
123 : rtl_TextEncoding m_nTextEncoding;
124 : sal_Int32 m_nRowPos;
125 : sal_Int32 m_nFilePos;
126 : sal_Int32 m_nLastVisitedPos;
127 : sal_Int32 m_nRowCountResult;
128 : sal_Int32 m_nCurrentPosition; // current position of the resultset is returned when ask for getRow()
129 : sal_Int32 m_nColumnCount;
130 : sal_Bool m_bWasNull;
131 : sal_Bool m_bEOF; // after last record
132 : sal_Bool m_bLastRecord;
133 : sal_Bool m_bInserted; // true when moveToInsertRow was called
134 : // set to false when cursor moved or cancel
135 : sal_Bool m_bRowUpdated;
136 : sal_Bool m_bRowInserted;
137 : sal_Bool m_bRowDeleted;
138 : sal_Bool m_bShowDeleted;
139 : sal_Bool m_bIsCount;
140 :
141 : void initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount);
142 : void construct();
143 : sal_Bool evaluate();
144 :
145 : sal_Bool ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
146 : sal_Int32 nOffset = 1,
147 : sal_Bool bEvaluate = sal_True,
148 : sal_Bool bRetrieveData = sal_True);
149 :
150 : OKeyValue* GetOrderbyKeyValue(OValueRefRow& _rRow);
151 0 : sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;}
152 :
153 : // return true when the select statement is "select count(*) from table"
154 0 : inline sal_Bool isCount() const { return m_bIsCount; }
155 : void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
156 :
157 : const ORowSetValue& getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
158 : void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
159 : // clear insert row
160 : void clearInsertRow();
161 : void sortRows();
162 : protected:
163 :
164 : using OResultSet_BASE::rBHelper;
165 :
166 : sal_Bool Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Bool bRetrieveData);
167 : virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex);
168 :
169 : // OPropertyArrayUsageHelper
170 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
171 : // OPropertySetHelper
172 : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
173 :
174 : virtual ~OResultSet();
175 : public:
176 : DECLARE_SERVICE_INFO();
177 : // a Constructor, that is needed for when Returning the Object is needed:
178 : OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator);
179 :
180 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
181 : {
182 : return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
183 : }
184 :
185 : // ::cppu::OComponentHelper
186 : virtual void SAL_CALL disposing(void);
187 : // XInterface
188 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
189 : virtual void SAL_CALL acquire() throw();
190 : virtual void SAL_CALL release() throw();
191 : //XTypeProvider
192 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
193 : // XPropertySet
194 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
195 : // XResultSet
196 : virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
197 : virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
198 : virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
199 : virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
200 : virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
201 : virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
202 : virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
203 : virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
204 : virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
205 : virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
206 : virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
207 : virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
208 : virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
209 : virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
210 : virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
211 : virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
212 : virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
213 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
214 : // XRow
215 : virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
216 : virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
217 : virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
218 : virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
219 : virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
220 : virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
221 : virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
222 : virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
223 : virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
224 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
225 : virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
226 : virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
227 : virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
228 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
229 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
230 : virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
231 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
232 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
233 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
234 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
235 : // XResultSetMetaDataSupplier
236 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
237 : // XCancellable
238 : virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
239 : // XCloseable
240 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
241 : // XWarningsSupplier
242 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
243 : virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
244 : // XResultSetUpdate
245 : virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
246 : virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
247 : virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
248 : virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
249 : virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
250 : virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
251 : // XRowUpdate
252 : virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
253 : virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
254 : virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
255 : virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
256 : virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
257 : virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
258 : virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
259 : virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
260 : virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
261 : virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
262 : virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
263 : virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
264 : virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
265 : virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
266 : virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
267 : virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
268 : virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
269 : // XColumnLocate
270 : virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
271 : // com::sun::star::lang::XUnoTunnel
272 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
273 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
274 : //XEventlistener
275 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
276 :
277 : // special methods
278 : inline sal_Int32 mapColumn(sal_Int32 column);
279 : virtual sal_Bool OpenImpl();
280 : virtual void doTableSpecials(const OSQLTable& _xTable);
281 :
282 0 : inline sal_Int32 getRowCountResult() const { return m_nRowCountResult; }
283 0 : inline void setParameterRow(const OValueRefRow& _rParaRow) { m_aParameterRow = _rParaRow; }
284 0 : inline void setEvaluationRow(const OValueRefRow& _aRow) { m_aEvaluateRow = _aRow; }
285 0 : inline void setParameterColumns(const ::rtl::Reference<connectivity::OSQLColumns>& _xParamColumns) { m_xParamColumns = _xParamColumns; }
286 0 : inline void setAssignValues(const ORefAssignValues& _aAssignValues) { m_aAssignValues = _aAssignValues; }
287 0 : inline void setBindingRow(const OValueRefRow& _aRow) { m_aRow = _aRow; }
288 0 : inline void setSelectRow(const OValueRefRow& _rRow)
289 : {
290 0 : m_aSelectRow = _rRow;
291 0 : m_nColumnCount = m_aSelectRow->get().size();
292 0 : }
293 0 : inline void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping) { m_aColMapping = _aColumnMapping; }
294 0 : inline void setSqlAnalyzer(OSQLAnalyzer* _pSQLAnalyzer) { m_pSQLAnalyzer = _pSQLAnalyzer; }
295 :
296 0 : inline void setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy) { m_aOrderbyColumnNumber = _aColumnOrderBy; }
297 0 : inline void setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc) { m_aOrderbyAscending = _aOrderbyAsc; }
298 0 : inline void setEvaluationKeySet(TIntVector* _pEvaluationKeySet) { m_pEvaluationKeySet = _pEvaluationKeySet; }
299 0 : inline void setMetaData(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;}
300 :
301 : // clears the resultset so it can be reused by a preparedstatement
302 : void clear();
303 : static void setBoundedColumns(const OValueRefRow& _rRow,
304 : const OValueRefRow& _rSelectRow,
305 : const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
306 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xNames,
307 : sal_Bool _bSetColumnMapping,
308 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
309 : ::std::vector<sal_Int32>& _rColMapping);
310 :
311 : // IResultSetHelper
312 : virtual sal_Bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
313 : virtual sal_Int32 getDriverPos() const;
314 : virtual sal_Bool deletedVisible() const;
315 : virtual sal_Bool isRowDeleted() const;
316 : };
317 : // -------------------------------------------------------------------------
318 0 : inline sal_Int32 OResultSet::mapColumn(sal_Int32 column)
319 : {
320 0 : sal_Int32 map = column;
321 :
322 : OSL_ENSURE(column > 0, "file::OResultSet::mapColumn: invalid column index!");
323 : // the first column (index 0) is for convenience only. The first real select column is no 1.
324 0 : if ((column > 0) && (column < (sal_Int32)m_aColMapping.size()))
325 0 : map = m_aColMapping[column];
326 :
327 0 : return map;
328 : }
329 : }
330 : }
331 : #endif // _CONNECTIVITY_FILE_ORESULTSET_HXX_
332 :
333 :
334 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|