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 : #include "CacheSet.hxx"
21 : #include "core_resource.hxx"
22 : #include "core_resource.hrc"
23 : #include <com/sun/star/sdbcx/CompareBookmark.hpp>
24 : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
27 : #include <com/sun/star/sdbc/XPreparedStatement.hpp>
28 : #include <com/sun/star/sdbc/ColumnValue.hpp>
29 : #include <com/sun/star/sdbc/XParameters.hpp>
30 : #include "dbastrings.hrc"
31 : #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
32 : #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
33 :
34 : #include <limits>
35 :
36 : #include <connectivity/dbtools.hxx>
37 : #include <com/sun/star/sdbcx/KeyType.hpp>
38 : #include <comphelper/extract.hxx>
39 : #include <com/sun/star/io/XInputStream.hpp>
40 : #include <comphelper/types.hxx>
41 : #include <tools/debug.hxx>
42 : #include <rtl/ustrbuf.hxx>
43 :
44 : using namespace comphelper;
45 :
46 : using namespace dbaccess;
47 : using namespace dbtools;
48 : using namespace connectivity;
49 : using namespace ::com::sun::star::uno;
50 : using namespace ::com::sun::star::beans;
51 : using namespace ::com::sun::star::sdbc;
52 : using namespace ::com::sun::star::sdbcx;
53 : using namespace ::com::sun::star::container;
54 : using namespace ::com::sun::star::lang;
55 : using namespace ::com::sun::star::io;
56 : using namespace ::osl;
57 :
58 :
59 44 : OCacheSet::OCacheSet(sal_Int32 i_nMaxRows)
60 : :m_nMaxRows(i_nMaxRows)
61 : ,m_bInserted(false)
62 : ,m_bUpdated(false)
63 44 : ,m_bDeleted(false)
64 : {
65 :
66 44 : }
67 :
68 0 : OUString OCacheSet::getIdentifierQuoteString() const
69 : {
70 0 : OUString sQuote;
71 0 : Reference<XDatabaseMetaData> xMeta;
72 0 : if ( m_xConnection.is() && (xMeta = m_xConnection->getMetaData()).is() )
73 0 : sQuote = xMeta->getIdentifierQuoteString();
74 0 : return sQuote;
75 : }
76 :
77 46 : void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const OUString &i_sRowSetFilter)
78 : {
79 : OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet");
80 :
81 46 : m_sRowSetFilter = i_sRowSetFilter;
82 :
83 46 : if(_xDriverSet.is())
84 : {
85 46 : m_xDriverSet = _xDriverSet;
86 46 : m_xDriverRow.set(_xDriverSet,UNO_QUERY);
87 46 : m_xSetMetaData = Reference<XResultSetMetaDataSupplier>(_xDriverSet,UNO_QUERY)->getMetaData();
88 46 : if ( m_xSetMetaData.is() )
89 : {
90 46 : const sal_Int32 nCount = m_xSetMetaData->getColumnCount();
91 46 : m_aNullable.realloc(nCount);
92 46 : m_aSignedFlags.realloc(nCount);
93 46 : m_aColumnTypes.realloc(nCount);
94 46 : sal_Bool* pNullableIter = m_aNullable.getArray();
95 46 : sal_Bool* pSignedIter = m_aSignedFlags.getArray();
96 46 : sal_Int32* pColumnIter = m_aColumnTypes.getArray();
97 550 : for (sal_Int32 i=1; i <= nCount; ++i,++pSignedIter,++pColumnIter,++pNullableIter)
98 : {
99 504 : *pNullableIter = m_xSetMetaData->isNullable(i) != ColumnValue::NO_NULLS;
100 504 : *pSignedIter = m_xSetMetaData->isSigned(i);
101 504 : *pColumnIter = m_xSetMetaData->getColumnType(i);
102 : }
103 : }
104 46 : Reference< XStatement> xStmt(m_xDriverSet->getStatement(),UNO_QUERY);
105 46 : if(xStmt.is())
106 0 : m_xConnection = xStmt->getConnection();
107 : else
108 : {
109 46 : Reference< XPreparedStatement> xPrepStmt(m_xDriverSet->getStatement(),UNO_QUERY);
110 46 : if ( xPrepStmt.is() )
111 46 : m_xConnection = xPrepStmt->getConnection();
112 46 : }
113 : }
114 46 : }
115 :
116 88 : OCacheSet::~OCacheSet()
117 : {
118 : try
119 : {
120 44 : m_xDriverSet = NULL;
121 44 : m_xDriverRow = NULL;
122 44 : m_xSetMetaData = NULL;
123 44 : m_xConnection = NULL;
124 : }
125 0 : catch(Exception&)
126 : {
127 : SAL_WARN("dbaccess", "Exception occurred");
128 : }
129 0 : catch(...)
130 : {
131 : SAL_WARN("dbaccess", "Unknown Exception occurred");
132 : }
133 :
134 44 : }
135 :
136 0 : void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQLException, RuntimeException)
137 : {
138 : OSL_ENSURE(_xTable.is(),"OCacheSet::fillTableName: PropertySet is empty!");
139 0 : if(m_aComposedTableName.isEmpty() && _xTable.is() )
140 : {
141 0 : Reference<XDatabaseMetaData> xMeta(m_xConnection->getMetaData());
142 0 : m_aComposedTableName = composeTableName(xMeta
143 0 : ,comphelper::getString(_xTable->getPropertyValue(PROPERTY_CATALOGNAME))
144 0 : ,comphelper::getString(_xTable->getPropertyValue(PROPERTY_SCHEMANAME))
145 0 : ,comphelper::getString(_xTable->getPropertyValue(PROPERTY_NAME))
146 : ,true
147 0 : ,::dbtools::eInDataManipulation);
148 : }
149 0 : }
150 :
151 0 : void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
152 : {
153 0 : Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
154 0 : fillTableName(xSet);
155 :
156 0 : OUStringBuffer aSql("INSERT INTO " + m_aComposedTableName + " ( ");
157 :
158 : // set values and column names
159 0 : OUStringBuffer aValues(" VALUES ( ");
160 0 : static OUString aPara("?,");
161 0 : OUString aQuote = getIdentifierQuoteString();
162 0 : static OUString aComma(",");
163 0 : sal_Int32 i = 1;
164 0 : ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1;
165 0 : connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
166 0 : for(; aIter != aEnd;++aIter)
167 : {
168 0 : aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + aComma);
169 0 : aValues.append(aPara);
170 : }
171 :
172 0 : aSql[aSql.getLength() - 1] = ')';
173 0 : aValues[aValues.getLength() - 1] = ')';
174 :
175 0 : aSql.append(aValues.makeStringAndClear());
176 : // now create end execute the prepared statement
177 : {
178 0 : Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
179 0 : Reference< XParameters > xParameter(xPrep,UNO_QUERY);
180 0 : i = 1;
181 0 : for(aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter,++i)
182 : {
183 0 : if(aIter->isNull())
184 0 : xParameter->setNull(i,aIter->getTypeKind());
185 : else
186 0 : setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
187 : }
188 :
189 0 : m_bInserted = xPrep->executeUpdate() > 0;
190 0 : }
191 :
192 : // TODO set the bookmark in the insert row
193 0 : }
194 :
195 0 : void OCacheSet::fillParameters( const ORowSetRow& _rRow
196 : ,const connectivity::OSQLTable& _xTable
197 : ,OUStringBuffer& _sCondition
198 : ,OUStringBuffer& _sParameter
199 : ,::std::list< sal_Int32>& _rOrgValues)
200 : {
201 : // use keys and indexes for exact positioning
202 : // first the keys
203 0 : Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
204 0 : const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet);
205 : // second the indexes
206 0 : Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
207 0 : Reference<XIndexAccess> xIndexes;
208 0 : if(xIndexSup.is())
209 0 : xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
210 :
211 : // Reference<XColumnsSupplier>
212 0 : Reference<XPropertySet> xIndexColsSup;
213 0 : Reference<XNameAccess> xIndexColumns;
214 0 : ::std::vector< Reference<XNameAccess> > aAllIndexColumns;
215 0 : if(xIndexes.is())
216 : {
217 0 : for(sal_Int32 j=0;j<xIndexes->getCount();++j)
218 : {
219 0 : xIndexColsSup.set(xIndexes->getByIndex(j),UNO_QUERY);
220 0 : if( xIndexColsSup.is()
221 0 : && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
222 0 : && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
223 : )
224 0 : aAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
225 : }
226 : }
227 :
228 0 : OUString aColumnName;
229 :
230 0 : static OUString aPara("?,");
231 0 : static OUString aAnd(" AND ");
232 :
233 0 : OUString aQuote = getIdentifierQuoteString();
234 :
235 0 : sal_Int32 nCheckCount = 1; // index for the original values
236 0 : sal_Int32 i = 1;
237 :
238 0 : OUString sIsNull(" IS NULL");
239 0 : OUString sParam(" = ?");
240 0 : ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->get().begin()+1;
241 0 : ORowVector< ORowSetValue >::Vector::const_iterator aEnd = _rRow->get().end()+1;
242 0 : for(; aIter != aEnd;++aIter,++nCheckCount,++i)
243 : {
244 0 : aColumnName = m_xSetMetaData->getColumnName(i);
245 0 : if(xPrimaryKeyColumns.is() && xPrimaryKeyColumns->hasByName(aColumnName))
246 : {
247 0 : _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
248 0 : if(aIter->isNull())
249 0 : _sCondition.append(sIsNull);
250 : else
251 0 : _sCondition.append(sParam);
252 0 : _sCondition.append(aAnd);
253 0 : _rOrgValues.push_back(nCheckCount);
254 :
255 : }
256 0 : ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
257 0 : for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
258 : aIndexIter != aIndexEnd;++aIndexIter)
259 : {
260 0 : if((*aIndexIter)->hasByName(aColumnName))
261 : {
262 0 : _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
263 0 : if(aIter->isNull())
264 0 : _sCondition.append(sIsNull);
265 : else
266 0 : _sCondition.append(sParam);
267 0 : _sCondition.append(aAnd);
268 0 : _rOrgValues.push_back(nCheckCount);
269 0 : break;
270 : }
271 : }
272 0 : if(aIter->isModified())
273 : {
274 0 : _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + aPara);
275 : }
276 0 : }
277 0 : }
278 :
279 0 : void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
280 : {
281 0 : Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
282 0 : fillTableName(xSet);
283 :
284 0 : OUStringBuffer aSql("UPDATE " + m_aComposedTableName + " SET ");
285 : // list all columns that should be set
286 :
287 0 : OUStringBuffer aCondition;
288 0 : ::std::list< sal_Int32> aOrgValues;
289 0 : fillParameters(_rInsertRow,_xTable,aCondition,aSql,aOrgValues);
290 0 : aSql[aSql.getLength() - 1] = ' ';
291 0 : if ( !aCondition.isEmpty() )
292 : {
293 0 : aCondition.setLength(aCondition.getLength()-5);
294 :
295 0 : aSql.append(" WHERE " + aCondition.makeStringAndClear());
296 : }
297 : else
298 : ::dbtools::throwSQLException(
299 0 : DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), SQL_GENERAL_ERROR, *this );
300 :
301 : // now create end execute the prepared statement
302 0 : Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
303 0 : Reference< XParameters > xParameter(xPrep,UNO_QUERY);
304 0 : sal_Int32 i = 1;
305 0 : connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
306 0 : for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
307 : {
308 0 : if(aIter->isModified())
309 : {
310 0 : setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
311 0 : ++i;
312 : }
313 : }
314 0 : ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
315 0 : for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValueEnd;++aOrgValue,++i)
316 : {
317 0 : setParameter(i,xParameter,(_rOriginalRow->get())[*aOrgValue],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
318 : }
319 :
320 0 : m_bUpdated = xPrep->executeUpdate() > 0;
321 0 : }
322 :
323 0 : void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
324 : {
325 0 : Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
326 0 : fillTableName(xSet);
327 :
328 0 : OUStringBuffer aSql("DELETE FROM " + m_aComposedTableName + " WHERE ");
329 :
330 : // use keys and indexes for exact positioning
331 : // first the keys
332 0 : const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet);
333 : // second the indexes
334 0 : Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
335 0 : Reference<XIndexAccess> xIndexes;
336 0 : if(xIndexSup.is())
337 0 : xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
338 :
339 : // Reference<XColumnsSupplier>
340 0 : Reference<XPropertySet> xIndexColsSup;
341 0 : Reference<XNameAccess> xIndexColumns;
342 0 : ::std::vector< Reference<XNameAccess> > aAllIndexColumns;
343 0 : if(xIndexes.is())
344 : {
345 0 : for(sal_Int32 j=0;j<xIndexes->getCount();++j)
346 : {
347 0 : xIndexColsSup.set(xIndexes->getByIndex(j),UNO_QUERY);
348 0 : if( xIndexColsSup.is()
349 0 : && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
350 0 : && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
351 : )
352 0 : aAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
353 : }
354 : }
355 :
356 0 : OUStringBuffer aColumnName;
357 0 : ::std::list< sal_Int32> aOrgValues;
358 0 : fillParameters(_rDeleteRow,_xTable,aSql,aColumnName,aOrgValues);
359 :
360 0 : aSql.setLength(aSql.getLength()-5);
361 :
362 : // now create and execute the prepared statement
363 0 : Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
364 0 : Reference< XParameters > xParameter(xPrep,UNO_QUERY);
365 0 : sal_Int32 i = 1;
366 0 : ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
367 0 : for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValueEnd;++j,++i)
368 : {
369 0 : setParameter(i,xParameter,(_rDeleteRow->get())[*j],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
370 : }
371 :
372 0 : m_bDeleted = xPrep->executeUpdate() > 0;
373 0 : }
374 :
375 0 : void OCacheSet::setParameter(sal_Int32 nPos
376 : ,const Reference< XParameters >& _xParameter
377 : ,const ORowSetValue& _rValue
378 : ,sal_Int32 _nType
379 : ,sal_Int32 _nScale) const
380 : {
381 0 : sal_Int32 nType = ( _nType != DataType::OTHER ) ? _nType : _rValue.getTypeKind();
382 0 : ::dbtools::setObjectWithInfo(_xParameter,nPos,_rValue,nType,_nScale);
383 0 : }
384 :
385 356 : void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition)
386 : {
387 356 : Any aBookmark = getBookmark();
388 356 : if(!aBookmark.hasValue())
389 0 : aBookmark = makeAny(_nPosition);
390 :
391 356 : connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rRow->get().begin();
392 356 : connectivity::ORowVector< ORowSetValue >::Vector::iterator aEnd = _rRow->get().end();
393 356 : (*aIter) = aBookmark;
394 356 : ++aIter;
395 6260 : for(sal_Int32 i=1;aIter != aEnd;++aIter,++i)
396 : {
397 5904 : aIter->setSigned(m_aSignedFlags[i-1]);
398 5904 : aIter->fill(i, m_aColumnTypes[i-1], this);
399 356 : }
400 356 : }
401 :
402 5904 : sal_Bool SAL_CALL OCacheSet::wasNull( ) throw(SQLException, RuntimeException, std::exception)
403 : {
404 5904 : return m_xDriverRow->wasNull();
405 : }
406 :
407 5736 : OUString SAL_CALL OCacheSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
408 : {
409 5736 : return m_xDriverRow->getString(columnIndex);
410 : }
411 :
412 56 : sal_Bool SAL_CALL OCacheSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
413 : {
414 56 : return m_xDriverRow->getBoolean(columnIndex);
415 : }
416 :
417 0 : sal_Int8 SAL_CALL OCacheSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
418 : {
419 0 : return m_xDriverRow->getByte(columnIndex);
420 : }
421 :
422 0 : sal_Int16 SAL_CALL OCacheSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
423 : {
424 0 : return m_xDriverRow->getShort(columnIndex);
425 : }
426 :
427 0 : sal_Int32 SAL_CALL OCacheSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
428 : {
429 0 : return m_xDriverRow->getInt(columnIndex);
430 : }
431 :
432 0 : sal_Int64 SAL_CALL OCacheSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
433 : {
434 0 : return m_xDriverRow->getLong(columnIndex);
435 : }
436 :
437 0 : float SAL_CALL OCacheSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
438 : {
439 0 : return m_xDriverRow->getFloat(columnIndex);
440 : }
441 :
442 0 : double SAL_CALL OCacheSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
443 : {
444 0 : return m_xDriverRow->getDouble(columnIndex);
445 : }
446 :
447 0 : Sequence< sal_Int8 > SAL_CALL OCacheSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
448 : {
449 0 : return m_xDriverRow->getBytes(columnIndex);
450 : }
451 :
452 112 : ::com::sun::star::util::Date SAL_CALL OCacheSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
453 : {
454 112 : return m_xDriverRow->getDate(columnIndex);
455 : }
456 :
457 0 : ::com::sun::star::util::Time SAL_CALL OCacheSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
458 : {
459 0 : return m_xDriverRow->getTime(columnIndex);
460 : }
461 :
462 0 : ::com::sun::star::util::DateTime SAL_CALL OCacheSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
463 : {
464 0 : return m_xDriverRow->getTimestamp(columnIndex);
465 : }
466 :
467 0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
468 : {
469 0 : return m_xDriverRow->getBinaryStream(columnIndex);
470 : }
471 :
472 0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
473 : {
474 0 : return m_xDriverRow->getCharacterStream(columnIndex);
475 : }
476 :
477 0 : Any SAL_CALL OCacheSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException, std::exception)
478 : {
479 0 : return m_xDriverRow->getObject(columnIndex,typeMap);
480 : }
481 :
482 0 : Reference< XRef > SAL_CALL OCacheSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
483 : {
484 0 : return m_xDriverRow->getRef(columnIndex);
485 : }
486 :
487 0 : Reference< XBlob > SAL_CALL OCacheSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
488 : {
489 0 : return m_xDriverRow->getBlob(columnIndex);
490 : }
491 :
492 0 : Reference< XClob > SAL_CALL OCacheSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
493 : {
494 0 : return m_xDriverRow->getClob(columnIndex);
495 : }
496 :
497 0 : Reference< XArray > SAL_CALL OCacheSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
498 : {
499 0 : return m_xDriverRow->getArray(columnIndex);
500 : }
501 :
502 : // XResultSet
503 346 : bool SAL_CALL OCacheSet::next( ) throw(SQLException, RuntimeException)
504 : {
505 346 : m_bInserted = m_bUpdated = m_bDeleted = false;
506 346 : return m_xDriverSet->next();
507 : }
508 :
509 0 : bool SAL_CALL OCacheSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
510 : {
511 0 : return m_xDriverSet->isBeforeFirst();
512 : }
513 :
514 0 : bool SAL_CALL OCacheSet::isAfterLast( ) throw(SQLException, RuntimeException)
515 : {
516 0 : return m_xDriverSet->isAfterLast();
517 : }
518 :
519 0 : bool SAL_CALL OCacheSet::isFirst( ) throw(SQLException, RuntimeException)
520 : {
521 0 : return m_xDriverSet->isFirst();
522 : }
523 :
524 0 : bool SAL_CALL OCacheSet::isLast( ) throw(SQLException, RuntimeException)
525 : {
526 0 : return m_xDriverSet->isLast();
527 : }
528 :
529 12 : void SAL_CALL OCacheSet::beforeFirst( ) throw(SQLException, RuntimeException)
530 : {
531 12 : m_bInserted = m_bUpdated = m_bDeleted = false;
532 12 : m_xDriverSet->beforeFirst();
533 12 : }
534 :
535 10 : void SAL_CALL OCacheSet::afterLast( ) throw(SQLException, RuntimeException)
536 : {
537 10 : m_bInserted = m_bUpdated = m_bDeleted = false;
538 10 : m_xDriverSet->afterLast();
539 10 : }
540 :
541 58 : bool SAL_CALL OCacheSet::first( ) throw(SQLException, RuntimeException)
542 : {
543 58 : m_bInserted = m_bUpdated = m_bDeleted = false;
544 58 : return m_xDriverSet->first();
545 : }
546 :
547 8 : bool SAL_CALL OCacheSet::last( ) throw(SQLException, RuntimeException)
548 : {
549 8 : m_bInserted = m_bUpdated = m_bDeleted = false;
550 8 : return m_xDriverSet->last();
551 : }
552 :
553 76 : sal_Int32 SAL_CALL OCacheSet::getRow( ) throw(SQLException, RuntimeException)
554 : {
555 76 : return m_xDriverSet->getRow();
556 : }
557 :
558 140 : bool SAL_CALL OCacheSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
559 : {
560 140 : m_bInserted = m_bUpdated = m_bDeleted = false;
561 140 : return m_xDriverSet->absolute(row);
562 : }
563 :
564 0 : bool SAL_CALL OCacheSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
565 : {
566 0 : m_bInserted = m_bUpdated = m_bDeleted = false;
567 0 : return m_xDriverSet->relative(rows);
568 : }
569 :
570 46 : bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException)
571 : {
572 46 : m_bInserted = m_bUpdated = m_bDeleted = false;
573 46 : return m_xDriverSet->previous();
574 : }
575 :
576 0 : bool OCacheSet::last_checked( bool /*i_bFetchRow*/)
577 : {
578 0 : return last();
579 : }
580 :
581 46 : bool OCacheSet::previous_checked( bool /*i_bFetchRow*/ )
582 : {
583 46 : return previous();
584 : }
585 :
586 0 : bool OCacheSet::absolute_checked( sal_Int32 row,bool /*i_bFetchRow*/ )
587 : {
588 0 : return absolute(row);
589 : }
590 :
591 2 : void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException)
592 : {
593 2 : m_xDriverSet->refreshRow();
594 2 : }
595 :
596 2 : bool SAL_CALL OCacheSet::rowUpdated( ) throw(SQLException, RuntimeException)
597 : {
598 2 : return m_xDriverSet->rowUpdated();
599 : }
600 :
601 4 : bool SAL_CALL OCacheSet::rowInserted( ) throw(SQLException, RuntimeException)
602 : {
603 4 : return m_xDriverSet->rowInserted();
604 : }
605 :
606 2 : bool SAL_CALL OCacheSet::rowDeleted( ) throw(SQLException, RuntimeException)
607 : {
608 2 : return m_xDriverSet->rowDeleted();
609 : }
610 :
611 0 : Reference< XInterface > SAL_CALL OCacheSet::getStatement( ) throw(SQLException, RuntimeException)
612 : {
613 0 : return m_xDriverSet->getStatement();
614 : }
615 :
616 8 : bool OCacheSet::isResultSetChanged() const
617 : {
618 8 : return false;
619 : }
620 :
621 12 : void OCacheSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& /*io_aInsertRow*/,ORowSetValueVector::Vector& /*io_aRow*/,::std::vector<sal_Int32>& o_aChangedColumns)
622 : {
623 12 : o_aChangedColumns.push_back(i_nColumnIndex);
624 12 : }
625 :
626 48 : bool OCacheSet::columnValuesUpdated(ORowSetValueVector::Vector& /*io_aCachedRow*/,const ORowSetValueVector::Vector& /*io_aRow*/)
627 : {
628 48 : return false;
629 : }
630 :
631 0 : bool OCacheSet::updateColumnValues(const ORowSetValueVector::Vector& /*io_aCachedRow*/,ORowSetValueVector::Vector& /*io_aRow*/,const ::std::vector<sal_Int32>& /*i_aChangedColumns*/)
632 : {
633 0 : return true;
634 : }
635 :
636 0 : void OCacheSet::fillMissingValues(ORowSetValueVector::Vector& /*io_aRow*/) const
637 : {
638 0 : }
639 :
640 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|