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