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