Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dbaccess / source / core / api / CacheSet.cxx
blob8b8e9242231cef1b5edab50d22f73d82617fc2c5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
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>
34 #include <limits>
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 #include <rtl/logfile.hxx>
45 using namespace comphelper;
47 using namespace dbaccess;
48 using namespace dbtools;
49 using namespace connectivity;
50 using namespace ::com::sun::star::uno;
51 using namespace ::com::sun::star::beans;
52 using namespace ::com::sun::star::sdbc;
53 using namespace ::com::sun::star::sdbcx;
54 using namespace ::com::sun::star::container;
55 using namespace ::com::sun::star::lang;
56 using namespace ::com::sun::star::io;
57 using namespace ::osl;
59 DBG_NAME(OCacheSet)
61 OCacheSet::OCacheSet(sal_Int32 i_nMaxRows)
62 :m_nMaxRows(i_nMaxRows)
63 ,m_bInserted(sal_False)
64 ,m_bUpdated(sal_False)
65 ,m_bDeleted(sal_False)
67 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::OCacheSet" );
68 DBG_CTOR(OCacheSet,NULL);
72 ::rtl::OUString OCacheSet::getIdentifierQuoteString() const
74 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getIdentifierQuoteString" );
75 ::rtl::OUString sQuote;
76 Reference<XDatabaseMetaData> xMeta;
77 if ( m_xConnection.is() && (xMeta = m_xConnection->getMetaData()).is() )
78 sQuote = xMeta->getIdentifierQuoteString();
79 return sQuote;
82 void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& /*i_sRowSetFilter*/)
84 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::construct" );
85 OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet");
86 if(_xDriverSet.is())
88 m_xDriverSet = _xDriverSet;
89 m_xDriverRow.set(_xDriverSet,UNO_QUERY);
90 m_xSetMetaData = Reference<XResultSetMetaDataSupplier>(_xDriverSet,UNO_QUERY)->getMetaData();
91 if ( m_xSetMetaData.is() )
93 const sal_Int32 nCount = m_xSetMetaData->getColumnCount();
94 m_aNullable.realloc(nCount);
95 m_aSignedFlags.realloc(nCount);
96 m_aColumnTypes.realloc(nCount);
97 sal_Bool* pNullableIter = m_aNullable.getArray();
98 sal_Bool* pSignedIter = m_aSignedFlags.getArray();
99 sal_Int32* pColumnIter = m_aColumnTypes.getArray();
100 for (sal_Int32 i=1; i <= nCount; ++i,++pSignedIter,++pColumnIter,++pNullableIter)
102 *pNullableIter = m_xSetMetaData->isNullable(i) != ColumnValue::NO_NULLS;
103 *pSignedIter = m_xSetMetaData->isSigned(i);
104 *pColumnIter = m_xSetMetaData->getColumnType(i);
107 Reference< XStatement> xStmt(m_xDriverSet->getStatement(),UNO_QUERY);
108 if(xStmt.is())
109 m_xConnection = xStmt->getConnection();
110 else
112 Reference< XPreparedStatement> xPrepStmt(m_xDriverSet->getStatement(),UNO_QUERY);
113 if ( xPrepStmt.is() )
114 m_xConnection = xPrepStmt->getConnection();
119 OCacheSet::~OCacheSet()
123 m_xDriverSet = NULL;
124 m_xDriverRow = NULL;
125 m_xSetMetaData = NULL;
126 m_xConnection = NULL;
128 catch(Exception&)
130 OSL_FAIL("Exception occurred");
132 catch(...)
134 OSL_FAIL("Unknown Exception occurred");
137 DBG_DTOR(OCacheSet,NULL);
140 void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQLException, RuntimeException)
142 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillTableName" );
143 OSL_ENSURE(_xTable.is(),"OCacheSet::fillTableName: PropertySet is empty!");
144 if(m_aComposedTableName.isEmpty() && _xTable.is() )
146 Reference<XDatabaseMetaData> xMeta(m_xConnection->getMetaData());
147 m_aComposedTableName = composeTableName(xMeta
148 ,comphelper::getString(_xTable->getPropertyValue(PROPERTY_CATALOGNAME))
149 ,comphelper::getString(_xTable->getPropertyValue(PROPERTY_SCHEMANAME))
150 ,comphelper::getString(_xTable->getPropertyValue(PROPERTY_NAME))
151 ,sal_True
152 ,::dbtools::eInDataManipulation);
156 void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
158 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::insertRow" );
159 ::rtl::OUStringBuffer aSql(::rtl::OUString("INSERT INTO "));
160 Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
161 fillTableName(xSet);
163 aSql.append(m_aComposedTableName);
164 aSql.append(::rtl::OUString(" ( "));
165 // set values and column names
166 ::rtl::OUStringBuffer aValues = ::rtl::OUString(" VALUES ( ");
167 static ::rtl::OUString aPara("?,");
168 ::rtl::OUString aQuote = getIdentifierQuoteString();
169 static ::rtl::OUString aComma(",");
170 sal_Int32 i = 1;
171 ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1;
172 connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
173 for(; aIter != aEnd;++aIter)
175 aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)));
176 aSql.append(aComma);
177 aValues.append(aPara);
180 aSql[aSql.getLength() - 1] = ')';
181 aValues[aValues.getLength() - 1] = ')';
183 aSql.append(aValues.makeStringAndClear());
184 // now create end execute the prepared statement
186 Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
187 Reference< XParameters > xParameter(xPrep,UNO_QUERY);
188 i = 1;
189 for(aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter,++i)
191 if(aIter->isNull())
192 xParameter->setNull(i,aIter->getTypeKind());
193 else
194 setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
197 m_bInserted = xPrep->executeUpdate() > 0;
200 // TODO set the bookmark in the insert row
203 void OCacheSet::fillParameters( const ORowSetRow& _rRow
204 ,const connectivity::OSQLTable& _xTable
205 ,::rtl::OUStringBuffer& _sCondition
206 ,::rtl::OUStringBuffer& _sParameter
207 ,::std::list< sal_Int32>& _rOrgValues)
209 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillParameters" );
210 // use keys and indexes for exact positioning
211 // first the keys
212 Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
213 const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet);
214 // second the indexes
215 Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
216 Reference<XIndexAccess> xIndexes;
217 if(xIndexSup.is())
218 xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
220 // Reference<XColumnsSupplier>
221 Reference<XPropertySet> xIndexColsSup;
222 Reference<XNameAccess> xIndexColumns;
223 ::std::vector< Reference<XNameAccess> > aAllIndexColumns;
224 if(xIndexes.is())
226 for(sal_Int32 j=0;j<xIndexes->getCount();++j)
228 xIndexColsSup.set(xIndexes->getByIndex(j),UNO_QUERY);
229 if( xIndexColsSup.is()
230 && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
231 && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
233 aAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
237 ::rtl::OUString aColumnName;
239 static ::rtl::OUString aPara("?,");
240 static ::rtl::OUString aAnd(" AND ");
242 ::rtl::OUString aQuote = getIdentifierQuoteString();
244 sal_Int32 nCheckCount = 1; // index for the orginal values
245 sal_Int32 i = 1;
247 ::rtl::OUString sIsNull(" IS NULL");
248 ::rtl::OUString sParam(" = ?");
249 ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->get().begin()+1;
250 ORowVector< ORowSetValue >::Vector::const_iterator aEnd = _rRow->get().end()+1;
251 for(; aIter != aEnd;++aIter,++nCheckCount,++i)
253 aColumnName = m_xSetMetaData->getColumnName(i);
254 if(xPrimaryKeyColumns.is() && xPrimaryKeyColumns->hasByName(aColumnName))
256 _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
257 if(aIter->isNull())
258 _sCondition.append(sIsNull);
259 else
260 _sCondition.append(sParam);
261 _sCondition.append(aAnd);
262 _rOrgValues.push_back(nCheckCount);
265 ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
266 for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
267 aIndexIter != aIndexEnd;++aIndexIter)
269 if((*aIndexIter)->hasByName(aColumnName))
271 _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
272 if(aIter->isNull())
273 _sCondition.append(sIsNull);
274 else
275 _sCondition.append(sParam);
276 _sCondition.append(aAnd);
277 _rOrgValues.push_back(nCheckCount);
278 break;
281 if(aIter->isModified())
283 _sParameter.append(::dbtools::quoteName( aQuote,aColumnName));
284 _sParameter.append(aPara);
289 void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
291 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::updateRow" );
292 Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
293 fillTableName(xSet);
295 ::rtl::OUStringBuffer aSql = ::rtl::OUString("UPDATE ");
296 aSql.append(m_aComposedTableName);
297 aSql.append(::rtl::OUString(" SET "));
298 // list all cloumns that should be set
300 ::rtl::OUStringBuffer aCondition;
301 ::std::list< sal_Int32> aOrgValues;
302 fillParameters(_rInsertRow,_xTable,aCondition,aSql,aOrgValues);
303 aSql[aSql.getLength() - 1] = ' ';
304 if ( aCondition.getLength() )
306 aCondition.setLength(aCondition.getLength()-5);
308 aSql.append(::rtl::OUString(" WHERE "));
309 aSql.append(aCondition.makeStringAndClear());
311 else
312 ::dbtools::throwSQLException(
313 DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), SQL_GENERAL_ERROR, *this );
315 // now create end execute the prepared statement
316 Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
317 Reference< XParameters > xParameter(xPrep,UNO_QUERY);
318 sal_Int32 i = 1;
319 connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
320 for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
322 if(aIter->isModified())
324 setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
325 ++i;
328 ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
329 for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValueEnd;++aOrgValue,++i)
331 setParameter(i,xParameter,(_rOrginalRow->get())[*aOrgValue],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
334 m_bUpdated = xPrep->executeUpdate() > 0;
337 void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
339 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::deleteRow" );
340 Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
341 fillTableName(xSet);
343 ::rtl::OUStringBuffer aSql = ::rtl::OUString("DELETE FROM ");
344 aSql.append(m_aComposedTableName);
345 aSql.append(::rtl::OUString(" WHERE "));
347 // list all cloumns that should be set
348 ::rtl::OUString aQuote = getIdentifierQuoteString();
349 static ::rtl::OUString aAnd(" AND ");
351 // use keys and indexes for exact positioning
352 // first the keys
353 const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet);
354 // second the indexes
355 Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
356 Reference<XIndexAccess> xIndexes;
357 if(xIndexSup.is())
358 xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
360 // Reference<XColumnsSupplier>
361 Reference<XPropertySet> xIndexColsSup;
362 Reference<XNameAccess> xIndexColumns;
363 ::std::vector< Reference<XNameAccess> > aAllIndexColumns;
364 if(xIndexes.is())
366 for(sal_Int32 j=0;j<xIndexes->getCount();++j)
368 xIndexColsSup.set(xIndexes->getByIndex(j),UNO_QUERY);
369 if( xIndexColsSup.is()
370 && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
371 && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
373 aAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
377 ::rtl::OUStringBuffer aColumnName;
378 ::std::list< sal_Int32> aOrgValues;
379 fillParameters(_rDeleteRow,_xTable,aSql,aColumnName,aOrgValues);
381 aSql.setLength(aSql.getLength()-5);
383 // now create and execute the prepared statement
384 Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
385 Reference< XParameters > xParameter(xPrep,UNO_QUERY);
386 sal_Int32 i = 1;
387 ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
388 for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValueEnd;++j,++i)
390 setParameter(i,xParameter,(_rDeleteRow->get())[*j],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
393 m_bDeleted = xPrep->executeUpdate() > 0;
396 void OCacheSet::setParameter(sal_Int32 nPos
397 ,const Reference< XParameters >& _xParameter
398 ,const ORowSetValue& _rValue
399 ,sal_Int32 _nType
400 ,sal_Int32 _nScale) const
402 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::setParameter" );
403 sal_Int32 nType = ( _nType != DataType::OTHER ) ? _nType : _rValue.getTypeKind();
404 ::dbtools::setObjectWithInfo(_xParameter,nPos,_rValue,nType,_nScale);
407 void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition)
409 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillValueRow" );
410 Any aBookmark = getBookmark();
411 if(!aBookmark.hasValue())
412 aBookmark = makeAny(_nPosition);
414 connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rRow->get().begin();
415 connectivity::ORowVector< ORowSetValue >::Vector::iterator aEnd = _rRow->get().end();
416 (*aIter) = aBookmark;
417 ++aIter;
418 for(sal_Int32 i=1;aIter != aEnd;++aIter,++i)
420 aIter->setSigned(m_aSignedFlags[i-1]);
421 aIter->fill(i, m_aColumnTypes[i-1], this);
425 sal_Bool SAL_CALL OCacheSet::wasNull( ) throw(SQLException, RuntimeException)
427 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::wasNull" );
428 return m_xDriverRow->wasNull();
431 ::rtl::OUString SAL_CALL OCacheSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
433 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getString" );
434 return m_xDriverRow->getString(columnIndex);
437 sal_Bool SAL_CALL OCacheSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
439 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBoolean" );
440 return m_xDriverRow->getBoolean(columnIndex);
443 sal_Int8 SAL_CALL OCacheSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
445 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getByte" );
446 return m_xDriverRow->getByte(columnIndex);
449 sal_Int16 SAL_CALL OCacheSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
451 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getShort" );
452 return m_xDriverRow->getShort(columnIndex);
455 sal_Int32 SAL_CALL OCacheSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
457 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getInt" );
458 return m_xDriverRow->getInt(columnIndex);
461 sal_Int64 SAL_CALL OCacheSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
463 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getLong" );
464 return m_xDriverRow->getLong(columnIndex);
467 float SAL_CALL OCacheSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
469 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getFloat" );
470 return m_xDriverRow->getFloat(columnIndex);
473 double SAL_CALL OCacheSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
475 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getDouble" );
476 return m_xDriverRow->getDouble(columnIndex);
479 Sequence< sal_Int8 > SAL_CALL OCacheSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
481 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBytes" );
482 return m_xDriverRow->getBytes(columnIndex);
485 ::com::sun::star::util::Date SAL_CALL OCacheSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
487 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getDate" );
488 return m_xDriverRow->getDate(columnIndex);
491 ::com::sun::star::util::Time SAL_CALL OCacheSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
493 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getTime" );
494 return m_xDriverRow->getTime(columnIndex);
497 ::com::sun::star::util::DateTime SAL_CALL OCacheSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
499 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getTimestamp" );
500 return m_xDriverRow->getTimestamp(columnIndex);
503 Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
505 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBinaryStream" );
506 return m_xDriverRow->getBinaryStream(columnIndex);
509 Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
511 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getCharacterStream" );
512 return m_xDriverRow->getCharacterStream(columnIndex);
515 Any SAL_CALL OCacheSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
517 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getObject" );
518 return m_xDriverRow->getObject(columnIndex,typeMap);
521 Reference< XRef > SAL_CALL OCacheSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
523 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getRef" );
524 return m_xDriverRow->getRef(columnIndex);
527 Reference< XBlob > SAL_CALL OCacheSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
529 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBlob" );
530 return m_xDriverRow->getBlob(columnIndex);
533 Reference< XClob > SAL_CALL OCacheSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
535 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getClob" );
536 return m_xDriverRow->getClob(columnIndex);
539 Reference< XArray > SAL_CALL OCacheSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
541 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getArray" );
542 return m_xDriverRow->getArray(columnIndex);
545 // XResultSet
546 sal_Bool SAL_CALL OCacheSet::next( ) throw(SQLException, RuntimeException)
548 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::next" );
549 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
550 return m_xDriverSet->next();
553 sal_Bool SAL_CALL OCacheSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
555 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isBeforeFirst" );
556 return m_xDriverSet->isBeforeFirst();
559 sal_Bool SAL_CALL OCacheSet::isAfterLast( ) throw(SQLException, RuntimeException)
561 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isAfterLast" );
562 return m_xDriverSet->isAfterLast();
565 sal_Bool SAL_CALL OCacheSet::isFirst( ) throw(SQLException, RuntimeException)
567 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isFirst" );
568 return m_xDriverSet->isFirst();
571 sal_Bool SAL_CALL OCacheSet::isLast( ) throw(SQLException, RuntimeException)
573 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isLast" );
574 return m_xDriverSet->isLast();
577 void SAL_CALL OCacheSet::beforeFirst( ) throw(SQLException, RuntimeException)
579 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::beforeFirst" );
580 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
581 m_xDriverSet->beforeFirst();
584 void SAL_CALL OCacheSet::afterLast( ) throw(SQLException, RuntimeException)
586 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::afterLast" );
587 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
588 m_xDriverSet->afterLast();
591 sal_Bool SAL_CALL OCacheSet::first( ) throw(SQLException, RuntimeException)
593 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::first" );
594 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
595 return m_xDriverSet->first();
598 sal_Bool SAL_CALL OCacheSet::last( ) throw(SQLException, RuntimeException)
600 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::last" );
601 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
602 return m_xDriverSet->last();
605 sal_Int32 SAL_CALL OCacheSet::getRow( ) throw(SQLException, RuntimeException)
607 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getRow" );
608 return m_xDriverSet->getRow();
611 sal_Bool SAL_CALL OCacheSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
613 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::absolute" );
614 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
615 return m_xDriverSet->absolute(row);
618 sal_Bool SAL_CALL OCacheSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
620 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::relative" );
621 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
622 return m_xDriverSet->relative(rows);
625 sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException)
627 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::previous" );
628 m_bInserted = m_bUpdated = m_bDeleted = sal_False;
629 return m_xDriverSet->previous();
632 sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/)
634 return last();
637 sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ )
639 return previous();
642 sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ )
644 return absolute(row);
647 void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException)
649 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::refreshRow" );
650 m_xDriverSet->refreshRow();
653 sal_Bool SAL_CALL OCacheSet::rowUpdated( ) throw(SQLException, RuntimeException)
655 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowUpdated" );
656 return m_xDriverSet->rowUpdated();
659 sal_Bool SAL_CALL OCacheSet::rowInserted( ) throw(SQLException, RuntimeException)
661 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowInserted" );
662 return m_xDriverSet->rowInserted();
665 sal_Bool SAL_CALL OCacheSet::rowDeleted( ) throw(SQLException, RuntimeException)
667 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowDeleted" );
668 return m_xDriverSet->rowDeleted();
671 Reference< XInterface > SAL_CALL OCacheSet::getStatement( ) throw(SQLException, RuntimeException)
673 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getStatement" );
674 return m_xDriverSet->getStatement();
677 bool OCacheSet::isResultSetChanged() const
679 return false;
682 void OCacheSet::reset(const Reference< XResultSet>& /*_xDriverSet*/)
684 OSL_FAIL("Illegal call!");
687 void OCacheSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& /*io_aInsertRow*/,ORowSetValueVector::Vector& /*io_aRow*/,::std::vector<sal_Int32>& o_aChangedColumns)
689 o_aChangedColumns.push_back(i_nColumnIndex);
692 bool OCacheSet::columnValuesUpdated(ORowSetValueVector::Vector& /*io_aCachedRow*/,const ORowSetValueVector::Vector& /*io_aRow*/)
694 return false;
697 bool OCacheSet::updateColumnValues(const ORowSetValueVector::Vector& /*io_aCachedRow*/,ORowSetValueVector::Vector& /*io_aRow*/,const ::std::vector<sal_Int32>& /*i_aChangedColumns*/)
699 return true;
702 void OCacheSet::fillMissingValues(ORowSetValueVector::Vector& /*io_aRow*/) const
705 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */