1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
20 #define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
22 #include <cppuhelper/implbase10.hxx>
23 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
24 #include <com/sun/star/sdbc/XRow.hpp>
25 #include <com/sun/star/sdbc/XColumnLocate.hpp>
26 #include <com/sun/star/sdbc/XCloseable.hpp>
27 #include <com/sun/star/sdbcx/XRowLocate.hpp>
28 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
29 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/lang/XUnoTunnel.hpp>
32 #include <cppuhelper/interfacecontainer.h>
33 #include <connectivity/sqlerror.hxx>
34 #include <connectivity/CommonTools.hxx>
35 #include <comphelper/propertystatecontainer.hxx>
36 #include <comphelper/proparrhlp.hxx>
37 #include <com/sun/star/sdbc/XRowSet.hpp>
38 #include <com/sun/star/util/XNumberFormatTypes.hpp>
39 #include <com/sun/star/container/XNameAccess.hpp>
40 #include "RowSetRow.hxx"
41 #include <comphelper/broadcasthelper.hxx>
42 #include "RowSetCacheIterator.hxx"
43 #include "core_resource.hxx"
47 namespace com
{ namespace sun
{ namespace star
{
48 namespace sdb
{ struct RowChangeEvent
; }
49 namespace lang
{ struct Locale
; }
54 class OEmptyCollection
;
56 typedef ::cppu::ImplHelper10
< ::com::sun::star::sdbcx::XRowLocate
,
57 ::com::sun::star::sdbc::XRow
,
58 ::com::sun::star::sdbc::XResultSetMetaDataSupplier
,
59 ::com::sun::star::sdbc::XWarningsSupplier
,
60 ::com::sun::star::sdbc::XColumnLocate
,
61 ::com::sun::star::sdbcx::XColumnsSupplier
,
62 ::com::sun::star::lang::XServiceInfo
,
63 ::com::sun::star::sdbc::XRowSet
,
64 ::com::sun::star::sdbc::XCloseable
,
65 ::com::sun::star::lang::XUnoTunnel
> ORowSetBase_BASE
;
68 class ORowSetDataColumns
;
69 class ORowSetCacheIterator
;
70 class ORowSetDataColumn
;
71 class ORowSetBase
: public ORowSetBase_BASE
,
72 public ::comphelper::OPropertyStateContainer
,
73 public ::comphelper::OPropertyArrayUsageHelper
<ORowSetBase
> // this class hold the static property info
75 OModuleClient m_aModuleClient
;
77 typedef ::std::vector
<ORowSetDataColumn
*> TDataColumns
;
78 ::osl::Mutex
* m_pMutex
; // this the mutex form the rowset itself
79 ::osl::Mutex m_aRowCountMutex
, // mutex for rowcount changes
80 // we need a extra mutex for columns to prevend deadlock when setting new values
84 ::com::sun::star::uno::Any m_aBookmark
;
85 ORowSetCacheIterator m_aCurrentRow
; // contains the actual fetched row
86 TORowSetOldRowHelperRef m_aOldRow
;
87 TDataColumns m_aDataColumns
; // holds the columns as m_pColumns but know the implementation class
88 connectivity::ORowSetValue m_aEmptyValue
; // only for error case
90 ::cppu::OWeakObject
* m_pMySelf
; // set by derived classes
91 ORowSetCache
* m_pCache
; // the cache is used by the rowset and his clone (shared)
92 ORowSetDataColumns
* m_pColumns
; // represent the select columns
93 ::cppu::OBroadcastHelper
& m_rBHelper
; // must be set from the derived classes
94 // is used when the formatkey for database types is set
95 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatTypes
> m_xNumberFormatTypes
;
96 OEmptyCollection
* m_pEmptyCollection
;
98 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_aContext
;
99 ::connectivity::SQLError m_aErrors
;
101 sal_Int32 m_nLastColumnIndex
; // the last column ask for, used for wasNull()
102 sal_Int32 m_nDeletedPosition
; // is set only when a row was deleted
103 sal_Int32 m_nResultSetType
; // fetch property
104 sal_Int32 m_nResultSetConcurrency
;
105 bool m_bClone
; // I'm clone or not
106 bool m_bIgnoreResult
;
107 bool m_bBeforeFirst
: 1;
108 bool m_bAfterLast
: 1;
109 bool m_bIsInsertRow
: 1;
113 const css::uno::Reference
<css::uno::XComponentContext
>& _rContext
,
114 ::cppu::OBroadcastHelper
& _rBHelper
,
115 ::osl::Mutex
* _pMutex
118 // fire a notification for all that are listening on column::VALUE property
119 void firePropertyChange(const ORowSetRow
& _rOldRow
);
120 // fire a change for one column
121 // _nPos starts at zero
122 void firePropertyChange(sal_Int32 _nPos
,const ::connectivity::ORowSetValue
& _rNewValue
);
124 // fire if rowcount changed
125 virtual void fireRowcount();
126 // notify row changed
127 virtual bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard
& _rGuard
);
128 // notify cursor moved
129 virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard
& _rGuard
);
130 // notify all that rowset changed
131 virtual void notifyAllListeners(::osl::ResettableMutexGuard
& _rGuard
);
133 // cancel the insertion, if necessary (means if we're on the insert row)
134 virtual void doCancelModification( ) = 0;
135 // return <TRUE/> if and only if we're using the insert row (means: we're updating _or_ inserting)
136 virtual bool isModification( ) = 0;
137 // return <TRUE/> if and only if the current row is modified
138 // TODO: isn't this the same as isModification?
139 virtual bool isModified( ) = 0;
140 // return <TRUE/> if and only if the current row is the insert row
141 virtual bool isNew( ) = 0;
142 // return <TRUE/> if the property change notification should be fired
143 // upon property change.
144 virtual bool isPropertyChangeNotificationEnabled() const;
145 // notify the change of a boolean property
146 void fireProperty( sal_Int32 _nProperty
, bool _bNew
, bool _bOld
);
148 // OPropertyStateContainer
149 virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle
, ::com::sun::star::uno::Any
& _rDefault
) const SAL_OVERRIDE
;
150 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
,sal_Int32 nHandle
) const SAL_OVERRIDE
;
152 enum CursorMoveDirection
154 /// denotes a cursor move forward
156 /// denotes a cursor move backwards
158 /// denotes no cursor move at all, but move cache to current row (if it is not there already)
160 /// denotes no cursor move at all, but force the cache to move to current row (and refresh the row)
163 /** positions the cache in preparation of a cursor move
165 Normally, the cache is simply moved to our bookmark (m_aBookmark). If however the current
166 row is deleted, then the cache is properly positioned for a following cursor movement in the
169 @param _ePrepareForDirection
170 the direction into which the cursor should be moved after the call. If we're currently not on
171 a deleted row, this parameter is ignored, since in this case the cache is simply moved to
173 If, however, we're currently on a deleted row, this is used to properly position the cache
174 using <member>m_nDeletedPosition</member>.<br/>
175 In this case, MOVE_NONE(_REFRESH) is not supported. This is because the deleted row
176 (to which the RowSet currently points to) is not present in the cache. So, you cannot move the
179 void positionCache( CursorMoveDirection _ePrepareForDirection
);
181 // returns a value of a column of the current row
182 const connectivity::ORowSetValue
& getValue(sal_Int32 columnIndex
);
183 // the cache has to be checked before calling this method
184 const connectivity::ORowSetValue
& impl_getValue(sal_Int32 columnIndex
);
185 // sets the current and the bookmark
186 void setCurrentRow( bool _bMoved
, bool _bDoNotify
, const ORowSetRow
& _rOldValues
, ::osl::ResettableMutexGuard
& _rGuard
);
187 void checkPositioningAllowed() throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
188 // checks if the cache is null
190 // sets the bookmark to Any()
191 // m_aCurrentRow to end of matrix
193 void movementFailed();
195 ORowSetRow
getOldRow(bool _bWasNew
);
196 /** move the cache the position defined by the member functor
197 @param _aCheckFunctor
198 Return <TRUE/> when we already stand on the row we want to.
199 @param _aMovementFunctor
200 The method used to move.
202 <TRUE/> if movement was successful.
204 bool SAL_CALL
move( ::std::mem_fun_t
<bool,ORowSetBase
>& _aCheckFunctor
,
205 ::std::mem_fun_t
<bool,ORowSetCache
>& _aMovementFunctor
);
207 /** same meaning as isFirst. Only need by mem_fun
212 /** same meaning as isLast. Only need by mem_fun
218 /** returns the current row count
220 This function takes into account that we might actually be positioned on a
221 deleted row, so that m_pCache->m_nRowCount does not really reflect the actual
225 Our mutext is locked.
227 sal_Int32
impl_getRowCount() const;
229 // the checkCache has to be called before calling this methods
231 sal_Int32
impl_getRow();
232 bool impl_rowDeleted();
235 virtual ~ORowSetBase();
238 virtual void SAL_CALL
disposing();
240 // com::sun::star::beans::XPropertySet
241 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
243 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
246 // comphelper::OPropertyArrayUsageHelper
247 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const SAL_OVERRIDE
;
249 // cppu::OPropertySetHelper
250 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
252 // com::sun::star::lang::XTypeProvider
253 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
255 // com::sun::star::uno::XInterface
256 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
258 // ::com::sun::star::sdbc::XWarningsSupplier
259 virtual ::com::sun::star::uno::Any SAL_CALL
getWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
260 virtual void SAL_CALL
clearWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
262 // ::com::sun::star::sdbc::XResultSetMetaDataSupplier
263 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
getMetaData( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
265 // ::com::sun::star::sdbc::XColumnLocate
266 virtual sal_Int32 SAL_CALL
findColumn( const OUString
& columnName
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
268 // ::com::sun::star::sdbcx::XColumnsSupplier
269 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getColumns( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
271 // ::com::sun::star::sdbc::XRow
272 virtual sal_Bool SAL_CALL
wasNull( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
273 virtual OUString SAL_CALL
getString( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
274 virtual sal_Bool SAL_CALL
getBoolean( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
275 virtual sal_Int8 SAL_CALL
getByte( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
276 virtual sal_Int16 SAL_CALL
getShort( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
277 virtual sal_Int32 SAL_CALL
getInt( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
278 virtual sal_Int64 SAL_CALL
getLong( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
279 virtual float SAL_CALL
getFloat( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
280 virtual double SAL_CALL
getDouble( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
281 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getBytes( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
282 virtual ::com::sun::star::util::Date SAL_CALL
getDate( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
283 virtual ::com::sun::star::util::Time SAL_CALL
getTime( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
284 virtual ::com::sun::star::util::DateTime SAL_CALL
getTimestamp( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
285 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
getBinaryStream( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
286 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
getCharacterStream( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
287 virtual ::com::sun::star::uno::Any SAL_CALL
getObject( sal_Int32 columnIndex
, const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& typeMap
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
288 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRef
> SAL_CALL
getRef( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
289 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XBlob
> SAL_CALL
getBlob( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
290 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XClob
> SAL_CALL
getClob( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
291 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XArray
> SAL_CALL
getArray( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
293 // ::com::sun::star::sdbcx::XRowLocate
294 virtual ::com::sun::star::uno::Any SAL_CALL
getBookmark( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
295 virtual sal_Bool SAL_CALL
moveToBookmark( const ::com::sun::star::uno::Any
& bookmark
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
296 virtual sal_Bool SAL_CALL
moveRelativeToBookmark( const ::com::sun::star::uno::Any
& bookmark
, sal_Int32 rows
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
297 virtual sal_Int32 SAL_CALL
compareBookmarks( const ::com::sun::star::uno::Any
& first
, const ::com::sun::star::uno::Any
& second
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
298 virtual sal_Bool SAL_CALL
hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
299 virtual sal_Int32 SAL_CALL
hashBookmark( const ::com::sun::star::uno::Any
& bookmark
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
301 // ::com::sun::star::sdbc::XResultSet
302 virtual sal_Bool SAL_CALL
next( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
303 virtual sal_Bool SAL_CALL
isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
304 virtual sal_Bool SAL_CALL
isAfterLast( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
305 virtual sal_Bool SAL_CALL
isFirst( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
306 virtual sal_Bool SAL_CALL
isLast( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
307 virtual void SAL_CALL
beforeFirst( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
308 virtual void SAL_CALL
afterLast( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
309 virtual sal_Bool SAL_CALL
first( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
310 virtual sal_Bool SAL_CALL
last( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
311 virtual sal_Int32 SAL_CALL
getRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
312 virtual sal_Bool SAL_CALL
absolute( sal_Int32 row
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
313 virtual sal_Bool SAL_CALL
relative( sal_Int32 rows
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
314 virtual sal_Bool SAL_CALL
previous( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
315 virtual void SAL_CALL
refreshRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
316 virtual sal_Bool SAL_CALL
rowUpdated( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
317 virtual sal_Bool SAL_CALL
rowInserted( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
318 virtual sal_Bool SAL_CALL
rowDeleted( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
319 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
getStatement( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
321 // ::com::sun::star::sdbc::XRowSet
322 virtual void SAL_CALL
execute( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
323 virtual void SAL_CALL
addRowSetListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSetListener
>& listener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
324 virtual void SAL_CALL
removeRowSetListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSetListener
>& listener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
326 // is called when the rowset is going to delete this bookmark _rBookmark
327 void onDeleteRow( const ::com::sun::star::uno::Any
& _rBookmark
);
328 // is called when the rowset has deleted this bookmark _rBookmark
329 void onDeletedRow( const ::com::sun::star::uno::Any
& _rBookmark
, sal_Int32 _nPos
);
331 // granular access control
332 struct GrantNotifierAccess
{ friend class ORowSetNotifier
; private: GrantNotifierAccess () { } };
334 // cancel the insertion, if necessary (means if we're on the insert row)
335 inline void doCancelModification( const GrantNotifierAccess
& ) { doCancelModification(); }
336 inline bool isModification( const GrantNotifierAccess
& ) { return isModification(); }
337 inline bool isModified( const GrantNotifierAccess
& ) { return isModified(); }
338 inline bool isNew( const GrantNotifierAccess
& ) { return isNew(); }
339 inline bool isInsertRow() { return m_bIsInsertRow
; } // isNew() || isModified(); }
340 inline void fireProperty( sal_Int32 _nProperty
, bool _bNew
, bool _bOld
, const GrantNotifierAccess
& )
342 fireProperty( _nProperty
, _bNew
, _bOld
);
344 inline void firePropertyChange(sal_Int32 _nPos
,const ::connectivity::ORowSetValue
& _rNewValue
, const GrantNotifierAccess
& )
346 firePropertyChange(_nPos
,_rNewValue
);
348 using ::comphelper::OPropertyStateContainer::getFastPropertyValue
;
350 ::osl::Mutex
* getMutex() const { return m_pMutex
; }
353 /** eases the handling of the doCancelModification and notifyCancelInsert methods
355 <p>The class can only be used on the stack, within a method of ORowSetBase (or derivees)</p>
357 struct ORowSetNotifierImpl
;
358 class ORowSetNotifier
361 ::std::unique_ptr
<ORowSetNotifierImpl
> m_pImpl
;
362 ORowSetBase
* m_pRowSet
;
363 // not acquired! This is not necessary because this class here is to be used on the stack within
364 // a method of ORowSetBase (or derivees)
369 bool m_bNotifyCalled
;
373 /** constructs the object, and cancels the insertion
375 @see ORowSetBase::doCancelModification
377 ORowSetNotifier( ORowSetBase
* m_pRowSet
);
379 /** use this one to consturct an vector for change value notification
381 ORowSetNotifier( ORowSetBase
* m_pRowSet
,const ORowSetValueVector::Vector
& i_aRow
);
383 // destructs the object. <member>fire</member> has to be called before.
386 /** notifies the insertion
388 <p>This has <em>not</em> been put into the destructor by intention!<br/>
390 The destructor is called during stack unwinding in case of an exception, so if we would do
391 listener notification there, this would have the potential of another exception during stack
392 unwinding, which would terminate the application.</p>
394 @see ORowSetBase::notifyCancelInsert
398 /** notifies value change events and notifies IsModified
399 @param i_aChangedColumns the index of the changed value columns
400 @param i_aRow the old values
401 @see ORowSetBase::notifyCancelInsert
403 void firePropertyChange();
405 /** use this one to store the inde of the changed column values
407 ::std::vector
<sal_Int32
>& getChangedColumns() const;
411 } // end of namespace
413 #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
415 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */