LibreOffice Module dbaccess (master) 1
RowSetBase.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 "RowSetBase.hxx"
21#include "CRowSetDataColumn.hxx"
23#include "RowSetCache.hxx"
24#include <stringconstants.hxx>
25#include <sal/log.hxx>
26#include <core_resource.hxx>
27#include <strings.hrc>
28#include <strings.hxx>
29#include <com/sun/star/beans/PropertyAttribute.hpp>
30#include <com/sun/star/sdbcx/CompareBookmark.hpp>
31#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
32#include <com/sun/star/sdbc/ResultSetType.hpp>
36#include <o3tl/safeint.hxx>
38
39using namespace dbaccess;
40using namespace connectivity;
41using namespace connectivity::sdbcx;
42using namespace comphelper;
43using namespace dbtools;
44using namespace ::com::sun::star::uno;
45using namespace ::com::sun::star::beans;
46using namespace ::com::sun::star::sdbc;
47using namespace ::com::sun::star::sdb;
48using namespace ::com::sun::star::sdbcx;
49using namespace ::com::sun::star::container;
50using namespace ::com::sun::star::lang;
51using namespace ::com::sun::star::util;
52using namespace ::cppu;
53using namespace ::osl;
54
55namespace dbaccess
56{
57
58// OEmptyCollection
60{
61protected:
62 virtual void impl_refresh() override;
63 virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
64public:
65 OEmptyCollection(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) : OCollection(_rParent, true, _rMutex, std::vector< OUString>()){}
66};
67
69{
70}
71
73{
75}
76
77// ORowSetBase
78
79ORowSetBase::ORowSetBase( const Reference<XComponentContext>& _rContext, ::cppu::OBroadcastHelper& _rBHelper, ::osl::Mutex* _pMutex )
80 :OPropertyStateContainer(_rBHelper)
81 ,m_pMutex(_pMutex)
82 ,m_pMySelf(nullptr)
83 ,m_rBHelper(_rBHelper)
84 ,m_aContext( _rContext )
85 ,m_nLastColumnIndex(-1)
86 ,m_nDeletedPosition(-1)
87 ,m_nResultSetType( ResultSetType::FORWARD_ONLY )
88 ,m_nResultSetConcurrency( ResultSetConcurrency::READ_ONLY )
89 ,m_bClone(false)
90 ,m_bIgnoreResult(false)
91 ,m_bBeforeFirst(true) // changed from sal_False
92 ,m_bAfterLast(false)
93 ,m_bIsInsertRow(false)
94{
95 sal_Int32 nRBT = PropertyAttribute::READONLY | PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT;
96
99}
100
102{
103 if(m_pColumns)
104 {
106 m_pColumns->acquire();
107 m_pColumns->disposing();
108 }
109}
110
111// css::lang::XTypeProvider
112Sequence< Type > ORowSetBase::getTypes()
114 return ::comphelper::concatSequences(ORowSetBase_BASE::getTypes(),OPropertyStateContainer::getTypes());
115}
117// css::uno::XInterface
119{
121 if(!aRet.hasValue())
123 return aRet;
124}
125
126void SAL_CALL ORowSetBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
127{
128 if(m_pCache)
129 {
130 switch(nHandle)
131 {
133 rValue <<= impl_getRowCount();
134 break;
136 rValue <<= m_pCache->m_bRowCountFinal;
137 break;
138 default:
140 }
141 }
142 else
144}
145
146// OComponentHelper
148{
149 MutexGuard aGuard(*m_pMutex);
150
151 if ( m_pColumns )
152 {
154 m_pColumns->disposing();
155 }
156 if ( m_pCache )
157 {
158 m_pCache->deregisterOldRow(m_aOldRow);
159 m_pCache->deleteIterator(this);
160 }
161 m_pCache = nullptr;
162}
163
164// comphelper::OPropertyArrayUsageHelper
166{
167 Sequence< Property > aProps;
168 describeProperties(aProps);
169 return new ::cppu::OPropertyArrayHelper(aProps);
170}
171
172// cppu::OPropertySetHelper
174{
175 return *getArrayHelper();
176}
177
178// XRow
180{
181 ::osl::MutexGuard aGuard( *m_pMutex );
182 checkCache();
183 return !((m_nLastColumnIndex != -1) && !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is())
184 || (**m_aCurrentRow)[m_nLastColumnIndex].isNull();
185}
186
187const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex)
188{
189 checkCache();
190 return impl_getValue(columnIndex);
191}
192
193const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
194{
196 {
197 SAL_WARN("dbaccess", "ORowSetBase::getValue: Illegal call here (we're before first or after last)!");
198 ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
199 }
200
201 if ( impl_rowDeleted() )
202 {
203 return m_aEmptyValue;
204 }
205
206 bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
207 if ( !bValidCurrentRow )
208 {
209 // currentrow is null when the clone moves the window
211 m_aCurrentRow = m_pCache->m_aMatrixIter;
212 m_bIsInsertRow = false;
213 OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null.");
214
215 bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
216 }
217
218 if ( bValidCurrentRow )
219 {
220#if OSL_DEBUG_LEVEL > 0
221 ORowSetMatrix::const_iterator aCacheEnd;
222 ORowSetMatrix::iterator aCurrentRow;
223 aCacheEnd = m_pCache->getEnd();
224 aCurrentRow = m_aCurrentRow;
225 ORowSetCacheMap::const_iterator aCacheIter = m_aCurrentRow.getIter();
226 ORowSetCacheIterator_Helper aHelper = aCacheIter->second;
227 ORowSetMatrix::const_iterator k = aHelper.aIterator;
228 for (; k != m_pCache->getEnd(); ++k)
229 {
230 ORowSetValueVector* pTemp = k->get();
231 OSL_ENSURE( pTemp != reinterpret_cast<void*>(0xfeeefeee),"HALT!" );
232 }
233 OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid iterator set for currentrow!");
234#endif
236 bool bValidPosition = rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size();
237 if (!bValidPosition)
238 {
239 SAL_WARN("dbaccess", "ORowSetBase::getValue: Invalid size of vector!");
240 ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
241 }
242 m_nLastColumnIndex = columnIndex;
243 return (*rRow)[m_nLastColumnIndex];
244 }
245
246 // we should normally never reach this
247 return m_aEmptyValue;
248}
249
250OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex )
251{
252 ::osl::MutexGuard aGuard( *m_pMutex );
253 return getValue(columnIndex).getString();
254}
255
256sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex )
257{
258 ::osl::MutexGuard aGuard( *m_pMutex );
259 return getValue(columnIndex).getBool();
260}
261
262sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex )
263{
264 ::osl::MutexGuard aGuard( *m_pMutex );
265 return getValue(columnIndex).getInt8();
266}
267
268sal_Int16 SAL_CALL ORowSetBase::getShort( sal_Int32 columnIndex )
269{
270 ::osl::MutexGuard aGuard( *m_pMutex );
271 return getValue(columnIndex).getInt16();
272}
273
274sal_Int32 SAL_CALL ORowSetBase::getInt( sal_Int32 columnIndex )
275{
276 ::osl::MutexGuard aGuard( *m_pMutex );
277 return getValue(columnIndex).getInt32();
278}
279
280sal_Int64 SAL_CALL ORowSetBase::getLong( sal_Int32 columnIndex )
281{
282 ::osl::MutexGuard aGuard( *m_pMutex );
283 return getValue(columnIndex).getLong();
284}
285
286float SAL_CALL ORowSetBase::getFloat( sal_Int32 columnIndex )
287{
288 ::osl::MutexGuard aGuard( *m_pMutex );
289 return getValue(columnIndex).getFloat();
290}
291
292double SAL_CALL ORowSetBase::getDouble( sal_Int32 columnIndex )
293{
294 ::osl::MutexGuard aGuard( *m_pMutex );
295 return getValue(columnIndex).getDouble();
296}
297
298Sequence< sal_Int8 > SAL_CALL ORowSetBase::getBytes( sal_Int32 columnIndex )
299{
300 ::osl::MutexGuard aGuard( *m_pMutex );
301 return getValue(columnIndex).getSequence();
302}
303
304css::util::Date SAL_CALL ORowSetBase::getDate( sal_Int32 columnIndex )
305{
306 ::osl::MutexGuard aGuard( *m_pMutex );
307 return getValue(columnIndex).getDate();
308}
309
310css::util::Time SAL_CALL ORowSetBase::getTime( sal_Int32 columnIndex )
312 ::osl::MutexGuard aGuard( *m_pMutex );
313 return getValue(columnIndex).getTime();
314}
315
316css::util::DateTime SAL_CALL ORowSetBase::getTimestamp( sal_Int32 columnIndex )
317{
318 ::osl::MutexGuard aGuard( *m_pMutex );
319 return getValue(columnIndex).getDateTime();
320}
321
322Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_Int32 columnIndex )
323{
324 ::osl::MutexGuard aGuard( *m_pMutex );
325 checkCache();
326
328 {
329 SAL_WARN("dbaccess", "ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!");
330 ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
331 }
332
333 if ( impl_rowDeleted() )
334 {
335 return nullptr;
336 }
337
338 bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
339 if ( !bValidCurrentRow )
340 {
342 m_aCurrentRow = m_pCache->m_aMatrixIter;
343 m_bIsInsertRow = false;
344 OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null.");
345
346 bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
347 }
348
349 if ( bValidCurrentRow )
350 {
351 m_nLastColumnIndex = columnIndex;
352 return new ::comphelper::SequenceInputStream((**m_aCurrentRow)[m_nLastColumnIndex].getSequence());
353 }
354
355 // we should normally never reach this
356 return Reference< css::io::XInputStream >();
357}
358
359Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getCharacterStream( sal_Int32 columnIndex )
360{
361 return getBinaryStream(columnIndex);
362}
363
364Any SAL_CALL ORowSetBase::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ )
365{
366 ::osl::MutexGuard aGuard( *m_pMutex );
367 checkCache();
368
369 return getValue(columnIndex).makeAny();
370}
371
372Reference< XRef > SAL_CALL ORowSetBase::getRef( sal_Int32 /*columnIndex*/ )
373{
374 ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRef", *m_pMySelf );
375 return nullptr;
376}
377
378Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 columnIndex )
379{
380 return Reference< XBlob >(getValue(columnIndex).makeAny(),UNO_QUERY);
381}
382
383Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 columnIndex )
384{
385 return Reference< XClob >(getValue(columnIndex).makeAny(),UNO_QUERY);
386}
387
388Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ )
389{
390 ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getArray", *m_pMySelf );
391 return nullptr;
392}
393
394// css::sdbcx::XRowLocate
396{
397 SAL_INFO("dbaccess", "ORowSetBase::getBookmark() Clone = " << m_bClone);
398 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
399 ::osl::MutexGuard aGuard( *m_pMutex );
400 checkCache();
401
403 ::dbtools::throwSQLException( DBA_RES( RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
404
405 if ( impl_rowDeleted() )
406 ::dbtools::throwSQLException( DBA_RES( RID_STR_NO_BOOKMARK_DELETED ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
407
408 OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::getBookmark: bookmark has no value!" );
409 return m_aBookmark;
410}
411
412sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark )
413{
414 SAL_INFO("dbaccess", "ORowSetBase::moveToBookmark(Any) Clone = " << m_bClone);
415 OSL_ENSURE(bookmark.hasValue(),"ORowSetBase::moveToBookmark bookmark has no value!");
416 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
417
418 if(!bookmark.hasValue() || m_nResultSetType == ResultSetType::FORWARD_ONLY)
419 {
420 if(bookmark.hasValue())
421 SAL_WARN("dbaccess", "MoveToBookmark is not possible when we are only forward");
422 else
423 SAL_WARN("dbaccess", "Bookmark is not valid");
425 }
426
427 checkCache();
428
429 bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) );
430 if ( bRet )
431 {
432 // check if we are inserting a row
433 bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
434
435 ORowSetNotifier aNotifier( this );
436 // this will call cancelRowModification on the cache if necessary
437
438 ORowSetRow aOldValues = getOldRow(bWasNew);
439
440 bRet = m_pCache->moveToBookmark(bookmark);
442 if(bRet)
443 {
444 // notification order
445 // - column values
446 // - cursorMoved
447 setCurrentRow( true, true, aOldValues, aGuard );
448 }
449 else
450 {
452 }
453
454 // - IsModified
455 // - IsNew
456 aNotifier.fire( );
457 }
458 SAL_INFO("dbaccess", "ORowSetBase::moveToBookmark(Any) = " << bRet << " Clone = " << m_bClone);
459 return bRet;
460}
461
462sal_Bool SAL_CALL ORowSetBase::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows )
463{
464 SAL_INFO("dbaccess", "ORowSetBase::moveRelativeToBookmark(Any," << rows << ") Clone = " << m_bClone);
465 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
466
467 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
468
470
471 bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) );
472 if ( bRet )
473 {
474 // check if we are inserting a row
475 bool bWasNew = m_pCache->m_bNew || rowDeleted();
476
477 ORowSetNotifier aNotifier( this );
478 // this will call cancelRowModification on the cache if necessary
479
480 ORowSetRow aOldValues = getOldRow(bWasNew);
481
482 bRet = m_pCache->moveRelativeToBookmark(bookmark,rows);
484 if(bRet)
485 {
486 // notification order
487 // - column values
488 // - cursorMoved
489 setCurrentRow( true, true, aOldValues, aGuard );
490 }
491 else
493
494 // - IsModified
495 // - IsNew
496 aNotifier.fire( );
497
498 // RowCount/IsRowCountFinal
499 fireRowcount();
500 }
501 SAL_INFO("dbaccess", "ORowSetBase::moveRelativeToBookmark(Any," << rows << ") = " << bRet << " Clone = " << m_bClone);
502 return bRet;
503}
504
505sal_Int32 SAL_CALL ORowSetBase::compareBookmarks( const Any& _first, const Any& _second )
506{
507 ::osl::MutexGuard aGuard( *m_pMutex );
508 checkCache();
509 return m_pCache->compareBookmarks(_first,_second);
510}
511
513{
514 ::osl::MutexGuard aGuard( *m_pMutex );
515 checkCache();
516 return m_pCache->hasOrderedBookmarks();
517}
518
519sal_Int32 SAL_CALL ORowSetBase::hashBookmark( const Any& bookmark )
520{
521 ::osl::MutexGuard aGuard( *m_pMutex );
522 checkCache();
523 return m_pCache->hashBookmark(bookmark);
524}
525
526// XResultSetMetaDataSupplier
527Reference< XResultSetMetaData > SAL_CALL ORowSetBase::getMetaData( )
528{
529 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
530
531 Reference< XResultSetMetaData > xMeta;
532 if(m_pCache)
533 xMeta = m_pCache->getMetaData();
534
535 return xMeta;
536}
537
538// XColumnLocate
539sal_Int32 SAL_CALL ORowSetBase::findColumn( const OUString& columnName )
540{
541 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
542
543 ::osl::MutexGuard aGuard( m_aColumnsMutex );
544 // it is possible to save some time here when we remember the names - position relation in a map
545 return m_pColumns ? m_pColumns->findColumn(columnName) : sal_Int32(0);
546}
547
548// css::sdbcx::XColumnsSupplier
549Reference< XNameAccess > SAL_CALL ORowSetBase::getColumns( )
550{
551 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
552
553 ::osl::MutexGuard aGuard( m_aColumnsMutex );
554 if(!m_pColumns)
555 {
558 return m_pEmptyCollection.get();
559 }
560
561 return m_pColumns.get();
562}
563
564// XResultSet
566{
567 SAL_INFO("dbaccess", "ORowSetBase::next() Clone = " << m_bClone);
568 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
569 checkCache();
570
571 bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) );
572 if ( bRet )
573 {
574 // check if we are inserting a row
575 bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
576
577 ORowSetNotifier aNotifier( this );
578 // this will call cancelRowModification on the cache if necessary
579
580 ORowSetRow aOldValues = getOldRow(bWasNew);
581
583 bool bAfterLast = m_pCache->isAfterLast();
584 bRet = m_pCache->next();
586
587 // if we were afterLast before next() then we still are,
588 // i.e. bAfterLast implies m_pCache->isAfterLast()
589 if (bAfterLast)
590 assert(m_pCache->isAfterLast());
591 // so the only way bAfterLast != m_pCache->isAfterLast()
592 // would be that we just arrived there,
593 if (bAfterLast != m_pCache->isAfterLast())
594 {
595 assert(!bAfterLast);
596 assert(m_pCache->isAfterLast());
597 }
598 // in which case we *did* move the cursor
599 if ( bRet || bAfterLast != m_pCache->isAfterLast() )
600 {
601 // notification order
602 // - column values
603 // - cursorMoved
604 setCurrentRow( true, true, aOldValues, aGuard );
605 OSL_ENSURE(!m_bBeforeFirst,"BeforeFirst is true. I don't know why?");
606 }
607 else
608 {
609 // moved after the last row
611 OSL_ENSURE(m_bAfterLast,"AfterLast is false. I don't know why?");
612 }
613
614 // - IsModified
615 // - IsNew
616 aNotifier.fire();
617
618 // - RowCount/IsRowCountFinal
619 fireRowcount();
620 }
621 SAL_INFO("dbaccess", "ORowSetBase::next() = " << bRet << " Clone = " << m_bClone);
622 return bRet;
623}
624
626{
627 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
628 ::osl::MutexGuard aGuard( *m_pMutex );
629 checkCache();
630
631 SAL_INFO("dbaccess", "ORowSetBase::isBeforeFirst() = " << m_bBeforeFirst << " Clone = " << m_bClone);
632
633 return m_bBeforeFirst;
634}
635
637{
638 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
639 ::osl::MutexGuard aGuard( *m_pMutex );
640 checkCache();
641 SAL_INFO("dbaccess", "ORowSetBase::isAfterLast() = " << m_bAfterLast << " Clone = " << m_bClone);
642
643 return m_bAfterLast;
644}
645
647{
648 return isFirst();
649}
650
652{
653 SAL_INFO("dbaccess", "ORowSetBase::isFirst() Clone = " << m_bClone);
654
655 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
656 ::osl::MutexGuard aGuard( *m_pMutex );
657 checkCache();
658
660 return false;
661
662 if ( impl_rowDeleted() )
663 return ( m_nDeletedPosition == 1 );
664
666 bool bIsFirst = m_pCache->isFirst();
667
668 SAL_INFO("dbaccess", "ORowSetBase::isFirst() = " << bIsFirst << " Clone = " << m_bClone);
669 return bIsFirst;
670}
671
673{
674 return isLast();
675}
676
678{
679 SAL_INFO("dbaccess", "ORowSetBase::isLast() Clone = " << m_bClone);
680 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
681 ::osl::MutexGuard aGuard( *m_pMutex );
682 checkCache();
683
685 return false;
686
687 if ( impl_rowDeleted() )
688 {
689 if ( !m_pCache->m_bRowCountFinal )
690 return false;
691 else
692 return ( m_nDeletedPosition == impl_getRowCount() );
693 }
694
696 bool bIsLast = m_pCache->isLast();
697
698 SAL_INFO("dbaccess", "ORowSetBase::isLast() = " << bIsLast << " Clone = " << m_bClone);
699 return bIsLast;
700}
701
703{
704 SAL_INFO("dbaccess", "ORowSetBase::beforeFirst() Clone = " << m_bClone);
705 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
706 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
707
709
710 // check if we are inserting a row
711 bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
712
713 if((bWasNew || !m_bBeforeFirst) && notifyAllListenersCursorBeforeMove(aGuard) )
714 {
715 ORowSetNotifier aNotifier( this );
716 // this will call cancelRowModification on the cache if necessary
717
718 if ( !m_bBeforeFirst )
719 {
720 ORowSetRow aOldValues = getOldRow(bWasNew);
721 m_pCache->beforeFirst();
723
724 // notification order
725 // - column values
726 // - cursorMoved
727 setCurrentRow( true, true, aOldValues, aGuard );
728
729 // - IsModified
730 // - Isnew
731 aNotifier.fire();
732
733 // - RowCount/IsRowCountFinal
734 fireRowcount();
735 }
736
737 // to be done _after_ the notifications!
738 m_aOldRow->clearRow();
739 }
740 SAL_INFO("dbaccess", "ORowSetBase::beforeFirst() Clone = " << m_bClone);
741}
742
744{
745 SAL_INFO("dbaccess", "ORowSetBase::afterLast() Clone = " << m_bClone);
746 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
747
748 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
750
751 bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
752
753 if((bWasNew || !m_bAfterLast) && notifyAllListenersCursorBeforeMove(aGuard) )
754 {
755 // check if we are inserting a row
756 ORowSetNotifier aNotifier( this );
757 // this will call cancelRowModification on the cache if necessary
758
759 if(!m_bAfterLast)
760 {
761 ORowSetRow aOldValues = getOldRow(bWasNew);
762
763 m_pCache->afterLast();
765
766 // notification order
767 // - column values
768 // - cursorMoved
769 setCurrentRow( true, true, aOldValues, aGuard );
770
771 // - IsModified
772 // - Isnew
773 aNotifier.fire();
774
775 // - RowCount/IsRowCountFinal
776 fireRowcount();
777 }
778 }
779 SAL_INFO("dbaccess", "ORowSetBase::afterLast() Clone = " << m_bClone);
780}
781
782bool SAL_CALL ORowSetBase::move(std::function<bool(ORowSetBase *)> const & _aCheckFunctor,
783 std::function<bool(ORowSetCache *)> const & _aMovementFunctor)
784{
785 SAL_INFO("dbaccess", "ORowSetBase::move() Clone = " << m_bClone);
786 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
787 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
789
790 bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) );
791 if( bRet )
792 {
793 // check if we are inserting a row
794 bool bWasNew = m_pCache->m_bNew || rowDeleted();
795
796 ORowSetNotifier aNotifier( this );
797 // this will call cancelRowModification on the cache if necessary
798
799 ORowSetRow aOldValues = getOldRow(bWasNew);
800
801 bool bMoved = ( bWasNew || !_aCheckFunctor(this) );
802
803 bRet = _aMovementFunctor(m_pCache.get());
805
806 if ( bRet )
807 {
808 // notification order
809 // - column values
810 // - cursorMoved
811 setCurrentRow( bMoved, true, aOldValues, aGuard );
812 }
813 else
814 { // first goes wrong so there is no row
816 }
817
818 // - IsModified
819 // - IsNew
820 aNotifier.fire();
821
822 // - RowCount/IsRowCountFinal
823 fireRowcount();
824 }
825 SAL_INFO("dbaccess", "ORowSetBase::move() = " << bRet << " Clone = " << m_bClone);
826 return bRet;
827}
828
830{
831 SAL_INFO("dbaccess", "ORowSetBase::first() Clone = " << m_bClone);
832 auto ioF_tmp = std::mem_fn(&ORowSetBase::isOnFirst);
833 auto F_tmp = std::mem_fn(&ORowSetCache::first);
834 return move(ioF_tmp,F_tmp);
835}
836
838{
839 SAL_INFO("dbaccess", "ORowSetBase::last() Clone = " << m_bClone);
840 auto ioL_tmp = std::mem_fn(&ORowSetBase::isOnLast);
841 auto L_tmp = std::mem_fn(&ORowSetCache::last);
842 return move(ioL_tmp,L_tmp);
843}
844
845sal_Int32 SAL_CALL ORowSetBase::getRow( )
846{
847 SAL_INFO("dbaccess", "ORowSetBase::getRow() Clone = " << m_bClone);
848 ::osl::MutexGuard aGuard( *m_pMutex );
849
850 checkCache();
851 return impl_getRow();
852}
853
855{
856 sal_Int32 nPos = 0;
857 if ( m_bBeforeFirst )
858 nPos = 0;
859 else if ( m_bAfterLast )
860 nPos = impl_getRowCount() + 1;
861 else if ( impl_rowDeleted() )
863 else if ( !m_bClone && m_pCache->m_bNew )
864 nPos = 0;
865 else
866 {
868 nPos = m_pCache->getRow();
869 }
870 SAL_INFO("dbaccess", "ORowSetBase::impl_getRow() = " << nPos << " Clone = " << m_bClone);
871 return nPos;
872}
873
874sal_Bool SAL_CALL ORowSetBase::absolute( sal_Int32 row )
875{
876 SAL_INFO("dbaccess", "ORowSetBase::absolute(" << row << ") Clone = " << m_bClone);
877 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
878 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
880
881 bool bRet = ( row > 0 )
883 if ( bRet )
884 {
885 // check if we are inserting a row
886 bool bWasNew = m_pCache->m_bNew || rowDeleted();
887
888 ORowSetNotifier aNotifier( this );
889 // this will call cancelRowModification on the cache if necessary
890
891 ORowSetRow aOldValues = getOldRow(bWasNew);
892
893 bRet = m_pCache->absolute(row);
895
896 if(bRet)
897 {
898 // notification order
899 // - column values
900 // - cursorMoved
901 setCurrentRow( true, true, aOldValues, aGuard );
902 }
903 else
904 { // absolute movement goes wrong we stand left or right side of the rows
906 }
907
908 // - IsModified
909 // - IsNew
910 aNotifier.fire();
911
912 // - RowCount/IsRowCountFinal
913 fireRowcount();
914 }
915 SAL_INFO("dbaccess", "ORowSetBase::absolute(" << row << ") = " << bRet << " Clone = " << m_bClone);
916 return bRet;
917}
918
919sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows )
920{
921 SAL_INFO("dbaccess", "ORowSetBase::relative(" << rows << ") Clone = " << m_bClone);
922 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
923
924 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
925
926 if(!rows)
927 return true; // in this case do nothing
928
930
931 bool bRet =
932 ( ( !m_bAfterLast || rows <= 0 )
933 && ( !m_bBeforeFirst || rows >= 0 )
935 );
936
937 if ( bRet )
938 {
939 // check if we are inserting a row
940 bool bWasNew = m_pCache->m_bNew || rowDeleted();
941
942 ORowSetNotifier aNotifier( this );
943 // this will call cancelRowModification on the cache if necessary
944
945 ORowSetRow aOldValues = getOldRow(bWasNew);
946
948 bRet = m_pCache->relative(rows);
950
951 if(bRet)
952 {
953 // notification order
954 // - column values
955 // - cursorMoved
956 setCurrentRow( true, true, aOldValues, aGuard );
957 }
958 else
959 {
961 }
962
963 // - IsModified
964 // - IsNew
965 aNotifier.fire();
966
967 // - RowCount/IsRowCountFinal
968 fireRowcount();
969 }
970 SAL_INFO("dbaccess", "ORowSetBase::relative(" << rows << ") = " << bRet << " Clone = " << m_bClone);
971 return bRet;
972}
973
975{
976 SAL_INFO("dbaccess", "ORowSetBase::previous() Clone = " << m_bClone);
977 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
978 ::osl::ResettableMutexGuard aGuard( *m_pMutex );
979
981
982 bool bRet = !m_bBeforeFirst
984
985 if ( bRet )
986 {
987 // check if we are inserting a row
988 bool bWasNew = m_pCache->m_bNew || rowDeleted();
989
990 ORowSetNotifier aNotifier( this );
991 // this will call cancelRowModification on the cache if necessary
992
993 ORowSetRow aOldValues = getOldRow(bWasNew);
994
996 bRet = m_pCache->previous();
998
999 // if m_bBeforeFirst is false and bRet is false then we stood on the first row
1000 if(!m_bBeforeFirst || bRet)
1001 {
1002 // notification order
1003 // - column values
1004 // - cursorMoved
1005 setCurrentRow( true, true, aOldValues, aGuard );
1006 }
1007 else
1008 {
1009 SAL_WARN("dbaccess", "ORowSetBase::previous: inconsistency!" );
1010 // we should never reach this place, as we should not get into this whole branch if m_bBeforeFirst
1011 // was |true| from the beginning
1013 }
1014
1015 // - IsModified
1016 // - IsNew
1017 aNotifier.fire();
1018
1019 // - RowCount/IsRowCountFinal
1020 fireRowcount();
1021 }
1022 SAL_INFO("dbaccess", "ORowSetBase::previous() = " << bRet << " Clone = " << m_bClone);
1023 return bRet;
1024}
1025
1026void ORowSetBase::setCurrentRow( bool _bMoved, bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard )
1027{
1028 SAL_INFO("dbaccess", "ORowSetBase::setCurrentRow() Clone = " << m_bClone);
1029 m_bBeforeFirst = m_pCache->isBeforeFirst();
1030 m_bAfterLast = m_pCache->isAfterLast();
1031
1033 {
1034 m_aBookmark = m_pCache->getBookmark();
1035 OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!");
1036 m_aCurrentRow = m_pCache->m_aMatrixIter;
1037 m_bIsInsertRow = false;
1038 OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is null!");
1039 OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd(),"Position of matrix iterator isn't valid!");
1040 OSL_ENSURE(m_aCurrentRow->is(),"Currentrow isn't valid");
1041 OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!");
1042
1043 m_aCurrentRow = m_pCache->m_aMatrixIter;
1044 m_bIsInsertRow = false;
1045 OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!");
1046#if OSL_DEBUG_LEVEL > 0
1047 ORowSetRow rRow = *m_aCurrentRow;
1048 OSL_ENSURE(rRow.is() ,"Invalid size of vector!");
1049#endif
1050
1051 // notification order
1052 // - column values
1053 if ( _bDoNotify )
1054 firePropertyChange(_rOldValues);
1055
1056 }
1057 else
1058 {
1059 m_aOldRow->clearRow();
1060 m_aCurrentRow = m_pCache->getEnd();
1061 m_aBookmark = Any();
1062 }
1063
1064 // TODO: can this be done before the notifications?
1065 if(!(m_bBeforeFirst || m_bAfterLast) && !m_aCurrentRow.isNull() && m_aCurrentRow->is() && m_aCurrentRow != m_pCache->getEnd())
1066 m_aOldRow->setRow(new ORowSetValueVector( *(*m_aCurrentRow) ));
1067
1068 if ( _bMoved && _bDoNotify )
1069 // - cursorMoved
1071
1072 SAL_INFO("dbaccess", "ORowSetBase::setCurrentRow() Clone = " << m_bClone);
1073}
1074
1076{
1077 if(!m_pCache || m_nResultSetType == ResultSetType::FORWARD_ONLY)
1079}
1080
1081Reference< XInterface > ORowSetBase::getStatement()
1082{
1083 return nullptr;
1084}
1085
1087{
1088 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
1089 ::osl::MutexGuard aGuard( *m_pMutex );
1090 checkCache();
1091 if ( impl_rowDeleted() )
1092 throwSQLException( "The current row is deleted", StandardSQLState::INVALID_CURSOR_STATE, Reference< XRowSet >( this ) );
1093
1095 {
1096 bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
1097 ORowSetRow aOldValues = getOldRow(bWasNew);
1099 m_pCache->refreshRow();
1100 firePropertyChange(aOldValues);
1101 }
1102}
1103
1105{
1106 ::osl::MutexGuard aGuard( *m_pMutex );
1107 checkCache();
1108
1109 if ( impl_rowDeleted() )
1110 return false;
1111
1112 return m_pCache->rowUpdated();
1113}
1114
1116{
1117 ::osl::MutexGuard aGuard( *m_pMutex );
1118
1119 checkCache();
1120
1121 if ( impl_rowDeleted() )
1122 return false;
1123
1124 return m_pCache->rowInserted();
1125}
1126
1128{
1129 ::osl::MutexGuard aGuard( *m_pMutex );
1130 checkCache();
1131 return impl_rowDeleted();
1132}
1133
1135{
1136 return !m_aBookmark.hasValue() && !m_bBeforeFirst && !m_bAfterLast;
1137}
1138
1139// XWarningsSupplier
1141{
1142 ::osl::MutexGuard aGuard( *m_pMutex );
1143
1144 if ( m_pCache )
1145 {
1146 Reference< XWarningsSupplier > xWarnings( m_pCache->m_xSet.get(), UNO_QUERY );
1147 if ( xWarnings.is() )
1148 return xWarnings->getWarnings();
1149 }
1150
1151 return Any();
1152}
1153
1155{
1156 ::osl::MutexGuard aGuard( *m_pMutex );
1157
1158 if ( m_pCache )
1159 {
1160 Reference< XWarningsSupplier > xWarnings( m_pCache->m_xSet.get(), UNO_QUERY );
1161 if ( xWarnings.is() )
1162 xWarnings->clearWarnings();
1163 }
1164}
1165
1167{
1169 return;
1170
1171 SAL_INFO("dbaccess", "ORowSetBase::firePropertyChange" );
1172 SAL_INFO("dbaccess", "ORowSetBase::firePropertyChange() Clone = " << m_bClone);
1173 OSL_ENSURE(m_pColumns,"Columns can not be NULL here!");
1174 sal_Int32 i=0;
1175 for (auto const& dataColumn : m_aDataColumns)
1176 {
1177 try
1178 {
1179 dataColumn->fireValueChange(_rOldRow.is() ? (*_rOldRow)[i+1] : ::connectivity::ORowSetValue());
1180 }
1181 catch (const Exception&)
1182 {
1183 TOOLS_WARN_EXCEPTION("dbaccess", "firePropertyChange: Exception on column " << i);
1184 }
1185 ++i;
1186 }
1187 SAL_INFO("dbaccess", "ORowSetBase::firePropertyChange() Clone = " << m_bClone);
1188}
1189
1190void ORowSetBase::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rOldValue)
1191{
1192 OSL_ENSURE(_nPos < static_cast<sal_Int32>(m_aDataColumns.size()),"nPos is invalid!");
1193 m_aDataColumns[_nPos]->fireValueChange(_rOldValue);
1194}
1195
1197{
1198}
1199
1200bool ORowSetBase::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& /*_rGuard*/)
1201{
1202 return true;
1203}
1204
1205void ORowSetBase::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& /*_rGuard*/)
1206{
1207}
1208
1210{
1211 return true;
1212}
1213
1214void ORowSetBase::fireProperty( sal_Int32 _nProperty, bool _bNew, bool _bOld )
1215{
1216 Any aNew( _bNew );
1217 Any aOld( _bOld );
1218 fire( &_nProperty, &aNew, &aOld, 1, false );
1219}
1220
1222{
1223 SAL_INFO("dbaccess", "ORowSetBase::positionCache() Clone = " << m_bClone);
1224
1225 bool bSuccess = false;
1226 if ( m_aBookmark.hasValue() )
1227 {
1228 if (_ePrepareForDirection == CursorMoveDirection::CurrentRefresh ||
1229 (m_pCache->isAfterLast() != bool(isAfterLast())) || ( m_pCache->isBeforeFirst() != bool(isBeforeFirst()) ) ||
1230 m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
1231 bSuccess = m_pCache->moveToBookmark( m_aBookmark );
1232 else
1233 bSuccess = true;
1234 }
1235 else
1236 {
1237 if ( m_bBeforeFirst )
1238 {
1239 m_pCache->beforeFirst();
1240 bSuccess = true;
1241 }
1242 else if ( m_bAfterLast )
1243 {
1244 m_pCache->afterLast();
1245 bSuccess = true;
1246 }
1247 else
1248 {
1249 OSL_ENSURE( m_nDeletedPosition >= 1, "ORowSetBase::positionCache: no bookmark, and no valid 'deleted position'!" );
1250 switch ( _ePrepareForDirection )
1251 {
1253 if ( m_nDeletedPosition > 1 )
1254 bSuccess = m_pCache->absolute( m_nDeletedPosition - 1 );
1255 else
1256 {
1257 m_pCache->beforeFirst();
1258 bSuccess = true;
1259 }
1260 break;
1261
1263 if ( m_pCache->m_bRowCountFinal && ( m_nDeletedPosition == impl_getRowCount() ) )
1264 {
1265 m_pCache->afterLast();
1266 bSuccess = true;
1267 }
1268 else
1269 bSuccess = m_pCache->absolute( m_nDeletedPosition );
1270 break;
1271
1274 bSuccess = false; // will be asserted below
1275 break;
1276 }
1277 }
1278 }
1279 OSL_ENSURE( bSuccess, "ORowSetBase::positionCache: failed!" );
1280
1281 SAL_INFO("dbaccess", "ORowSetBase::positionCache() Clone = " << m_bClone);
1282}
1283
1285{
1286 ::connectivity::checkDisposed(m_rBHelper.bDisposed);
1287 if(!m_pCache)
1289}
1290
1292{
1293 SAL_INFO("dbaccess", "ORowSetBase::movementFailed() Clone = " << m_bClone);
1294 m_aOldRow->clearRow();
1295 m_aCurrentRow = m_pCache->getEnd();
1296 m_bBeforeFirst = m_pCache->isBeforeFirst();
1297 m_bAfterLast = m_pCache->isAfterLast();
1298 m_aBookmark = Any();
1299 OSL_ENSURE(m_bBeforeFirst || m_bAfterLast,"BeforeFirst or AfterLast is wrong!");
1300 SAL_INFO("dbaccess", "ORowSetBase::movementFailed() Clone = " << m_bClone);
1301}
1302
1304{
1305 OSL_ENSURE(m_aOldRow.is(),"RowSetRowHElper isn't valid!");
1306 ORowSetRow aOldValues;
1307 if ( !_bWasNew && m_aOldRow->getRow().is() )
1308 aOldValues = new ORowSetValueVector( *(m_aOldRow->getRow())); // remember the old values
1309 return aOldValues;
1310}
1311
1312void ORowSetBase::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const
1313{
1314 _rDefault.clear();
1315}
1316
1317void ORowSetBase::onDeleteRow( const Any& _rBookmark )
1318{
1319 if ( rowDeleted() )
1320 // not interested in
1321 return;
1322
1323 ::osl::MutexGuard aGuard( *m_pMutex );
1324 //OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
1325 if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL )
1326 {
1328 m_nDeletedPosition = m_pCache->getRow();
1329 }
1330}
1331
1332void ORowSetBase::onDeletedRow( const Any& _rBookmark, sal_Int32 _nPos )
1333{
1334 if ( rowDeleted() )
1335 {
1336 // if we're a clone, and on a deleted row, and the main RowSet deleted another
1337 // row (only the main RowSet can, clones can't), which is *before* our
1338 // deleted position, then we have to adjust this position
1339 if ( m_bClone && ( _nPos < m_nDeletedPosition ) )
1341 return;
1342 }
1343
1344 ::osl::MutexGuard aGuard( *m_pMutex );
1345 if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL )
1346 {
1347 m_aOldRow->clearRow();
1348 m_aCurrentRow = m_pCache->getEnd();
1349 m_aBookmark = Any();
1350 }
1351}
1352
1354{
1355 sal_Int32 nRowCount( m_pCache->m_nRowCount );
1356 if ( const_cast< ORowSetBase* >( this )->rowDeleted() && !m_pCache->m_bNew )
1357 ++nRowCount;
1358 return nRowCount;
1359}
1360
1361
1363 :m_pRowSet( _pRowSet )
1364 ,m_bWasNew( false )
1365 ,m_bWasModified( false )
1366{
1367
1368 OSL_ENSURE( m_pRowSet, "ORowSetNotifier::ORowSetNotifier: invalid row set. This will crash." );
1369
1370 // remember the "inserted" and "modified" state for later firing
1373
1374 // if the row set is on the insert row, then we need to cancel this
1377}
1378
1380 :m_pRowSet( _pRowSet )
1381 ,m_bWasNew( false )
1382 ,m_bWasModified( false )
1383{
1384 OSL_ENSURE( m_pRowSet, "ORowSetNotifier::ORowSetNotifier: invalid row set. This will crash." );
1385 aRow = std::move(i_aRow); // yes, create a copy to store the old values
1386}
1387
1389{
1390}
1391
1393{
1394 // we're not interested in firing changes FALSE->TRUE, only TRUE->FALSE.
1395 // (the former would be quite pathological, e.g. after a failed movement)
1396
1397 if ( m_bWasModified
1399 )
1401
1402 if ( m_bWasNew
1404 )
1406}
1407
1408std::vector<sal_Int32>& ORowSetNotifier::getChangedColumns()
1409{
1410 return aChangedColumns;
1411}
1412
1414{
1415 for (auto const& changedColumn : aChangedColumns)
1416 {
1417 m_pRowSet->firePropertyChange(changedColumn-1, aRow[changedColumn-1], ORowSetBase::GrantNotifierAccess());
1418 }
1419 if ( !aChangedColumns.empty() )
1421}
1422
1423} // namespace dbaccess
1424
1425/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::cppu::IPropertyArrayHelper * getArrayHelper()
void registerPropertyNoMember(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const css::uno::Type &_rType, css::uno::Any const &_pInitialValue)
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &_rType) override
std::vector< VectorVal > Vector
css::util::Time getTime() const
sal_Int32 getInt32() const
OUString getString() const
css::uno::Any makeAny() const
sal_Int8 getInt8() const
sal_Int16 getInt16() const
css::util::Date getDate() const
css::util::DateTime getDateTime() const
sal_Int64 getLong() const
css::uno::Sequence< sal_Int8 > getSequence() const
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
OEmptyCollection(::cppu::OWeakObject &_rParent,::osl::Mutex &_rMutex)
Definition: RowSetBase.cxx:65
virtual void impl_refresh() override
Definition: RowSetBase.cxx:68
virtual connectivity::sdbcx::ObjectType createObject(const OUString &_rName) override
Definition: RowSetBase.cxx:72
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
Definition: RowSetBase.cxx:874
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:383
ORowSetCacheIterator m_aCurrentRow
Definition: RowSetBase.hxx:79
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:250
virtual css::uno::Any SAL_CALL getWarnings() override
sal_Int32 m_nLastColumnIndex
Definition: RowSetBase.hxx:95
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: RowSetBase.cxx:126
const connectivity::ORowSetValue & getValue(sal_Int32 columnIndex)
Definition: RowSetBase.cxx:187
virtual sal_Int32 SAL_CALL compareBookmarks(const css::uno::Any &first, const css::uno::Any &second) override
Definition: RowSetBase.cxx:505
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:310
TORowSetOldRowHelperRef m_aOldRow
Definition: RowSetBase.hxx:80
virtual sal_Bool SAL_CALL rowDeleted() override
std::unique_ptr< ORowSetDataColumns > m_pColumns
Definition: RowSetBase.hxx:86
std::unique_ptr< OEmptyCollection > m_pEmptyCollection
Definition: RowSetBase.hxx:90
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
Definition: RowSetBase.cxx:919
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
Definition: RowSetBase.cxx:364
::cppu::OBroadcastHelper & m_rBHelper
Definition: RowSetBase.hxx:87
virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard &_rGuard)
virtual sal_Int32 SAL_CALL hashBookmark(const css::uno::Any &bookmark) override
Definition: RowSetBase.cxx:519
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override
Definition: RowSetBase.cxx:549
virtual void fireRowcount()
virtual sal_Bool SAL_CALL moveToBookmark(const css::uno::Any &bookmark) override
Definition: RowSetBase.cxx:412
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:280
virtual css::uno::Any SAL_CALL getBookmark() override
Definition: RowSetBase.cxx:395
virtual bool isPropertyChangeNotificationEnabled() const
TDataColumns m_aDataColumns
Definition: RowSetBase.hxx:81
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:274
virtual sal_Bool SAL_CALL rowUpdated() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:298
void fireProperty(sal_Int32 _nProperty, bool _bNew, bool _bOld)
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:378
virtual sal_Bool SAL_CALL last() override
Definition: RowSetBase.cxx:837
virtual bool isModified()=0
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:322
void onDeleteRow(const css::uno::Any &_rBookmark)
virtual sal_Bool SAL_CALL next() override
Definition: RowSetBase.cxx:565
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:388
virtual void SAL_CALL clearWarnings() override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
Definition: RowSetBase.cxx:527
virtual void SAL_CALL beforeFirst() override
Definition: RowSetBase.cxx:702
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:316
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:372
connectivity::ORowSetValue m_aEmptyValue
Definition: RowSetBase.hxx:82
virtual sal_Bool SAL_CALL isAfterLast() override
Definition: RowSetBase.cxx:636
bool isOnFirst()
same meaning as isFirst.
Definition: RowSetBase.cxx:646
::cppu::OWeakObject * m_pMySelf
Definition: RowSetBase.hxx:84
virtual void doCancelModification()=0
virtual sal_Bool SAL_CALL first() override
Definition: RowSetBase.cxx:829
virtual sal_Bool SAL_CALL moveRelativeToBookmark(const css::uno::Any &bookmark, sal_Int32 rows) override
Definition: RowSetBase.cxx:462
ORowSetRow getOldRow(bool _bWasNew)
::osl::Mutex m_aColumnsMutex
Definition: RowSetBase.hxx:76
sal_Int32 impl_getRow()
Definition: RowSetBase.cxx:854
sal_Int32 impl_getRowCount() const
returns the current row count
css::uno::Any m_aBookmark
Definition: RowSetBase.hxx:78
sal_Int32 m_nDeletedPosition
Definition: RowSetBase.hxx:96
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: RowSetBase.cxx:165
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: RowSetBase.cxx:173
virtual bool isModification()=0
@ Current
denotes no cursor move at all, but move cache to current row (if it is not there already)
@ Forward
denotes a cursor move forward
@ CurrentRefresh
denotes no cursor move at all, but force the cache to move to current row (and refresh the row)
@ Backward
denotes a cursor move backwards
const connectivity::ORowSetValue & impl_getValue(sal_Int32 columnIndex)
Definition: RowSetBase.cxx:193
virtual sal_Bool SAL_CALL isBeforeFirst() override
Definition: RowSetBase.cxx:625
virtual bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard &_rGuard)
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:286
virtual bool isNew()=0
virtual sal_Bool SAL_CALL isFirst() override
Definition: RowSetBase.cxx:651
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:304
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:262
void onDeletedRow(const css::uno::Any &_rBookmark, sal_Int32 _nPos)
virtual sal_Int32 SAL_CALL findColumn(const OUString &columnName) override
Definition: RowSetBase.cxx:539
virtual void SAL_CALL afterLast() override
Definition: RowSetBase.cxx:743
void setCurrentRow(bool _bMoved, bool _bDoNotify, const ORowSetRow &_rOldValues, ::osl::ResettableMutexGuard &_rGuard)
virtual sal_Bool SAL_CALL rowInserted() override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:359
virtual void getPropertyDefaultByHandle(sal_Int32 _nHandle, css::uno::Any &_rDefault) const override
virtual sal_Bool SAL_CALL hasOrderedBookmarks() override
Definition: RowSetBase.cxx:512
void positionCache(CursorMoveDirection _ePrepareForDirection)
positions the cache in preparation of a cursor move
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: RowSetBase.cxx:112
bool isOnLast()
same meaning as isLast.
Definition: RowSetBase.cxx:672
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: RowSetBase.cxx:118
ORowSetBase(const css::uno::Reference< css::uno::XComponentContext > &_rContext, ::cppu::OBroadcastHelper &_rBHelper, ::osl::Mutex *_pMutex)
Definition: RowSetBase.cxx:79
virtual void SAL_CALL disposing()
Definition: RowSetBase.cxx:147
void firePropertyChange(const ORowSetRow &_rOldRow)
virtual sal_Bool SAL_CALL wasNull() override
Definition: RowSetBase.cxx:179
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
virtual sal_Bool SAL_CALL isLast() override
Definition: RowSetBase.cxx:677
virtual sal_Int32 SAL_CALL getRow() override
Definition: RowSetBase.cxx:845
std::shared_ptr< ORowSetCache > m_pCache
Definition: RowSetBase.hxx:85
bool SAL_CALL move(std::function< bool(ORowSetBase *)> const &_aCheckFunctor, std::function< bool(ORowSetCache *)> const &_aMovementFunctor)
move the cache the position defined by the member functor
Definition: RowSetBase.cxx:782
sal_Int32 m_nResultSetType
Definition: RowSetBase.hxx:97
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:268
std::vector< ORowSetDataColumn * > TDataColumns
Definition: RowSetBase.hxx:72
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:256
virtual ~ORowSetBase() override
Definition: RowSetBase.cxx:101
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
Definition: RowSetBase.cxx:292
virtual sal_Bool SAL_CALL previous() override
Definition: RowSetBase.cxx:974
::osl::Mutex * m_pMutex
Definition: RowSetBase.hxx:73
virtual void SAL_CALL refreshRow() override
const ORowSetCacheMap::iterator & getIter() const
eases the handling of the doCancelModification and notifyCancelInsert methods
Definition: RowSetBase.hxx:349
ORowSetNotifier(ORowSetBase *m_pRowSet)
constructs the object, and cancels the insertion
void firePropertyChange()
notifies value change events and notifies IsModified
void fire()
notifies the insertion
ORowSetValueVector::Vector aRow
Definition: RowSetBase.hxx:352
std::vector< sal_Int32 > aChangedColumns
Definition: RowSetBase.hxx:351
std::vector< sal_Int32 > & getChangedColumns()
use this one to store the index of the changed column values
#define DBA_RES(id)
Reference< XComponentContext > m_aContext
#define TOOLS_WARN_EXCEPTION(area, stream)
Any aHelper
sal_uInt16 nPos
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
@ Exception
Type
css::uno::Reference< css::beans::XPropertySet > ObjectType
connectivity::ORowVector< connectivity::ORowSetValue > ORowSetValueVector
Definition: RowSetRow.hxx:29
void throwFunctionSequenceException(const Reference< XInterface > &Context, const Any &Next)
void throwSQLException(const OUString &_rMessage, const OUString &_rSQLState, const Reference< XInterface > &_rxContext, const sal_Int32 _nErrorCode)
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)
const char * columnName
sal_Int32 nHandle
#define PROPERTY_ID_ISMODIFIED
#define PROPERTY_ID_ISROWCOUNTFINAL
#define PROPERTY_ID_ISNEW
#define PROPERTY_ID_ROWCOUNT
constexpr OUStringLiteral PROPERTY_ISROWCOUNTFINAL(u"IsRowCountFinal")
constexpr OUStringLiteral PROPERTY_ROWCOUNT(u"RowCount")
unsigned char sal_Bool
signed char sal_Int8
sal_Int32 _nPos
std::mutex * m_pMutex