LibreOffice Module dbaccess (master) 1
resultset.cxx
Go to the documentation of this file.
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 "resultset.hxx"
21#include <sal/log.hxx>
22#include <stringconstants.hxx>
23#include <strings.hxx>
24#include <com/sun/star/beans/PropertyAttribute.hpp>
25#include <com/sun/star/sdbc/ResultSetType.hpp>
26#include <com/sun/star/sdbc/SQLException.hpp>
30#include <comphelper/types.hxx>
32#include "datacolumn.hxx"
35
36
37using namespace ::com::sun::star::sdbc;
38using namespace ::com::sun::star::sdbcx;
39using namespace ::com::sun::star::beans;
40using namespace ::com::sun::star::uno;
41using namespace ::com::sun::star::lang;
42using namespace ::com::sun::star::container;
43using namespace ::cppu;
44using namespace ::osl;
45using namespace dbaccess;
46using namespace dbtools;
47
48
49OResultSet::OResultSet(const css::uno::Reference< css::sdbc::XResultSet >& _xResultSet,
50 const css::uno::Reference< css::uno::XInterface >& _xStatement,
51 bool _bCaseSensitive)
54 ,m_xDelegatorResultSet(_xResultSet)
55 ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) )
56 ,m_nResultSetConcurrency(0)
57 ,m_bIsBookmarkable(false)
58{
59 m_pColumns.reset( new OColumns(*this, m_aMutex, _bCaseSensitive, std::vector< OUString>(), nullptr,nullptr) );
60
61 try
62 {
63 m_aStatement = _xStatement;
64 m_xDelegatorResultSetUpdate.set(m_xDelegatorResultSet, css::uno::UNO_QUERY);
65 m_xDelegatorRow.set(m_xDelegatorResultSet, css::uno::UNO_QUERY);
66 m_xDelegatorRowUpdate.set(m_xDelegatorResultSet, css::uno::UNO_QUERY);
67
68 Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
69 sal_Int32 nResultSetType(0);
70 xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= nResultSetType;
72
73 // test for Bookmarks
74 if (ResultSetType::FORWARD_ONLY != nResultSetType)
75 {
76 Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo());
77 if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE))
78 {
79 m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE));
80 OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(),
81 "OResultSet::OResultSet: aggregate is inconsistent in its bookmarkable attribute!" );
82 m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is();
83 }
84 }
85 }
86 catch (const Exception&)
87 {
88 }
89}
90
92{
93 m_pColumns->acquire();
94 m_pColumns->disposing();
95}
96
97// css::lang::XTypeProvider
98Sequence< Type > OResultSet::getTypes()
99{
101 OResultSetBase::getTypes());
102
103 return aTypes.getTypes();
104}
105
107{
108 return css::uno::Sequence<sal_Int8>();
109}
110
111// css::uno::XInterface
112Any OResultSet::queryInterface( const Type & rType )
113{
114 Any aIface = OResultSetBase::queryInterface( rType );
115 if (!aIface.hasValue())
116 aIface = ::cppu::queryInterface(
117 rType,
118 static_cast< XPropertySet * >( this ));
119
120 return aIface;
121}
122
123void OResultSet::acquire() noexcept
124{
125 OResultSetBase::acquire();
126}
127
128void OResultSet::release() noexcept
129{
130 OResultSetBase::release();
131}
132
133
134// OResultSetBase
136{
138
139 MutexGuard aGuard(m_aMutex);
140
141 // free the columns
142 m_pColumns->disposing();
143
144 // close the pending result set
145 Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY_THROW)->close();
146
147 m_xDelegatorResultSet = nullptr;
148 m_xDelegatorRow = nullptr;
149 m_xDelegatorRowUpdate = nullptr;
150
151 m_aStatement.clear();
152}
153
154// XCloseable
156{
157 {
158 MutexGuard aGuard( m_aMutex );
159 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
160 }
161 dispose();
162}
163
164// XServiceInfo
166{
167 return "com.sun.star.sdb.OResultSet";
168}
169
170sal_Bool OResultSet::supportsService( const OUString& _rServiceName )
171{
172 return cppu::supportsService(this, _rServiceName);
173}
174
176{
178}
179
180// css::beans::XPropertySet
181Reference< XPropertySetInfo > OResultSet::getPropertySetInfo()
182{
184}
185
186// comphelper::OPropertyArrayUsageHelper
188{
189 return new ::cppu::OPropertyArrayHelper
190 {
191 {
192 { PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
195 { PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
197 { PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY }
198 }
199 };
200}
201
202// cppu::OPropertySetHelper
204{
205 return *getArrayHelper();
206}
207
208sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue )
209{
210 // be lazy ...
211 rConvertedValue = rValue;
212 getFastPropertyValue( rOldValue, nHandle );
213 return true;
214}
215
216void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
217{
218 // set it for the driver result set
219 Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
220 switch (nHandle)
221 {
223 xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue);
224 break;
226 xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue);
227 break;
228 default:
229 SAL_WARN("dbaccess", "unknown Property");
230 }
231}
232
233void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
234{
235 switch (nHandle)
236 {
238 {
239 rValue <<= m_bIsBookmarkable;
240 } break;
241 default:
242 {
243 // get the property name
244 OUString aPropName;
245 sal_Int16 nAttributes;
246 const_cast<OResultSet*>(this)->getInfoHelper().
247 fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
248 OSL_ENSURE(!aPropName.isEmpty(), "property not found?");
249
250 // now read the value
251 rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY_THROW)->getPropertyValue(aPropName);
252 }
253 }
254}
255
256// XWarningsSupplier
258{
259 MutexGuard aGuard(m_aMutex);
260 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
261 return m_aWarnings.getWarnings();
262}
263
265{
266 MutexGuard aGuard(m_aMutex);
267 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
269}
270
271// css::sdbc::XResultSetMetaDataSupplier
272Reference< XResultSetMetaData > OResultSet::getMetaData()
273{
274 MutexGuard aGuard(m_aMutex);
275 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
276
277 return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY_THROW)->getMetaData();
278}
279
280// css::sdbc::XColumnLocate
281sal_Int32 OResultSet::findColumn(const OUString& columnName)
282{
283 MutexGuard aGuard(m_aMutex);
284 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
285
286 return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->findColumn(columnName);
287}
288
289namespace
290{
291 Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement )
292 {
293 Reference< XDatabaseMetaData > xDBMetaData;
294 try
295 {
296 Reference< XStatement > xStatement( _rxStatement, UNO_QUERY );
297 Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY );
298 Reference< XConnection > xConn;
299 if ( xStatement.is() )
300 xConn = xStatement->getConnection();
301 else if ( xPreparedStatement.is() )
302 xConn = xPreparedStatement->getConnection();
303 if ( xConn.is() )
304 xDBMetaData = xConn->getMetaData();
305 }
306 catch( const Exception& )
307 {
308 DBG_UNHANDLED_EXCEPTION("dbaccess");
309 }
310 return xDBMetaData;
311 }
312}
313
314// css::sdbcx::XColumnsSupplier
315Reference< css::container::XNameAccess > OResultSet::getColumns()
316{
317 MutexGuard aGuard(m_aMutex);
318 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
319
320 // do we have to populate the columns
321 if (!m_pColumns->isInitialized())
322 {
323 // get the metadata
324 Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY_THROW)->getMetaData();
325
326 sal_Int32 nColCount = 0;
327 // do we have columns
328 try
329 {
330 Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) );
331 nColCount = xMetaData->getColumnCount();
332
333 for ( sal_Int32 i = 0; i < nColCount; ++i)
334 {
335 // retrieve the name of the column
336 OUString sName = xMetaData->getColumnName(i + 1);
337 rtl::Reference<ODataColumn> pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
338
339 // don't silently assume that the name is unique - result set implementations
340 // are allowed to return duplicate names, but we are required to have
341 // unique column names
342 if ( m_pColumns->hasByName( sName ) )
343 sName = ::dbtools::createUniqueName( m_pColumns.get(), sName );
344
345 m_pColumns->append( sName, pColumn.get() );
346 }
347 }
348 catch ( const SQLException& )
349 {
350 DBG_UNHANDLED_EXCEPTION("dbaccess");
351 }
352 m_pColumns->setInitialized();
353
354 #if OSL_DEBUG_LEVEL > 0
355 // some sanity checks. Especially in case we auto-adjusted the column names above,
356 // this might be reasonable
357 try
358 {
359 const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns.get() ), UNO_SET_THROW );
360 const Sequence< OUString > aNames( xColNames->getElementNames() );
361 SAL_WARN_IF( aNames.getLength() != nColCount, "dbaccess",
362 "OResultSet::getColumns: invalid column count!" );
363 for ( auto const & name : aNames )
364 {
365 Reference< XPropertySet > xColProps( xColNames->getByName( name ), UNO_QUERY_THROW );
366 OUString sName;
367 OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName );
368 SAL_WARN_IF( sName != name, "dbaccess", "OResultSet::getColumns: invalid column name!" );
369 }
370
371 }
372 catch( const Exception& )
373 {
374 DBG_UNHANDLED_EXCEPTION("dbaccess");
375 }
376 #endif
377 }
378 return m_pColumns.get();
379}
380
381// css::sdbc::XRow
383{
384 MutexGuard aGuard(m_aMutex);
385 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
386
387 return m_xDelegatorRow->wasNull();
388}
389
390OUString OResultSet::getString(sal_Int32 columnIndex)
391{
392 MutexGuard aGuard(m_aMutex);
393 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
394
395 return m_xDelegatorRow->getString(columnIndex);
396}
397
398sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex)
399{
400 MutexGuard aGuard(m_aMutex);
401 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
402
403 return m_xDelegatorRow->getBoolean(columnIndex);
404}
405
406sal_Int8 OResultSet::getByte(sal_Int32 columnIndex)
407{
408 MutexGuard aGuard(m_aMutex);
409 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
410
411 return m_xDelegatorRow->getByte(columnIndex);
412}
413
414sal_Int16 OResultSet::getShort(sal_Int32 columnIndex)
415{
416 MutexGuard aGuard(m_aMutex);
417 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
418
419 return m_xDelegatorRow->getShort(columnIndex);
420}
421
422sal_Int32 OResultSet::getInt(sal_Int32 columnIndex)
423{
424 MutexGuard aGuard(m_aMutex);
425 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
426
427 return m_xDelegatorRow->getInt(columnIndex);
428}
429
430sal_Int64 OResultSet::getLong(sal_Int32 columnIndex)
431{
432 MutexGuard aGuard(m_aMutex);
433 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
434
435 return m_xDelegatorRow->getLong(columnIndex);
436}
437
438float OResultSet::getFloat(sal_Int32 columnIndex)
439{
440 MutexGuard aGuard(m_aMutex);
441 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
442
443 return m_xDelegatorRow->getFloat(columnIndex);
444}
445
446double OResultSet::getDouble(sal_Int32 columnIndex)
447{
448 MutexGuard aGuard(m_aMutex);
449 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
450
451 return m_xDelegatorRow->getDouble(columnIndex);
452}
453
454Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex)
455{
456 MutexGuard aGuard(m_aMutex);
457 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
458
459 return m_xDelegatorRow->getBytes(columnIndex);
460}
461
462css::util::Date OResultSet::getDate(sal_Int32 columnIndex)
463{
464 MutexGuard aGuard(m_aMutex);
465 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
466
467 return m_xDelegatorRow->getDate(columnIndex);
468}
469
470css::util::Time OResultSet::getTime(sal_Int32 columnIndex)
471{
472 MutexGuard aGuard(m_aMutex);
473 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
474
475 return m_xDelegatorRow->getTime(columnIndex);
476}
477
478css::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex)
479{
480 MutexGuard aGuard(m_aMutex);
481 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
482
483 return m_xDelegatorRow->getTimestamp(columnIndex);
484}
485
486Reference< css::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex)
487{
488 MutexGuard aGuard(m_aMutex);
489 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
490
491 return m_xDelegatorRow->getBinaryStream(columnIndex);
492}
493
494Reference< css::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex)
495{
496 MutexGuard aGuard(m_aMutex);
497 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
498
499 return m_xDelegatorRow->getCharacterStream(columnIndex);
500}
501
502Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< css::container::XNameAccess > & typeMap)
503{
504 MutexGuard aGuard(m_aMutex);
505 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
506
507 return m_xDelegatorRow->getObject(columnIndex, typeMap);
508}
509
510Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex)
511{
512 MutexGuard aGuard(m_aMutex);
513 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
514
515 return m_xDelegatorRow->getRef(columnIndex);
516}
517
518Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex)
519{
520 MutexGuard aGuard(m_aMutex);
521 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
522
523 return m_xDelegatorRow->getBlob(columnIndex);
524}
525
526Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex)
527{
528 MutexGuard aGuard(m_aMutex);
529 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
530
531 return m_xDelegatorRow->getClob(columnIndex);
532}
533
534Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex)
535{
536 MutexGuard aGuard(m_aMutex);
537 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
538
539 return m_xDelegatorRow->getArray(columnIndex);
540}
541
542// css::sdbc::XRowUpdate
543void OResultSet::updateNull(sal_Int32 columnIndex)
544{
545 MutexGuard aGuard(m_aMutex);
546 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
547
549
550 m_xDelegatorRowUpdate->updateNull(columnIndex);
551}
552
553void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x)
554{
555 MutexGuard aGuard(m_aMutex);
556 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
557
559
560 m_xDelegatorRowUpdate->updateBoolean(columnIndex, x);
561}
562
563void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x)
564{
565 MutexGuard aGuard(m_aMutex);
566 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
567
569
570 m_xDelegatorRowUpdate->updateByte(columnIndex, x);
571}
572
573void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x)
574{
575 MutexGuard aGuard(m_aMutex);
576 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
577
579
580 m_xDelegatorRowUpdate->updateShort(columnIndex, x);
581}
582
583void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x)
584{
585 MutexGuard aGuard(m_aMutex);
586 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
587
589
590 m_xDelegatorRowUpdate->updateInt(columnIndex, x);
591}
592
593void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x)
594{
595 MutexGuard aGuard(m_aMutex);
596 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
597
599
600 m_xDelegatorRowUpdate->updateLong(columnIndex, x);
601}
602
603void OResultSet::updateFloat(sal_Int32 columnIndex, float x)
604{
605 MutexGuard aGuard(m_aMutex);
606 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
607
609
610 m_xDelegatorRowUpdate->updateFloat(columnIndex, x);
611}
612
613void OResultSet::updateDouble(sal_Int32 columnIndex, double x)
614{
615 MutexGuard aGuard(m_aMutex);
616 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
617
619
620 m_xDelegatorRowUpdate->updateDouble(columnIndex, x);
621}
622
623void OResultSet::updateString(sal_Int32 columnIndex, const OUString& x)
624{
625 MutexGuard aGuard(m_aMutex);
626 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
627
629
630 m_xDelegatorRowUpdate->updateString(columnIndex, x);
631}
632
633void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x)
634{
635 MutexGuard aGuard(m_aMutex);
636 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
637
639
640 m_xDelegatorRowUpdate->updateBytes(columnIndex, x);
641}
642
643void OResultSet::updateDate(sal_Int32 columnIndex, const css::util::Date& x)
644{
645 MutexGuard aGuard(m_aMutex);
646 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
647
649
650 m_xDelegatorRowUpdate->updateDate(columnIndex, x);
651}
652
653void OResultSet::updateTime(sal_Int32 columnIndex, const css::util::Time& x)
654{
655 MutexGuard aGuard(m_aMutex);
656 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
657
659
660 m_xDelegatorRowUpdate->updateTime(columnIndex, x);
661}
662
663void OResultSet::updateTimestamp(sal_Int32 columnIndex, const css::util::DateTime& x)
664{
665 MutexGuard aGuard(m_aMutex);
666 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
667
669
670 m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x);
671}
672
673void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< css::io::XInputStream > & x, sal_Int32 length)
674{
675 MutexGuard aGuard(m_aMutex);
676 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
677
679
680 m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length);
681}
682
683void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< css::io::XInputStream > & x, sal_Int32 length)
684{
685 MutexGuard aGuard(m_aMutex);
686 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
687
689
690 m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length);
691}
692
693void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale)
694{
695 MutexGuard aGuard(m_aMutex);
696 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
697
699
700 m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale);
701}
702
703void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x)
704{
705 MutexGuard aGuard(m_aMutex);
706 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
707
709
710 m_xDelegatorRowUpdate->updateObject(columnIndex, x);
711}
712
713// css::sdbc::XResultSet
715{
716 MutexGuard aGuard(m_aMutex);
717 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
718
719 return m_xDelegatorResultSet->next();
720}
721
723{
724 MutexGuard aGuard(m_aMutex);
725 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
726
727 return m_xDelegatorResultSet->isBeforeFirst();
728}
729
731{
732 MutexGuard aGuard(m_aMutex);
733 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
734
735 return m_xDelegatorResultSet->isAfterLast();
736}
737
739{
740 MutexGuard aGuard(m_aMutex);
741 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
742
743 return m_xDelegatorResultSet->isFirst();
744}
745
747{
748 MutexGuard aGuard(m_aMutex);
749 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
750
751 return m_xDelegatorResultSet->isLast();
752}
753
755{
756 MutexGuard aGuard(m_aMutex);
757 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
758
759 m_xDelegatorResultSet->beforeFirst();
760}
761
763{
764 MutexGuard aGuard(m_aMutex);
765 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
766
767 m_xDelegatorResultSet->afterLast();
768}
769
771{
772 MutexGuard aGuard(m_aMutex);
773 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
774
775 return m_xDelegatorResultSet->first();
776}
777
779{
780 MutexGuard aGuard(m_aMutex);
781 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
782
783 return m_xDelegatorResultSet->last();
784}
785
787{
788 MutexGuard aGuard(m_aMutex);
789 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
790
791 return m_xDelegatorResultSet->getRow();
792}
793
795{
796 MutexGuard aGuard(m_aMutex);
797 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
798
799 return m_xDelegatorResultSet->absolute(row);
800}
801
803{
804 MutexGuard aGuard(m_aMutex);
805 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
806
807 return m_xDelegatorResultSet->relative(rows);
808}
809
811{
812 MutexGuard aGuard(m_aMutex);
813 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
814
815 return m_xDelegatorResultSet->previous();
816}
817
819{
820 MutexGuard aGuard(m_aMutex);
821 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
822
823 m_xDelegatorResultSet->refreshRow();
824}
825
827{
828 MutexGuard aGuard(m_aMutex);
829 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
830
831 return m_xDelegatorResultSet->rowUpdated();
832}
833
835{
836 MutexGuard aGuard(m_aMutex);
837 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
838
839 return m_xDelegatorResultSet->rowInserted();
840}
841
843{
844 MutexGuard aGuard(m_aMutex);
845 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
846
847 return m_xDelegatorResultSet->rowDeleted();
848}
849
850Reference< XInterface > OResultSet::getStatement()
851{
852 MutexGuard aGuard(m_aMutex);
853 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
854
855 return m_aStatement;
856}
857
858// css::sdbcx::XRowLocate
860{
861 MutexGuard aGuard(m_aMutex);
862 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
863
865
866 return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->getBookmark();
867}
868
869sal_Bool OResultSet::moveToBookmark(const Any& bookmark)
870{
871 MutexGuard aGuard(m_aMutex);
872 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
873
875
876 return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->moveToBookmark(bookmark);
877}
878
879sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows)
880{
881 MutexGuard aGuard(m_aMutex);
882 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
883
885
886 return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->moveRelativeToBookmark(bookmark, rows);
887}
888
889sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second)
890{
891 MutexGuard aGuard(m_aMutex);
892 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
893
895
896 return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->compareBookmarks(_first, _second);
897}
898
900{
901 MutexGuard aGuard(m_aMutex);
902 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
903
905
906 return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->hasOrderedBookmarks();
907}
908
909sal_Int32 OResultSet::hashBookmark(const Any& bookmark)
910{
911 MutexGuard aGuard(m_aMutex);
912 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
913
915
916 return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY_THROW)->hashBookmark(bookmark);
917}
918
919// css::sdbc::XResultSetUpdate
921{
922 MutexGuard aGuard(m_aMutex);
923 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
924
926
927 m_xDelegatorResultSetUpdate->insertRow();
928}
929
931{
932 MutexGuard aGuard(m_aMutex);
933 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
934
936
937 m_xDelegatorResultSetUpdate->updateRow();
938}
939
941{
942 MutexGuard aGuard(m_aMutex);
943 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
944
946
947 m_xDelegatorResultSetUpdate->deleteRow();
948}
949
951{
952 MutexGuard aGuard(m_aMutex);
953 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
954
956
957 m_xDelegatorResultSetUpdate->cancelRowUpdates();
958}
959
961{
962 MutexGuard aGuard(m_aMutex);
963 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
964
966
967 m_xDelegatorResultSetUpdate->moveToInsertRow();
968}
969
971{
972 MutexGuard aGuard(m_aMutex);
973 ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
974
976
977 m_xDelegatorResultSetUpdate->moveToCurrentRow();
978}
979
981{
982 if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
984 )
985 throwSQLException( "The result set is read-only.", StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
986}
987
989{
990 if ( !m_bIsBookmarkable )
991 throwSQLException( "The result set does not have bookmark support.", StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
992}
993
994/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sName
::cppu::IPropertyArrayHelper * getArrayHelper()
void disposing(std::unique_lock< std::mutex > &rGuard)
mutable::osl::Mutex m_aMutex
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
css::uno::Type const & get()
virtual void SAL_CALL updateString(sal_Int32 columnIndex, const OUString &x) override
Definition: resultset.cxx:623
virtual void SAL_CALL refreshRow() override
Definition: resultset.cxx:818
virtual void SAL_CALL updateTimestamp(sal_Int32 columnIndex, const css::util::DateTime &x) override
Definition: resultset.cxx:663
virtual void SAL_CALL updateNumericObject(sal_Int32 columnIndex, const css::uno::Any &x, sal_Int32 scale) override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
Definition: resultset.cxx:430
virtual void SAL_CALL afterLast() override
Definition: resultset.cxx:762
virtual void SAL_CALL updateNull(sal_Int32 columnIndex) override
Definition: resultset.cxx:543
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual sal_Bool SAL_CALL isBeforeFirst() override
Definition: resultset.cxx:722
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
Definition: resultset.cxx:518
sal_Int32 m_nResultSetConcurrency
Definition: resultset.hxx:74
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
Definition: resultset.cxx:454
virtual void SAL_CALL clearWarnings() override
Definition: resultset.cxx:264
virtual void SAL_CALL moveToCurrentRow() override
Definition: resultset.cxx:970
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
Definition: resultset.cxx:272
virtual void SAL_CALL moveToInsertRow() override
Definition: resultset.cxx:960
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
Definition: resultset.cxx:850
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: resultset.cxx:203
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: resultset.cxx:181
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
Definition: resultset.cxx:470
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
Definition: resultset.cxx:534
css::uno::Reference< css::uno::XInterface > m_aStatement
Definition: resultset.hxx:65
virtual void SAL_CALL disposing() override
Definition: resultset.cxx:135
virtual sal_Bool SAL_CALL isLast() override
Definition: resultset.cxx:746
virtual sal_Int32 SAL_CALL findColumn(const OUString &columnName) override
Definition: resultset.cxx:281
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
Definition: resultset.cxx:486
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
Definition: resultset.cxx:802
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
Definition: resultset.cxx:462
css::uno::Reference< css::sdbc::XResultSetUpdate > m_xDelegatorResultSetUpdate
Definition: resultset.hxx:68
virtual void SAL_CALL deleteRow() override
Definition: resultset.cxx:940
virtual void SAL_CALL updateShort(sal_Int32 columnIndex, sal_Int16 x) override
Definition: resultset.cxx:573
virtual void SAL_CALL updateDouble(sal_Int32 columnIndex, double x) override
Definition: resultset.cxx:613
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: resultset.cxx:106
std::unique_ptr< OColumns > m_pColumns
Definition: resultset.hxx:73
virtual sal_Bool SAL_CALL first() override
Definition: resultset.cxx:770
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
Definition: resultset.cxx:794
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
Definition: resultset.cxx:478
virtual void SAL_CALL beforeFirst() override
Definition: resultset.cxx:754
virtual sal_Bool SAL_CALL isAfterLast() override
Definition: resultset.cxx:730
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override
Definition: resultset.cxx:315
::dbtools::WarningsContainer m_aWarnings
Definition: resultset.hxx:72
virtual sal_Bool SAL_CALL wasNull() override
Definition: resultset.cxx:382
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
Definition: resultset.cxx:510
virtual void SAL_CALL updateBoolean(sal_Int32 columnIndex, sal_Bool x) override
Definition: resultset.cxx:553
virtual OUString SAL_CALL getImplementationName() override
Definition: resultset.cxx:165
virtual sal_Bool SAL_CALL next() override
Definition: resultset.cxx:714
virtual void SAL_CALL updateDate(sal_Int32 columnIndex, const css::util::Date &x) override
Definition: resultset.cxx:643
virtual void SAL_CALL acquire() noexcept override
Definition: resultset.cxx:123
void checkBookmarkable() const
Definition: resultset.cxx:988
virtual ~OResultSet() override
Definition: resultset.cxx:91
virtual void SAL_CALL updateCharacterStream(sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) override
virtual sal_Bool SAL_CALL hasOrderedBookmarks() override
Definition: resultset.cxx:899
virtual void SAL_CALL updateByte(sal_Int32 columnIndex, sal_Int8 x) override
Definition: resultset.cxx:563
virtual sal_Bool SAL_CALL rowInserted() override
Definition: resultset.cxx:834
virtual sal_Bool SAL_CALL rowDeleted() override
Definition: resultset.cxx:842
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: resultset.cxx:98
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
Definition: resultset.cxx:494
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: resultset.cxx:187
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
Definition: resultset.cxx:406
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
Definition: resultset.cxx:446
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
Definition: resultset.cxx:390
virtual void SAL_CALL updateInt(sal_Int32 columnIndex, sal_Int32 x) override
Definition: resultset.cxx:583
virtual void SAL_CALL updateTime(sal_Int32 columnIndex, const css::util::Time &x) override
Definition: resultset.cxx:653
virtual void SAL_CALL updateBinaryStream(sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) override
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
Definition: resultset.cxx:398
virtual css::uno::Any SAL_CALL getBookmark() override
Definition: resultset.cxx:859
virtual css::uno::Any SAL_CALL getWarnings() override
Definition: resultset.cxx:257
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
css::uno::Reference< css::sdbc::XResultSet > m_xDelegatorResultSet
Definition: resultset.hxx:67
virtual sal_Bool SAL_CALL moveRelativeToBookmark(const css::uno::Any &bookmark, sal_Int32 rows) override
virtual sal_Int32 SAL_CALL hashBookmark(const css::uno::Any &bookmark) override
virtual void SAL_CALL updateObject(sal_Int32 columnIndex, const css::uno::Any &x) override
virtual void SAL_CALL close() override
Definition: resultset.cxx:155
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: resultset.cxx:175
virtual void SAL_CALL updateFloat(sal_Int32 columnIndex, float x) override
Definition: resultset.cxx:603
virtual sal_Bool SAL_CALL isFirst() override
Definition: resultset.cxx:738
virtual void SAL_CALL cancelRowUpdates() override
Definition: resultset.cxx:950
virtual sal_Int32 SAL_CALL compareBookmarks(const css::uno::Any &first, const css::uno::Any &second) override
virtual sal_Bool SAL_CALL rowUpdated() override
Definition: resultset.cxx:826
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
Definition: resultset.cxx:438
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
Definition: resultset.cxx:422
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: resultset.cxx:170
virtual void SAL_CALL insertRow() override
Definition: resultset.cxx:920
css::uno::Reference< css::sdbc::XRowUpdate > m_xDelegatorRowUpdate
Definition: resultset.hxx:70
virtual sal_Bool SAL_CALL moveToBookmark(const css::uno::Any &bookmark) override
virtual void SAL_CALL updateBytes(sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 > &x) override
virtual sal_Int32 SAL_CALL getRow() override
Definition: resultset.cxx:786
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
Definition: resultset.cxx:526
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
Definition: resultset.cxx:414
virtual void SAL_CALL updateRow() override
Definition: resultset.cxx:930
void checkReadOnly() const
Definition: resultset.cxx:980
virtual sal_Bool SAL_CALL previous() override
Definition: resultset.cxx:810
virtual sal_Bool SAL_CALL last() override
Definition: resultset.cxx:778
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
css::uno::Reference< css::sdbc::XRow > m_xDelegatorRow
Definition: resultset.hxx:69
virtual void SAL_CALL updateLong(sal_Int32 columnIndex, sal_Int64 x) override
Definition: resultset.cxx:593
virtual void SAL_CALL release() noexcept override
Definition: resultset.cxx:128
css::uno::Any getWarnings() const
#define DBG_UNHANDLED_EXCEPTION(...)
float x
std::mutex m_aMutex
const char * name
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
@ Exception
class SAL_NO_VTABLE XPropertySet
Type
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, css::sdbc::XResultSet, css::sdbc::XResultSetMetaDataSupplier, css::sdbc::XRow, css::sdbc::XCloseable, css::sdbc::XColumnLocate, css::sdbcx::XRowLocate, css::sdbcx::XColumnsSupplier, css::sdbc::XResultSetUpdate, css::sdbc::XRowUpdate, css::lang::XServiceInfo > OResultSetBase
Definition: resultset.hxx:56
void throwSQLException(const OUString &_rMessage, const OUString &_rSQLState, const Reference< XInterface > &_rxContext, const sal_Int32 _nErrorCode)
Reference
int i
OUString aPropName
void dispose()
const char * columnName
sal_Int16 nAttributes
#define PROPERTY_ID_ISBOOKMARKABLE
#define PROPERTY_ID_RESULTSETTYPE
#define PROPERTY_ID_CURSORNAME
#define PROPERTY_ID_RESULTSETCONCURRENCY
#define PROPERTY_ID_FETCHSIZE
#define PROPERTY_ID_FETCHDIRECTION
constexpr OUStringLiteral PROPERTY_FETCHDIRECTION(u"FetchDirection")
constexpr OUStringLiteral SERVICE_SDBC_RESULTSET
Definition: strings.hxx:164
constexpr OUStringLiteral PROPERTY_RESULTSETCONCURRENCY(u"ResultSetConcurrency")
constexpr OUStringLiteral PROPERTY_RESULTSETTYPE(u"ResultSetType")
constexpr OUStringLiteral PROPERTY_ISBOOKMARKABLE(u"IsBookmarkable")
constexpr OUStringLiteral SERVICE_SDB_RESULTSET
Definition: strings.hxx:182
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_FETCHSIZE(u"FetchSize")
constexpr OUStringLiteral PROPERTY_CURSORNAME(u"CursorName")
unsigned char sal_Bool
signed char sal_Int8
const SvXMLTokenMapEntry aTypes[]