xref: /aoo42x/main/dbaccess/source/core/api/RowSet.cxx (revision d7b348a9)
196de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
396de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
496de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
596de5490SAndrew Rist  * distributed with this work for additional information
696de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
796de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
896de5490SAndrew Rist  * "License"); you may not use this file except in compliance
996de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
1096de5490SAndrew Rist  *
1196de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1296de5490SAndrew Rist  *
1396de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1496de5490SAndrew Rist  * software distributed under the License is distributed on an
1596de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1696de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
1796de5490SAndrew Rist  * specific language governing permissions and limitations
1896de5490SAndrew Rist  * under the License.
1996de5490SAndrew Rist  *
2096de5490SAndrew Rist  *************************************************************/
2196de5490SAndrew Rist 
2296de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "RowSet.hxx"
28cdf0e10cSrcweir #include "dbastrings.hrc"
29cdf0e10cSrcweir #include "sdbcoretools.hxx"
30cdf0e10cSrcweir #include "SingleSelectQueryComposer.hxx"
31cdf0e10cSrcweir #include "module_dba.hxx"
32cdf0e10cSrcweir #include "sdbcoretools.hxx"
33cdf0e10cSrcweir #include "CRowSetColumn.hxx"
34cdf0e10cSrcweir #include "CRowSetDataColumn.hxx"
35cdf0e10cSrcweir #include "RowSetCache.hxx"
36cdf0e10cSrcweir #include "core_resource.hrc"
37cdf0e10cSrcweir #include "core_resource.hxx"
38cdf0e10cSrcweir #include "tablecontainer.hxx"
39cdf0e10cSrcweir 
40cdf0e10cSrcweir /** === begin UNO includes === **/
41cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
42cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
43cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
44cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
45cdf0e10cSrcweir #include <com/sun/star/sdb/ErrorCondition.hpp>
46cdf0e10cSrcweir #include <com/sun/star/sdb/RowChangeAction.hpp>
47cdf0e10cSrcweir #include <com/sun/star/sdb/RowSetVetoException.hpp>
48cdf0e10cSrcweir #include <com/sun/star/sdb/XCompletedConnection.hpp>
49cdf0e10cSrcweir #include <com/sun/star/sdb/XParametersSupplier.hpp>
50cdf0e10cSrcweir #include <com/sun/star/sdb/XQueriesSupplier.hpp>
51cdf0e10cSrcweir #include <com/sun/star/sdbc/FetchDirection.hpp>
52cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
53cdf0e10cSrcweir #include <com/sun/star/sdbc/XDataSource.hpp>
54cdf0e10cSrcweir #include <com/sun/star/sdbc/XDriverAccess.hpp>
55cdf0e10cSrcweir #include <com/sun/star/sdbcx/CompareBookmark.hpp>
56cdf0e10cSrcweir #include <com/sun/star/sdbcx/Privilege.hpp>
57cdf0e10cSrcweir #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
58cdf0e10cSrcweir #include <com/sun/star/uno/XNamingService.hpp>
59cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
60cdf0e10cSrcweir /** === end UNO includes === **/
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
63cdf0e10cSrcweir #include <comphelper/extract.hxx>
64cdf0e10cSrcweir #include <comphelper/interaction.hxx>
65cdf0e10cSrcweir #include <comphelper/property.hxx>
66cdf0e10cSrcweir #include <comphelper/seqstream.hxx>
67cdf0e10cSrcweir #include <comphelper/sequence.hxx>
68cdf0e10cSrcweir #include <comphelper/types.hxx>
69cdf0e10cSrcweir #include <comphelper/uno3.hxx>
70cdf0e10cSrcweir #include <connectivity/BlobHelper.hxx>
71cdf0e10cSrcweir #include <connectivity/dbconversion.hxx>
72cdf0e10cSrcweir #include <connectivity/dbexception.hxx>
73cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
74cdf0e10cSrcweir #include <cppuhelper/exc_hlp.hxx>
75cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
76cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
77cdf0e10cSrcweir #include <rtl/logfile.hxx>
78cdf0e10cSrcweir #include <unotools/syslocale.hxx>
79cdf0e10cSrcweir #include <tools/debug.hxx>
80cdf0e10cSrcweir #include <tools/diagnose_ex.h>
81cdf0e10cSrcweir #include <unotools/configmgr.hxx>
82cdf0e10cSrcweir 
83cdf0e10cSrcweir using namespace utl;
84cdf0e10cSrcweir using namespace dbaccess;
85cdf0e10cSrcweir using namespace connectivity;
86cdf0e10cSrcweir using namespace comphelper;
87cdf0e10cSrcweir using namespace dbtools;
88cdf0e10cSrcweir using namespace ::com::sun::star;
89cdf0e10cSrcweir using namespace ::com::sun::star::uno;
90cdf0e10cSrcweir using namespace ::com::sun::star::beans;
91cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
92cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
93cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
94cdf0e10cSrcweir using namespace ::com::sun::star::container;
95cdf0e10cSrcweir using namespace ::com::sun::star::lang;
96cdf0e10cSrcweir using namespace ::com::sun::star::task;
97cdf0e10cSrcweir using namespace ::com::sun::star::util;
98cdf0e10cSrcweir using namespace ::cppu;
99cdf0e10cSrcweir using namespace ::osl;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir //--------------------------------------------------------------------------
createRegistryInfo_ORowSet()102cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_ORowSet()
103cdf0e10cSrcweir {
104cdf0e10cSrcweir 	static ::dba::OAutoRegistration< ORowSet > aAutoRegistration;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir // -----------------------------------------------------------------------------
107cdf0e10cSrcweir 
108cdf0e10cSrcweir #define NOTIFY_LISTERNERS_CHECK(_rListeners,T,method)							  \
109cdf0e10cSrcweir 	Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
110cdf0e10cSrcweir 																				  \
111cdf0e10cSrcweir 	const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray();	  \
112cdf0e10cSrcweir 	const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \
113cdf0e10cSrcweir 																				  \
114cdf0e10cSrcweir 	_rGuard.clear();															  \
115cdf0e10cSrcweir 	sal_Bool bCheck = sal_True;													  \
116cdf0e10cSrcweir 	while( pxInt > pxIntBegin && bCheck )										  \
117cdf0e10cSrcweir 	{																			  \
118cdf0e10cSrcweir 		try																		  \
119cdf0e10cSrcweir 		{																		  \
120cdf0e10cSrcweir 			while( pxInt > pxIntBegin && bCheck )								  \
121cdf0e10cSrcweir 			{																	  \
122cdf0e10cSrcweir 				--pxInt;														  \
123cdf0e10cSrcweir 				bCheck = static_cast< T* >( pxInt->get() )->method(aEvt);		  \
124cdf0e10cSrcweir 			}																	  \
125cdf0e10cSrcweir 		}																		  \
126cdf0e10cSrcweir 		catch( RuntimeException& )												  \
127cdf0e10cSrcweir 		{																		  \
128cdf0e10cSrcweir 		}																		  \
129cdf0e10cSrcweir 	}																			  \
130cdf0e10cSrcweir 	_rGuard.reset();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
133cdf0e10cSrcweir //..................................................................
134cdf0e10cSrcweir namespace dbaccess
135cdf0e10cSrcweir {
136cdf0e10cSrcweir //..................................................................
137cdf0e10cSrcweir //--------------------------------------------------------------------------
ORowSet_CreateInstance(const Reference<XMultiServiceFactory> & _rxFactory)138cdf0e10cSrcweir Reference< XInterface > ORowSet_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
139cdf0e10cSrcweir {
140cdf0e10cSrcweir 	return *(new ORowSet(_rxFactory));
141cdf0e10cSrcweir }
142cdf0e10cSrcweir //--------------------------------------------------------------------------
ORowSet(const Reference<::com::sun::star::lang::XMultiServiceFactory> & _rxORB)143cdf0e10cSrcweir ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
144cdf0e10cSrcweir 	:ORowSet_BASE1(m_aMutex)
145cdf0e10cSrcweir 	,ORowSetBase( _rxORB, ORowSet_BASE1::rBHelper, &m_aMutex )
146cdf0e10cSrcweir     ,m_pParameters( NULL )
147cdf0e10cSrcweir     ,m_aRowsetListeners(*m_pMutex)
148cdf0e10cSrcweir 	,m_aApproveListeners(*m_pMutex)
149cdf0e10cSrcweir     ,m_aRowsChangeListener(*m_pMutex)
150cdf0e10cSrcweir 	,m_pTables(NULL)
151cdf0e10cSrcweir     ,m_nFetchDirection(FetchDirection::FORWARD)
152cdf0e10cSrcweir 	,m_nFetchSize(50)
153cdf0e10cSrcweir 	,m_nMaxFieldSize(0)
154cdf0e10cSrcweir 	,m_nMaxRows(0)
155cdf0e10cSrcweir 	,m_nQueryTimeOut(0)
156cdf0e10cSrcweir     ,m_nCommandType(CommandType::COMMAND)
157cdf0e10cSrcweir 	,m_nTransactionIsolation(0)
158cdf0e10cSrcweir 	,m_nPrivileges(0)
159cdf0e10cSrcweir     ,m_nInAppend(0)
160cdf0e10cSrcweir 	,m_bUseEscapeProcessing(sal_True)
161cdf0e10cSrcweir 	,m_bApplyFilter(sal_False)
162cdf0e10cSrcweir 	,m_bCommandFacetsDirty( sal_True )
163cdf0e10cSrcweir 	,m_bModified(sal_False)
164cdf0e10cSrcweir     ,m_bRebuildConnOnExecute(sal_False)
165cdf0e10cSrcweir 	,m_bIsBookmarable(sal_True)
166cdf0e10cSrcweir 	,m_bNew(sal_False)
167cdf0e10cSrcweir 	,m_bCanUpdateInsertedRows(sal_True)
168cdf0e10cSrcweir 	,m_bOwnConnection(sal_False)
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	m_nResultSetType = ResultSetType::SCROLL_SENSITIVE;
171cdf0e10cSrcweir 	m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE;
172cdf0e10cSrcweir 	m_pMySelf = this;
173cdf0e10cSrcweir 	m_aActiveConnection <<= m_xActiveConnection;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	sal_Int32 nRBT	= PropertyAttribute::READONLY	| PropertyAttribute::BOUND		| PropertyAttribute::TRANSIENT;
176cdf0e10cSrcweir 	sal_Int32 nRT	= PropertyAttribute::READONLY	| PropertyAttribute::TRANSIENT;
177cdf0e10cSrcweir 	sal_Int32 nBT	= PropertyAttribute::BOUND		| PropertyAttribute::TRANSIENT;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     m_aPrematureParamValues.get().resize( 0 );
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	// sdb.RowSet Properties
182cdf0e10cSrcweir 	registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION,	PropertyAttribute::MAYBEVOID|PropertyAttribute::TRANSIENT|PropertyAttribute::BOUND,	&m_aActiveConnection,	::getCppuType(reinterpret_cast< Reference< XConnection >* >(NULL)));
183cdf0e10cSrcweir 	registerProperty(PROPERTY_DATASOURCENAME,		PROPERTY_ID_DATASOURCENAME,			PropertyAttribute::BOUND,		&m_aDataSourceName,		::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
184cdf0e10cSrcweir 	registerProperty(PROPERTY_COMMAND,				PROPERTY_ID_COMMAND,				PropertyAttribute::BOUND,		&m_aCommand,			::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
185cdf0e10cSrcweir 	registerProperty(PROPERTY_COMMAND_TYPE,			PROPERTY_ID_COMMAND_TYPE,			PropertyAttribute::BOUND,		&m_nCommandType,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
186cdf0e10cSrcweir 	registerProperty(PROPERTY_ACTIVECOMMAND,		PROPERTY_ID_ACTIVECOMMAND,			nRBT,							&m_aActiveCommand,		::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
187cdf0e10cSrcweir 	registerProperty(PROPERTY_IGNORERESULT,			PROPERTY_ID_IGNORERESULT,			PropertyAttribute::BOUND,		&m_bIgnoreResult,		::getBooleanCppuType());
188cdf0e10cSrcweir 	registerProperty(PROPERTY_FILTER,				PROPERTY_ID_FILTER,					PropertyAttribute::BOUND,		&m_aFilter,				::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
189cdf0e10cSrcweir 	registerProperty(PROPERTY_HAVING_CLAUSE,		PROPERTY_ID_HAVING_CLAUSE,			PropertyAttribute::BOUND,		&m_aHavingClause,		::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
190cdf0e10cSrcweir 	registerProperty(PROPERTY_GROUP_BY,				PROPERTY_ID_GROUP_BY,				PropertyAttribute::BOUND,		&m_aGroupBy,			::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
191cdf0e10cSrcweir 	registerProperty(PROPERTY_APPLYFILTER,			PROPERTY_ID_APPLYFILTER,			PropertyAttribute::BOUND,		&m_bApplyFilter,		::getBooleanCppuType());
192cdf0e10cSrcweir 	registerProperty(PROPERTY_ORDER,				PROPERTY_ID_ORDER,					PropertyAttribute::BOUND,		&m_aOrder,				::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
193cdf0e10cSrcweir 	registerProperty(PROPERTY_PRIVILEGES,			PROPERTY_ID_PRIVILEGES,				nRT,							&m_nPrivileges,			::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
194cdf0e10cSrcweir 	registerProperty(PROPERTY_ISMODIFIED,			PROPERTY_ID_ISMODIFIED,				nBT,							&m_bModified,			::getBooleanCppuType());
195cdf0e10cSrcweir 	registerProperty(PROPERTY_ISNEW,				PROPERTY_ID_ISNEW,					nRBT,							&m_bNew,				::getBooleanCppuType());
196cdf0e10cSrcweir     registerProperty(PROPERTY_SINGLESELECTQUERYCOMPOSER,PROPERTY_ID_SINGLESELECTQUERYCOMPOSER,	nRT,	                &m_xComposer,	::getCppuType(reinterpret_cast< Reference< XSingleSelectQueryComposer >* >(NULL)));
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 	// sdbcx.ResultSet Properties
199cdf0e10cSrcweir 	registerProperty(PROPERTY_ISBOOKMARKABLE,		PROPERTY_ID_ISBOOKMARKABLE,			nRT,							&m_bIsBookmarable,		::getBooleanCppuType());
200cdf0e10cSrcweir 	registerProperty(PROPERTY_CANUPDATEINSERTEDROWS,PROPERTY_ID_CANUPDATEINSERTEDROWS,	nRT,							&m_bCanUpdateInsertedRows,		::getBooleanCppuType());
201cdf0e10cSrcweir 	// sdbc.ResultSet Properties
202cdf0e10cSrcweir 	registerProperty(PROPERTY_RESULTSETCONCURRENCY,	PROPERTY_ID_RESULTSETCONCURRENCY,	PropertyAttribute::TRANSIENT,	&m_nResultSetConcurrency,::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
203cdf0e10cSrcweir 	registerProperty(PROPERTY_RESULTSETTYPE,		PROPERTY_ID_RESULTSETTYPE,			PropertyAttribute::TRANSIENT,	&m_nResultSetType,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
204cdf0e10cSrcweir 	registerProperty(PROPERTY_FETCHDIRECTION,		PROPERTY_ID_FETCHDIRECTION,			PropertyAttribute::TRANSIENT,	&m_nFetchDirection,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
205cdf0e10cSrcweir 	registerProperty(PROPERTY_FETCHSIZE,			PROPERTY_ID_FETCHSIZE,				PropertyAttribute::TRANSIENT,	&m_nFetchSize,			::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	// sdbc.RowSet Properties
208cdf0e10cSrcweir 	registerProperty(PROPERTY_URL,					PROPERTY_ID_URL,					0,								&m_aURL,				::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
209cdf0e10cSrcweir 	registerProperty(PROPERTY_TRANSACTIONISOLATION,	PROPERTY_ID_TRANSACTIONISOLATION,	PropertyAttribute::TRANSIENT,	&m_nTransactionIsolation,::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
210cdf0e10cSrcweir 	registerMayBeVoidProperty(PROPERTY_TYPEMAP,		PROPERTY_ID_TYPEMAP,				PropertyAttribute::MAYBEVOID|PropertyAttribute::TRANSIENT,	&m_aTypeMap,			::getCppuType(reinterpret_cast< Reference< XNameAccess >* >(NULL)));
211cdf0e10cSrcweir 	registerProperty(PROPERTY_ESCAPE_PROCESSING,PROPERTY_ID_ESCAPE_PROCESSING,	PropertyAttribute::BOUND,       &m_bUseEscapeProcessing,::getBooleanCppuType()	);
212cdf0e10cSrcweir 	registerProperty(PROPERTY_QUERYTIMEOUT,			PROPERTY_ID_QUERYTIMEOUT,			PropertyAttribute::TRANSIENT,	&m_nQueryTimeOut,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
213cdf0e10cSrcweir 	registerProperty(PROPERTY_MAXFIELDSIZE,			PROPERTY_ID_MAXFIELDSIZE,			PropertyAttribute::TRANSIENT,	&m_nMaxFieldSize,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
214cdf0e10cSrcweir 	registerProperty(PROPERTY_MAXROWS,				PROPERTY_ID_MAXROWS,				0,								&m_nMaxRows,			::getCppuType(reinterpret_cast< sal_Int32*>(NULL)) );
215cdf0e10cSrcweir 	registerProperty(PROPERTY_USER,					PROPERTY_ID_USER,					PropertyAttribute::TRANSIENT,	&m_aUser,				::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
216cdf0e10cSrcweir 	registerProperty(PROPERTY_PASSWORD,				PROPERTY_ID_PASSWORD,				PropertyAttribute::TRANSIENT,	&m_aPassword,			::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	registerProperty(PROPERTY_UPDATE_CATALOGNAME,	PROPERTY_ID_UPDATE_CATALOGNAME,		PropertyAttribute::BOUND,		&m_aUpdateCatalogName,	::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
219cdf0e10cSrcweir 	registerProperty(PROPERTY_UPDATE_SCHEMANAME,	PROPERTY_ID_UPDATE_SCHEMANAME,		PropertyAttribute::BOUND,		&m_aUpdateSchemaName,	::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
220cdf0e10cSrcweir 	registerProperty(PROPERTY_UPDATE_TABLENAME,		PROPERTY_ID_UPDATE_TABLENAME,		PropertyAttribute::BOUND,		&m_aUpdateTableName,	::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
221cdf0e10cSrcweir }
222cdf0e10cSrcweir 
~ORowSet()223cdf0e10cSrcweir ORowSet::~ORowSet()
224cdf0e10cSrcweir {
225cdf0e10cSrcweir 	if ( !m_rBHelper.bDisposed && !m_rBHelper.bInDispose )
226cdf0e10cSrcweir 	{
227cdf0e10cSrcweir 		OSL_ENSURE(0, "Please check who doesn't dispose this component!");
228cdf0e10cSrcweir 		osl_incrementInterlockedCount( &m_refCount );
229cdf0e10cSrcweir 		dispose();
230cdf0e10cSrcweir 	}
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertyDefaultByHandle(sal_Int32 _nHandle,Any & _rDefault) const234cdf0e10cSrcweir void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
235cdf0e10cSrcweir {
236cdf0e10cSrcweir 	switch( _nHandle )
237cdf0e10cSrcweir 	{
238cdf0e10cSrcweir 		case PROPERTY_ID_COMMAND_TYPE:
239cdf0e10cSrcweir 			_rDefault <<= static_cast<sal_Int32>(CommandType::COMMAND);
240cdf0e10cSrcweir 			break;
241cdf0e10cSrcweir 		case PROPERTY_ID_IGNORERESULT:
242cdf0e10cSrcweir 			_rDefault <<= sal_False;
243cdf0e10cSrcweir 			break;
244cdf0e10cSrcweir 		case PROPERTY_ID_APPLYFILTER:
245cdf0e10cSrcweir 			_rDefault <<= sal_False;
246cdf0e10cSrcweir 			break;
247cdf0e10cSrcweir 		case PROPERTY_ID_ISMODIFIED:
248cdf0e10cSrcweir 			_rDefault <<= sal_False;
249cdf0e10cSrcweir 			break;
250cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
251cdf0e10cSrcweir 			_rDefault <<= sal_True;
252cdf0e10cSrcweir 			break;
253cdf0e10cSrcweir 		case PROPERTY_ID_CANUPDATEINSERTEDROWS:
254cdf0e10cSrcweir 			_rDefault <<= sal_True;
255cdf0e10cSrcweir 			break;
256cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
257cdf0e10cSrcweir 			_rDefault <<= ResultSetType::SCROLL_INSENSITIVE;
258cdf0e10cSrcweir 			break;
259cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
260cdf0e10cSrcweir 			_rDefault <<= ResultSetConcurrency::UPDATABLE;
261cdf0e10cSrcweir 			break;
262cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
263cdf0e10cSrcweir 			_rDefault <<= FetchDirection::FORWARD;
264cdf0e10cSrcweir 			break;
265cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
266cdf0e10cSrcweir 			_rDefault <<= static_cast<sal_Int32>(1);
267cdf0e10cSrcweir 			break;
268cdf0e10cSrcweir 		case PROPERTY_ID_ESCAPE_PROCESSING:
269cdf0e10cSrcweir 			_rDefault <<= sal_True;
270cdf0e10cSrcweir 			break;
271cdf0e10cSrcweir         case PROPERTY_ID_MAXROWS:
272cdf0e10cSrcweir             _rDefault <<= sal_Int32( 0 );
273cdf0e10cSrcweir             break;
274cdf0e10cSrcweir         case PROPERTY_ID_FILTER:
275cdf0e10cSrcweir         case PROPERTY_ID_HAVING_CLAUSE:
276cdf0e10cSrcweir         case PROPERTY_ID_GROUP_BY:
277cdf0e10cSrcweir         case PROPERTY_ID_ORDER:
278cdf0e10cSrcweir         case PROPERTY_ID_UPDATE_CATALOGNAME:
279cdf0e10cSrcweir         case PROPERTY_ID_UPDATE_SCHEMANAME:
280cdf0e10cSrcweir         case PROPERTY_ID_UPDATE_TABLENAME:
281cdf0e10cSrcweir             _rDefault <<= ::rtl::OUString();
282cdf0e10cSrcweir             break;
283cdf0e10cSrcweir 	}
284cdf0e10cSrcweir }
285cdf0e10cSrcweir // -------------------------------------------------------------------------
286cdf0e10cSrcweir //	typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_Prop;
287cdf0e10cSrcweir 
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any & rValue)288cdf0e10cSrcweir void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
289cdf0e10cSrcweir {
290cdf0e10cSrcweir 	switch(nHandle)
291cdf0e10cSrcweir 	{
292cdf0e10cSrcweir 		case PROPERTY_ID_ISMODIFIED:
293cdf0e10cSrcweir 			m_bModified = cppu::any2bool(rValue);
294cdf0e10cSrcweir 			break;
295cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
296cdf0e10cSrcweir 			if( m_nResultSetType == ResultSetType::FORWARD_ONLY)
297cdf0e10cSrcweir 				throw Exception(); // else run through
298cdf0e10cSrcweir 		default:
299cdf0e10cSrcweir 			OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
300cdf0e10cSrcweir 	}
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     if  (   ( nHandle == PROPERTY_ID_ACTIVE_CONNECTION )
303cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_DATASOURCENAME )
304cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_COMMAND )
305cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_COMMAND_TYPE )
306cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_IGNORERESULT )
307cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_FILTER )
308cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_HAVING_CLAUSE )
309cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_GROUP_BY )
310cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_APPLYFILTER )
311cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_ORDER )
312cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_URL )
313cdf0e10cSrcweir         ||  ( nHandle == PROPERTY_ID_USER )
314cdf0e10cSrcweir         )
315cdf0e10cSrcweir     {
316cdf0e10cSrcweir         m_bCommandFacetsDirty = sal_True;
317cdf0e10cSrcweir     }
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	switch(nHandle)
321cdf0e10cSrcweir 	{
322cdf0e10cSrcweir 		case PROPERTY_ID_ACTIVE_CONNECTION:
323cdf0e10cSrcweir 			// the new connection
324cdf0e10cSrcweir 			{
325cdf0e10cSrcweir 				Reference< XConnection > xNewConnection(m_aActiveConnection,UNO_QUERY);
326cdf0e10cSrcweir 				setActiveConnection(xNewConnection, sal_False);
327cdf0e10cSrcweir 			}
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 			m_bOwnConnection		= sal_False;
330cdf0e10cSrcweir 			m_bRebuildConnOnExecute = sal_False;
331cdf0e10cSrcweir 			break;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 		case PROPERTY_ID_DATASOURCENAME:
334cdf0e10cSrcweir 			if(!m_xStatement.is())
335cdf0e10cSrcweir 			{
336cdf0e10cSrcweir 				Reference< XConnection >  xNewConn;
337cdf0e10cSrcweir 				Any aNewConn;
338cdf0e10cSrcweir 				aNewConn <<= xNewConn;
339cdf0e10cSrcweir 				setFastPropertyValue(PROPERTY_ID_ACTIVE_CONNECTION, aNewConn);
340cdf0e10cSrcweir 			}
341cdf0e10cSrcweir 			else
342cdf0e10cSrcweir 				m_bRebuildConnOnExecute = sal_True;
343cdf0e10cSrcweir 			break;
344cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
345cdf0e10cSrcweir 			if(m_pCache)
346cdf0e10cSrcweir 			{
347cdf0e10cSrcweir 				m_pCache->setFetchSize(m_nFetchSize);
348cdf0e10cSrcweir 				fireRowcount();
349cdf0e10cSrcweir 			}
350cdf0e10cSrcweir 			break;
351cdf0e10cSrcweir 		case PROPERTY_ID_URL:
352cdf0e10cSrcweir 			// is the connection-to-be-built determined by the url (which is the case if m_aDataSourceName is empty) ?
353cdf0e10cSrcweir 			if (!m_aDataSourceName.getLength())
354cdf0e10cSrcweir 			{
355cdf0e10cSrcweir 				// are we active at the moment ?
356cdf0e10cSrcweir 				if (m_xStatement.is())
357cdf0e10cSrcweir 					// yes -> the next execute needs to rebuild our connection because of this new property
358cdf0e10cSrcweir 					m_bRebuildConnOnExecute = sal_True;
359cdf0e10cSrcweir 				else
360cdf0e10cSrcweir 				{	// no -> drop our active connection (if we have one) as it doesn't correspond to this new property value anymore
361cdf0e10cSrcweir 					Reference< XConnection >  xNewConn;
362cdf0e10cSrcweir 					Any aNewConn;
363cdf0e10cSrcweir 					aNewConn <<= xNewConn;
364cdf0e10cSrcweir 					setFastPropertyValue(PROPERTY_ID_ACTIVE_CONNECTION, aNewConn);
365cdf0e10cSrcweir 				}
366cdf0e10cSrcweir 			}
367cdf0e10cSrcweir 			m_bOwnConnection = sal_True;
368cdf0e10cSrcweir 			break;
369cdf0e10cSrcweir 		case PROPERTY_ID_TYPEMAP:
370cdf0e10cSrcweir 			::cppu::extractInterface(m_xTypeMap,m_aTypeMap);
371cdf0e10cSrcweir 			break;
372cdf0e10cSrcweir 		default:
373cdf0e10cSrcweir 			break;
374cdf0e10cSrcweir 	};
375cdf0e10cSrcweir }
376cdf0e10cSrcweir // -------------------------------------------------------------------------
getFastPropertyValue(Any & rValue,sal_Int32 nHandle) const377cdf0e10cSrcweir void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
378cdf0e10cSrcweir {
379cdf0e10cSrcweir 	if(m_pCache)
380cdf0e10cSrcweir 	{
381cdf0e10cSrcweir 		switch(nHandle)
382cdf0e10cSrcweir 		{
383cdf0e10cSrcweir 		case PROPERTY_ID_ISMODIFIED:
384cdf0e10cSrcweir 			rValue.setValue(&m_bModified,::getCppuBooleanType());
385cdf0e10cSrcweir 			break;
386cdf0e10cSrcweir 		case PROPERTY_ID_ISNEW:
387cdf0e10cSrcweir 			rValue.setValue(&m_bNew,::getCppuBooleanType());
388cdf0e10cSrcweir 			break;
389cdf0e10cSrcweir 		case PROPERTY_ID_PRIVILEGES:
390cdf0e10cSrcweir 			rValue <<= m_pCache->m_nPrivileges;
391cdf0e10cSrcweir 			break;
392cdf0e10cSrcweir 		case PROPERTY_ID_ACTIVE_CONNECTION:
393cdf0e10cSrcweir 			rValue <<= m_xActiveConnection;
394cdf0e10cSrcweir 			break;
395cdf0e10cSrcweir 		case PROPERTY_ID_TYPEMAP:
396cdf0e10cSrcweir 			rValue <<= m_xTypeMap;
397cdf0e10cSrcweir 			break;
398cdf0e10cSrcweir 		default:
399cdf0e10cSrcweir 			ORowSetBase::getFastPropertyValue(rValue,nHandle);
400cdf0e10cSrcweir 		};
401cdf0e10cSrcweir 	}
402cdf0e10cSrcweir 	else
403cdf0e10cSrcweir 	{
404cdf0e10cSrcweir 		switch(nHandle)
405cdf0e10cSrcweir 		{
406cdf0e10cSrcweir 			case PROPERTY_ID_ACTIVE_CONNECTION:
407cdf0e10cSrcweir 				rValue <<= m_xActiveConnection;
408cdf0e10cSrcweir 				break;
409cdf0e10cSrcweir 			case PROPERTY_ID_TYPEMAP:
410cdf0e10cSrcweir 				rValue <<= m_xTypeMap;
411cdf0e10cSrcweir 				break;
412cdf0e10cSrcweir 			default:
413cdf0e10cSrcweir 				ORowSetBase::getFastPropertyValue(rValue,nHandle);
414cdf0e10cSrcweir 		}
415cdf0e10cSrcweir 	}
416cdf0e10cSrcweir }
417cdf0e10cSrcweir // -------------------------------------------------------------------------
418cdf0e10cSrcweir // com::sun::star::XTypeProvider
getTypes()419cdf0e10cSrcweir Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException)
420cdf0e10cSrcweir {
421cdf0e10cSrcweir 	OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
422cdf0e10cSrcweir 							::getCppuType( (const Reference< XFastPropertySet > *)0 ),
423cdf0e10cSrcweir 							::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
424cdf0e10cSrcweir 						   ::comphelper::concatSequences(ORowSet_BASE1::getTypes(),ORowSetBase::getTypes()));
425cdf0e10cSrcweir 	return aTypes.getTypes();
426cdf0e10cSrcweir }
427cdf0e10cSrcweir // -------------------------------------------------------------------------
getImplementationId()428cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeException)
429cdf0e10cSrcweir {
430cdf0e10cSrcweir 	static OImplementationId * pId = 0;
431cdf0e10cSrcweir 	if (! pId)
432cdf0e10cSrcweir 	{
433cdf0e10cSrcweir 		MutexGuard aGuard( Mutex::getGlobalMutex() );
434cdf0e10cSrcweir 		if (! pId)
435cdf0e10cSrcweir 		{
436cdf0e10cSrcweir 			static OImplementationId aId;
437cdf0e10cSrcweir 			pId = &aId;
438cdf0e10cSrcweir 		}
439cdf0e10cSrcweir 	}
440cdf0e10cSrcweir 	return pId->getImplementationId();
441cdf0e10cSrcweir }
442cdf0e10cSrcweir // -------------------------------------------------------------------------
443cdf0e10cSrcweir 
444cdf0e10cSrcweir // com::sun::star::XInterface
queryInterface(const Type & rType)445cdf0e10cSrcweir Any SAL_CALL ORowSet::queryInterface( const Type & rType ) throw (RuntimeException)
446cdf0e10cSrcweir {
447cdf0e10cSrcweir 	return ORowSet_BASE1::queryInterface( rType);
448cdf0e10cSrcweir }
449cdf0e10cSrcweir // -------------------------------------------------------------------------
acquire()450cdf0e10cSrcweir void SAL_CALL ORowSet::acquire() throw()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	ORowSet_BASE1::acquire();
453cdf0e10cSrcweir }
454cdf0e10cSrcweir // -------------------------------------------------------------------------
release()455cdf0e10cSrcweir void SAL_CALL ORowSet::release() throw()
456cdf0e10cSrcweir {
457cdf0e10cSrcweir 	ORowSet_BASE1::release();
458cdf0e10cSrcweir }
459cdf0e10cSrcweir // -------------------------------------------------------------------------
460cdf0e10cSrcweir 
461cdf0e10cSrcweir // com::sun::star::XUnoTunnel
getSomething(const Sequence<sal_Int8> & rId)462cdf0e10cSrcweir sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
463cdf0e10cSrcweir {
464cdf0e10cSrcweir 	if (rId.getLength() == 16 && 0 == rtl_compareMemory(getImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
465cdf0e10cSrcweir 		return reinterpret_cast<sal_Int64>(this);
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	return 0;
468cdf0e10cSrcweir }
469cdf0e10cSrcweir // -------------------------------------------------------------------------
470cdf0e10cSrcweir // com::sun::star::XAggregation
queryAggregation(const Type & rType)471cdf0e10cSrcweir Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeException)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir 	Any aRet(ORowSetBase::queryInterface(rType));
474cdf0e10cSrcweir 	if (!aRet.hasValue())
475cdf0e10cSrcweir 		aRet = ORowSet_BASE1::queryAggregation(rType);
476cdf0e10cSrcweir 	return aRet;
477cdf0e10cSrcweir }
478cdf0e10cSrcweir //------------------------------------------------------------------------------
getImplementationName_static()479cdf0e10cSrcweir rtl::OUString ORowSet::getImplementationName_static(  ) throw(RuntimeException)
480cdf0e10cSrcweir {
481cdf0e10cSrcweir 	return rtl::OUString::createFromAscii("com.sun.star.comp.dba.ORowSet");
482cdf0e10cSrcweir }
483cdf0e10cSrcweir // -------------------------------------------------------------------------
484cdf0e10cSrcweir // ::com::sun::star::XServiceInfo
getImplementationName()485cdf0e10cSrcweir ::rtl::OUString SAL_CALL ORowSet::getImplementationName(  ) throw(RuntimeException)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir 	return getImplementationName_static();
488cdf0e10cSrcweir }
489cdf0e10cSrcweir // -------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)490cdf0e10cSrcweir sal_Bool SAL_CALL ORowSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
491cdf0e10cSrcweir {
492cdf0e10cSrcweir 	return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
493cdf0e10cSrcweir }
494cdf0e10cSrcweir //------------------------------------------------------------------------------
getSupportedServiceNames_static()495cdf0e10cSrcweir Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static(  ) throw (RuntimeException)
496cdf0e10cSrcweir {
497cdf0e10cSrcweir 	Sequence< rtl::OUString > aSNS( 5 );
498cdf0e10cSrcweir 	aSNS[0] = SERVICE_SDBC_RESULTSET;
499cdf0e10cSrcweir 	aSNS[1] = SERVICE_SDBC_ROWSET;
500cdf0e10cSrcweir 	aSNS[2] = SERVICE_SDBCX_RESULTSET;
501cdf0e10cSrcweir 	aSNS[3] = SERVICE_SDB_RESULTSET;
502cdf0e10cSrcweir 	aSNS[4] = SERVICE_SDB_ROWSET;
503cdf0e10cSrcweir 	return aSNS;
504cdf0e10cSrcweir }
505cdf0e10cSrcweir // -------------------------------------------------------------------------
getSupportedServiceNames()506cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL ORowSet::getSupportedServiceNames(  ) throw(RuntimeException)
507cdf0e10cSrcweir {
508cdf0e10cSrcweir 	return getSupportedServiceNames_static();
509cdf0e10cSrcweir }
510cdf0e10cSrcweir //------------------------------------------------------------------------------
Create(const Reference<XComponentContext> & _rxContext)511cdf0e10cSrcweir Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _rxContext)
512cdf0e10cSrcweir {
513cdf0e10cSrcweir     ::comphelper::ComponentContext aContext( _rxContext );
514cdf0e10cSrcweir 	return ORowSet_CreateInstance( aContext.getLegacyServiceFactory() );
515cdf0e10cSrcweir }
516cdf0e10cSrcweir // -------------------------------------------------------------------------
517cdf0e10cSrcweir // OComponentHelper
disposing()518cdf0e10cSrcweir void SAL_CALL ORowSet::disposing()
519cdf0e10cSrcweir {
520cdf0e10cSrcweir 	OPropertyStateContainer::disposing();
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
523cdf0e10cSrcweir 	EventObject aDisposeEvent;
524cdf0e10cSrcweir 	aDisposeEvent.Source = static_cast< XComponent* >(this);
525cdf0e10cSrcweir 	m_aRowsetListeners.disposeAndClear( aDisposeEvent );
526cdf0e10cSrcweir 	m_aApproveListeners.disposeAndClear( aDisposeEvent );
527cdf0e10cSrcweir     m_aRowsChangeListener.disposeAndClear( aDisposeEvent );
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 	freeResources( true );
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 	// remove myself as dispose listener
532cdf0e10cSrcweir 	Reference< XComponent >  xComponent(m_xActiveConnection, UNO_QUERY);
533cdf0e10cSrcweir 	if (xComponent.is())
534cdf0e10cSrcweir 	{
535cdf0e10cSrcweir 		Reference<XEventListener> xEvt;
536cdf0e10cSrcweir 		query_aggregation(this,xEvt);
537cdf0e10cSrcweir 		xComponent->removeEventListener(xEvt);
538cdf0e10cSrcweir 	}
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 	m_aActiveConnection = Any(); // the any conatains a reference too
541cdf0e10cSrcweir 	if(m_bOwnConnection)
542cdf0e10cSrcweir 		::comphelper::disposeComponent(m_xActiveConnection);
543cdf0e10cSrcweir 	m_xActiveConnection = NULL;
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 	ORowSetBase::disposing();
547cdf0e10cSrcweir }
548cdf0e10cSrcweir // -------------------------------------------------------------------------
freeResources(bool _bComplete)549cdf0e10cSrcweir void ORowSet::freeResources( bool _bComplete )
550cdf0e10cSrcweir {
551cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
552cdf0e10cSrcweir 
553cdf0e10cSrcweir 	// free all clones
554cdf0e10cSrcweir     connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
555cdf0e10cSrcweir 	for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
556cdf0e10cSrcweir 	{
557cdf0e10cSrcweir 		Reference< XComponent > xComp(i->get(), UNO_QUERY);
558cdf0e10cSrcweir 		if (xComp.is())
559cdf0e10cSrcweir 			xComp->dispose();
560cdf0e10cSrcweir 	}
561cdf0e10cSrcweir 	m_aClones.clear();
562cdf0e10cSrcweir 
563cdf0e10cSrcweir     if ( _bComplete )
564cdf0e10cSrcweir 	{
565cdf0e10cSrcweir 		// the columns must be disposed before the querycomposer is disposed because
566cdf0e10cSrcweir 		// their owner can be the composer
567cdf0e10cSrcweir 		TDataColumns().swap(m_aDataColumns);// clear and resize capacity
568*d7b348a9SDamjan Jovanovic 		m_aReadOnlyDataColumns.clear();
569cdf0e10cSrcweir 		m_xColumns		= NULL;
570cdf0e10cSrcweir 		if ( m_pColumns )
571cdf0e10cSrcweir 			m_pColumns->disposing();
572cdf0e10cSrcweir 		// dispose the composer to avoid that everbody knows that the querycomposer is eol
573cdf0e10cSrcweir 		try { ::comphelper::disposeComponent( m_xComposer ); }
574cdf0e10cSrcweir 		catch(Exception&)
575cdf0e10cSrcweir 		{
576cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
577cdf0e10cSrcweir 			m_xComposer = NULL;
578cdf0e10cSrcweir 		}
579cdf0e10cSrcweir 
580cdf0e10cSrcweir         // let our warnings container forget the reference to the (possibly disposed) old result set
581cdf0e10cSrcweir         m_aWarnings.setExternalWarnings( NULL );
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 		DELETEZ(m_pCache);
584cdf0e10cSrcweir 
585cdf0e10cSrcweir         impl_resetTables_nothrow();
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 		m_xStatement	= NULL;
588cdf0e10cSrcweir 		m_xTypeMap		= NULL;
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 		m_aBookmark		= Any();
591cdf0e10cSrcweir 		m_bBeforeFirst	= sal_True;
592cdf0e10cSrcweir 		m_bAfterLast	= sal_False;
593cdf0e10cSrcweir 		m_bNew			= sal_False;
594cdf0e10cSrcweir 		m_bModified		= sal_False;
595cdf0e10cSrcweir 		m_bIsInsertRow	= sal_False;
596cdf0e10cSrcweir 		m_bLastKnownRowCountFinal = sal_False;
597cdf0e10cSrcweir         m_nLastKnownRowCount      = 0;
598cdf0e10cSrcweir 		if ( m_aOldRow.isValid() )
599cdf0e10cSrcweir 			m_aOldRow->clearRow();
600cdf0e10cSrcweir 
601cdf0e10cSrcweir         impl_disposeParametersContainer_nothrow();
602cdf0e10cSrcweir 
603cdf0e10cSrcweir         m_bCommandFacetsDirty = sal_True;
604cdf0e10cSrcweir 	}
605cdf0e10cSrcweir }
606cdf0e10cSrcweir 
607cdf0e10cSrcweir // -------------------------------------------------------------------------
setActiveConnection(Reference<XConnection> & _rxNewConn,sal_Bool _bFireEvent)608cdf0e10cSrcweir void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Bool _bFireEvent )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir 	if (_rxNewConn.get() == m_xActiveConnection.get())
611cdf0e10cSrcweir 		// nothing to do
612cdf0e10cSrcweir 		return;
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	// remove the event listener for the old connection
615cdf0e10cSrcweir 	Reference< XComponent >  xComponent(m_xActiveConnection, UNO_QUERY);
616cdf0e10cSrcweir 	if (xComponent.is())
617cdf0e10cSrcweir 	{
618cdf0e10cSrcweir 		Reference<XEventListener> xListener;
619cdf0e10cSrcweir 		query_aggregation(this, xListener);
620cdf0e10cSrcweir 		xComponent->removeEventListener(xListener);
621cdf0e10cSrcweir 	}
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	// if we owned the connection, remember it for later disposing
624cdf0e10cSrcweir 	if(m_bOwnConnection)
625cdf0e10cSrcweir 		m_xOldConnection = m_xActiveConnection;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 	// for firing the PropertyChangeEvent
628cdf0e10cSrcweir 	sal_Int32 nHandle = PROPERTY_ID_ACTIVE_CONNECTION;
629cdf0e10cSrcweir 	Any aOldConnection; aOldConnection <<= m_xActiveConnection;
630cdf0e10cSrcweir 	Any aNewConnection; aNewConnection <<= _rxNewConn;
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 	// set the new connection
633cdf0e10cSrcweir 	m_xActiveConnection = _rxNewConn;
634cdf0e10cSrcweir 	if (m_xActiveConnection.is())
635cdf0e10cSrcweir 		m_aActiveConnection <<= m_xActiveConnection;
636cdf0e10cSrcweir 	else
637cdf0e10cSrcweir 		m_aActiveConnection.clear();
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 	// fire the event
640cdf0e10cSrcweir 	if (_bFireEvent)
641cdf0e10cSrcweir 		fire(&nHandle, &aNewConnection, &aOldConnection, 1, sal_False);
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 	// register as event listener for the new connection
644cdf0e10cSrcweir 	xComponent.set(m_xActiveConnection,UNO_QUERY);
645cdf0e10cSrcweir 	if (xComponent.is())
646cdf0e10cSrcweir 	{
647cdf0e10cSrcweir 		Reference<XEventListener> xListener;
648cdf0e10cSrcweir 		query_aggregation(this, xListener);
649cdf0e10cSrcweir 		xComponent->addEventListener(xListener);
650cdf0e10cSrcweir 	}
651cdf0e10cSrcweir }
652cdf0e10cSrcweir 
653cdf0e10cSrcweir // -------------------------------------------------------------------------
654cdf0e10cSrcweir // ::com::sun::star::XEventListener
disposing(const::com::sun::star::lang::EventObject & Source)655cdf0e10cSrcweir void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException)
656cdf0e10cSrcweir {
657cdf0e10cSrcweir 	// close rowset because the connection is going to be deleted (someone told me :-)
658cdf0e10cSrcweir 	Reference<XConnection> xCon(Source.Source,UNO_QUERY);
659cdf0e10cSrcweir 	if(m_xActiveConnection == xCon)
660cdf0e10cSrcweir 	{
661cdf0e10cSrcweir 		close();
662cdf0e10cSrcweir 		{
663cdf0e10cSrcweir 			MutexGuard aGuard( m_aMutex );
664cdf0e10cSrcweir             Reference< XConnection > xXConnection;
665cdf0e10cSrcweir 			setActiveConnection( xXConnection );
666cdf0e10cSrcweir 		}
667cdf0e10cSrcweir 	}
668cdf0e10cSrcweir }
669cdf0e10cSrcweir // -------------------------------------------------------------------------
670cdf0e10cSrcweir 
671cdf0e10cSrcweir // XCloseable
close()672cdf0e10cSrcweir void SAL_CALL ORowSet::close(  ) throw(SQLException, RuntimeException)
673cdf0e10cSrcweir {
674cdf0e10cSrcweir 	{
675cdf0e10cSrcweir 		MutexGuard aGuard( m_aMutex );
676cdf0e10cSrcweir 		::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
677cdf0e10cSrcweir 	}
678cdf0e10cSrcweir 	// additionals things to set
679cdf0e10cSrcweir 	freeResources( true );
680cdf0e10cSrcweir }
681cdf0e10cSrcweir // -------------------------------------------------------------------------
682cdf0e10cSrcweir // comphelper::OPropertyArrayUsageHelper
createArrayHelper() const683cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* ORowSet::createArrayHelper( ) const
684cdf0e10cSrcweir {
685cdf0e10cSrcweir 	Sequence< Property > aProps;
686cdf0e10cSrcweir 	describeProperties(aProps);
687cdf0e10cSrcweir 	return new ::cppu::OPropertyArrayHelper(aProps);
688cdf0e10cSrcweir }
689cdf0e10cSrcweir // -------------------------------------------------------------------------
690cdf0e10cSrcweir // cppu::OPropertySetHelper
getInfoHelper()691cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL ORowSet::getInfoHelper()
692cdf0e10cSrcweir {
693cdf0e10cSrcweir 	typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_PROP;
694cdf0e10cSrcweir 	return *ORowSet_PROP::getArrayHelper();
695cdf0e10cSrcweir }
696cdf0e10cSrcweir // -----------------------------------------------------------------------------
updateValue(sal_Int32 columnIndex,const ORowSetValue & x)697cdf0e10cSrcweir void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
698cdf0e10cSrcweir {
699cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
702cdf0e10cSrcweir 	checkUpdateConditions(columnIndex);
703cdf0e10cSrcweir 	checkUpdateIterator();
704cdf0e10cSrcweir 
705cdf0e10cSrcweir     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
706cdf0e10cSrcweir     ORowSetNotifier aNotify(this,rRow);
707cdf0e10cSrcweir     m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns());
708cdf0e10cSrcweir 	m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
709cdf0e10cSrcweir     aNotify.firePropertyChange();
710cdf0e10cSrcweir }
711cdf0e10cSrcweir // -------------------------------------------------------------------------
712cdf0e10cSrcweir // XRowUpdate
updateNull(sal_Int32 columnIndex)713cdf0e10cSrcweir void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
714cdf0e10cSrcweir {
715cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
716cdf0e10cSrcweir 
717cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
718cdf0e10cSrcweir 	checkUpdateConditions(columnIndex);
719cdf0e10cSrcweir 	checkUpdateIterator();
720cdf0e10cSrcweir 
721cdf0e10cSrcweir     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
722cdf0e10cSrcweir     ORowSetNotifier aNotify(this,rRow);
723cdf0e10cSrcweir 	m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns());
724cdf0e10cSrcweir 	m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
725cdf0e10cSrcweir     aNotify.firePropertyChange();
726cdf0e10cSrcweir }
727cdf0e10cSrcweir // -------------------------------------------------------------------------
updateBoolean(sal_Int32 columnIndex,sal_Bool x)728cdf0e10cSrcweir void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
729cdf0e10cSrcweir {
730cdf0e10cSrcweir 	updateValue(columnIndex,x);
731cdf0e10cSrcweir }
732cdf0e10cSrcweir // -------------------------------------------------------------------------
updateByte(sal_Int32 columnIndex,sal_Int8 x)733cdf0e10cSrcweir void SAL_CALL ORowSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
734cdf0e10cSrcweir {
735cdf0e10cSrcweir 	updateValue(columnIndex,x);
736cdf0e10cSrcweir }
737cdf0e10cSrcweir // -------------------------------------------------------------------------
updateShort(sal_Int32 columnIndex,sal_Int16 x)738cdf0e10cSrcweir void SAL_CALL ORowSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
739cdf0e10cSrcweir {
740cdf0e10cSrcweir 	updateValue(columnIndex,x);
741cdf0e10cSrcweir }
742cdf0e10cSrcweir // -------------------------------------------------------------------------
updateInt(sal_Int32 columnIndex,sal_Int32 x)743cdf0e10cSrcweir void SAL_CALL ORowSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
744cdf0e10cSrcweir {
745cdf0e10cSrcweir 	updateValue(columnIndex,x);
746cdf0e10cSrcweir }
747cdf0e10cSrcweir // -------------------------------------------------------------------------
updateLong(sal_Int32 columnIndex,sal_Int64 x)748cdf0e10cSrcweir void SAL_CALL ORowSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
749cdf0e10cSrcweir {
750cdf0e10cSrcweir 	updateValue(columnIndex,x);
751cdf0e10cSrcweir }
752cdf0e10cSrcweir // -------------------------------------------------------------------------
updateFloat(sal_Int32 columnIndex,float x)753cdf0e10cSrcweir void SAL_CALL ORowSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
754cdf0e10cSrcweir {
755cdf0e10cSrcweir 	updateValue(columnIndex,x);
756cdf0e10cSrcweir }
757cdf0e10cSrcweir // -------------------------------------------------------------------------
updateDouble(sal_Int32 columnIndex,double x)758cdf0e10cSrcweir void SAL_CALL ORowSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
759cdf0e10cSrcweir {
760cdf0e10cSrcweir 	updateValue(columnIndex,x);
761cdf0e10cSrcweir }
762cdf0e10cSrcweir // -------------------------------------------------------------------------
updateString(sal_Int32 columnIndex,const::rtl::OUString & x)763cdf0e10cSrcweir void SAL_CALL ORowSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
764cdf0e10cSrcweir {
765cdf0e10cSrcweir 	updateValue(columnIndex,x);
766cdf0e10cSrcweir }
767cdf0e10cSrcweir // -------------------------------------------------------------------------
updateBytes(sal_Int32 columnIndex,const Sequence<sal_Int8> & x)768cdf0e10cSrcweir void SAL_CALL ORowSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
769cdf0e10cSrcweir {
770cdf0e10cSrcweir 	updateValue(columnIndex,x);
771cdf0e10cSrcweir }
772cdf0e10cSrcweir // -------------------------------------------------------------------------
updateDate(sal_Int32 columnIndex,const::com::sun::star::util::Date & x)773cdf0e10cSrcweir void SAL_CALL ORowSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
774cdf0e10cSrcweir {
775cdf0e10cSrcweir 	updateValue(columnIndex,x);
776cdf0e10cSrcweir }
777cdf0e10cSrcweir // -------------------------------------------------------------------------
updateTime(sal_Int32 columnIndex,const::com::sun::star::util::Time & x)778cdf0e10cSrcweir void SAL_CALL ORowSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
779cdf0e10cSrcweir {
780cdf0e10cSrcweir 	updateValue(columnIndex,x);
781cdf0e10cSrcweir }
782cdf0e10cSrcweir // -------------------------------------------------------------------------
updateTimestamp(sal_Int32 columnIndex,const::com::sun::star::util::DateTime & x)783cdf0e10cSrcweir void SAL_CALL ORowSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
784cdf0e10cSrcweir {
785cdf0e10cSrcweir 	updateValue(columnIndex,x);
786cdf0e10cSrcweir }
787cdf0e10cSrcweir // -------------------------------------------------------------------------
updateBinaryStream(sal_Int32 columnIndex,const Reference<::com::sun::star::io::XInputStream> & x,sal_Int32 length)788cdf0e10cSrcweir void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
789cdf0e10cSrcweir {
790cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
791cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
792cdf0e10cSrcweir 	checkUpdateConditions(columnIndex);
793cdf0e10cSrcweir 	checkUpdateIterator();
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 	//if(((*m_aCurrentRow)->get())[columnIndex].getTypeKind() == DataType::BLOB)
796cdf0e10cSrcweir 	//{
797cdf0e10cSrcweir  //       ::connectivity::ORowSetValue aOldValue = ((*m_aCurrentRow)->get())[columnIndex];
798cdf0e10cSrcweir 	//	m_pCache->updateBinaryStream(columnIndex,x,length);
799cdf0e10cSrcweir 	//	((*m_aCurrentRow)->get())[columnIndex] = makeAny(x);
800cdf0e10cSrcweir  //       ((*m_aCurrentRow)->get())[columnIndex].setTypeKind(DataType::BLOB);
801cdf0e10cSrcweir  //       firePropertyChange(columnIndex-1 ,aOldValue);
802cdf0e10cSrcweir 	//    fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False);
803cdf0e10cSrcweir 	//}
804cdf0e10cSrcweir 	//else
805cdf0e10cSrcweir 	{
806cdf0e10cSrcweir 		Sequence<sal_Int8> aSeq;
807cdf0e10cSrcweir 		if(x.is())
808cdf0e10cSrcweir 			x->readBytes(aSeq,length);
809cdf0e10cSrcweir 		updateValue(columnIndex,aSeq);
810cdf0e10cSrcweir 	}
811cdf0e10cSrcweir }
812cdf0e10cSrcweir // -------------------------------------------------------------------------
updateCharacterStream(sal_Int32 columnIndex,const Reference<::com::sun::star::io::XInputStream> & x,sal_Int32 length)813cdf0e10cSrcweir void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
814cdf0e10cSrcweir {
815cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
816cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
817cdf0e10cSrcweir 	checkUpdateConditions(columnIndex);
818cdf0e10cSrcweir 	checkUpdateIterator();
819cdf0e10cSrcweir     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
820cdf0e10cSrcweir     ORowSetNotifier aNotify(this,rRow);
821cdf0e10cSrcweir 	m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns());
822cdf0e10cSrcweir 	m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
823cdf0e10cSrcweir     aNotify.firePropertyChange();
824cdf0e10cSrcweir }
825cdf0e10cSrcweir // -------------------------------------------------------------------------
updateObject(sal_Int32 columnIndex,const Any & x)826cdf0e10cSrcweir void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
827cdf0e10cSrcweir {
828cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
829cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
830cdf0e10cSrcweir 	checkUpdateConditions(columnIndex);
831cdf0e10cSrcweir 	checkUpdateIterator();
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 	Any aNewValue = x;
834cdf0e10cSrcweir 
835cdf0e10cSrcweir 	if ( m_pColumns )
836cdf0e10cSrcweir 	{
837cdf0e10cSrcweir 		Reference<XPropertySet> xColumn(m_pColumns->getByIndex(columnIndex-1),UNO_QUERY);
838cdf0e10cSrcweir 		sal_Int32 nColType = 0;
839cdf0e10cSrcweir 		xColumn->getPropertyValue(PROPERTY_TYPE) >>= nColType;
840cdf0e10cSrcweir 		switch( nColType )
841cdf0e10cSrcweir 		{
842cdf0e10cSrcweir 			case DataType::DATE:
843cdf0e10cSrcweir 			case DataType::TIME:
844cdf0e10cSrcweir 			case DataType::TIMESTAMP:
845cdf0e10cSrcweir 			{
846cdf0e10cSrcweir 				double nValue = 0;
847cdf0e10cSrcweir 				if ( x >>= nValue )
848cdf0e10cSrcweir 				{
849cdf0e10cSrcweir 					if ( DataType::TIMESTAMP == nColType )
850cdf0e10cSrcweir 						aNewValue <<= dbtools::DBTypeConversion::toDateTime( nValue );
851cdf0e10cSrcweir 					else if ( DataType::DATE == nColType )
852cdf0e10cSrcweir 						aNewValue <<= dbtools::DBTypeConversion::toDate( nValue );
853cdf0e10cSrcweir 					else
854cdf0e10cSrcweir 						aNewValue <<= dbtools::DBTypeConversion::toTime( nValue );
855cdf0e10cSrcweir 				}
856cdf0e10cSrcweir 				break;
857cdf0e10cSrcweir 			}
858cdf0e10cSrcweir 		}
859cdf0e10cSrcweir 	}
860cdf0e10cSrcweir 
861cdf0e10cSrcweir 	if (!::dbtools::implUpdateObject(this, columnIndex, aNewValue))
862cdf0e10cSrcweir 	{	// there is no other updateXXX call which can handle the value in x
863cdf0e10cSrcweir         ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
864cdf0e10cSrcweir         ORowSetNotifier aNotify(this,rRow);
865cdf0e10cSrcweir 		m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns());
866cdf0e10cSrcweir 		m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
867cdf0e10cSrcweir         aNotify.firePropertyChange();
868cdf0e10cSrcweir 	}
869cdf0e10cSrcweir }
870cdf0e10cSrcweir // -------------------------------------------------------------------------
updateNumericObject(sal_Int32 columnIndex,const Any & x,sal_Int32 scale)871cdf0e10cSrcweir void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException)
872cdf0e10cSrcweir {
873cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
874cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
875cdf0e10cSrcweir 	checkUpdateConditions(columnIndex);
876cdf0e10cSrcweir 	checkUpdateIterator();
877cdf0e10cSrcweir     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
878cdf0e10cSrcweir     ORowSetNotifier aNotify(this,rRow);
879cdf0e10cSrcweir 	m_pCache->updateNumericObject(columnIndex,x,scale,rRow,aNotify.getChangedColumns());
880cdf0e10cSrcweir 	m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
881cdf0e10cSrcweir     aNotify.firePropertyChange();
882cdf0e10cSrcweir }
883cdf0e10cSrcweir // -------------------------------------------------------------------------
884cdf0e10cSrcweir 
885cdf0e10cSrcweir // XResultSetUpdate
insertRow()886cdf0e10cSrcweir void SAL_CALL ORowSet::insertRow(  ) throw(SQLException, RuntimeException)
887cdf0e10cSrcweir {
888cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
889cdf0e10cSrcweir 	// insertRow is not allowd when
890cdf0e10cSrcweir 	// standing not on the insert row nor
891cdf0e10cSrcweir 	// when the row isn't modified
892cdf0e10cSrcweir 	// or the concurency is read only
893cdf0e10cSrcweir 	::osl::ResettableMutexGuard aGuard( *m_pMutex );
894cdf0e10cSrcweir 
895cdf0e10cSrcweir 	if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
896cdf0e10cSrcweir 		throwFunctionSequenceException(*this);
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 	// remember old value for fire
899cdf0e10cSrcweir 	sal_Bool bOld = m_bNew;
900cdf0e10cSrcweir 
901cdf0e10cSrcweir 	ORowSetRow aOldValues;
902cdf0e10cSrcweir 	if ( !m_aCurrentRow.isNull() )
903cdf0e10cSrcweir 		aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() );
904cdf0e10cSrcweir     Sequence<Any> aChangedBookmarks;
905cdf0e10cSrcweir 	RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks);
906cdf0e10cSrcweir 	notifyAllListenersRowBeforeChange(aGuard,aEvt);
907cdf0e10cSrcweir 
908cdf0e10cSrcweir     ::std::vector< Any > aBookmarks;
909cdf0e10cSrcweir 	sal_Bool bInserted = m_pCache->insertRow(aBookmarks);
910cdf0e10cSrcweir 
911cdf0e10cSrcweir     // make sure that our row is set to the new inserted row before clearing the insert flags in the cache
912cdf0e10cSrcweir     m_pCache->resetInsertRow(bInserted);
913cdf0e10cSrcweir 
914cdf0e10cSrcweir 	// notification order
915cdf0e10cSrcweir 	// - column values
916cdf0e10cSrcweir 	setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here
917cdf0e10cSrcweir 
918cdf0e10cSrcweir     // read-only flag restored
919cdf0e10cSrcweir     impl_restoreDataColumnsWriteable_throw();
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 	// - rowChanged
922cdf0e10cSrcweir 	notifyAllListenersRowChanged(aGuard,aEvt);
923cdf0e10cSrcweir 
924cdf0e10cSrcweir     if ( !aBookmarks.empty() )
925cdf0e10cSrcweir     {
926cdf0e10cSrcweir         RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()));
927cdf0e10cSrcweir         notifyAllListenersRowChanged(aGuard,aUpEvt);
928cdf0e10cSrcweir     }
929cdf0e10cSrcweir 
930cdf0e10cSrcweir 	// - IsModified
931cdf0e10cSrcweir 	if(!m_bModified)
932cdf0e10cSrcweir 		fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
933cdf0e10cSrcweir 	OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" );
934cdf0e10cSrcweir 
935cdf0e10cSrcweir 	// - IsNew
936cdf0e10cSrcweir 	if(m_bNew != bOld)
937cdf0e10cSrcweir 		fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld);
938cdf0e10cSrcweir 
939cdf0e10cSrcweir 	// - RowCount/IsRowCountFinal
940cdf0e10cSrcweir 	fireRowcount();
941cdf0e10cSrcweir }
942cdf0e10cSrcweir // -------------------------------------------------------------------------
getRow()943cdf0e10cSrcweir sal_Int32 SAL_CALL ORowSet::getRow(  ) throw(SQLException, RuntimeException)
944cdf0e10cSrcweir {
945cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
946cdf0e10cSrcweir 	checkCache();
947cdf0e10cSrcweir 
948cdf0e10cSrcweir 	// check if we are inserting a row
949cdf0e10cSrcweir 	return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow();
950cdf0e10cSrcweir }
951cdf0e10cSrcweir // -------------------------------------------------------------------------
updateRow()952cdf0e10cSrcweir void SAL_CALL ORowSet::updateRow(  ) throw(SQLException, RuntimeException)
953cdf0e10cSrcweir {
954cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
955cdf0e10cSrcweir 	// not allowed when standing on insert row
956cdf0e10cSrcweir 	::osl::ResettableMutexGuard aGuard( *m_pMutex );
957cdf0e10cSrcweir 	if ( !m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY || m_bNew || ((m_pCache->m_nPrivileges & Privilege::UPDATE ) != Privilege::UPDATE) )
958cdf0e10cSrcweir 		throwFunctionSequenceException(*this);
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 
961cdf0e10cSrcweir 	if(m_bModified)
962cdf0e10cSrcweir 	{
963cdf0e10cSrcweir 		ORowSetRow aOldValues;
964cdf0e10cSrcweir 		if ( !m_aCurrentRow.isNull() )
965cdf0e10cSrcweir 			aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() );
966cdf0e10cSrcweir 
967cdf0e10cSrcweir         Sequence<Any> aChangedBookmarks;
968cdf0e10cSrcweir 		RowsChangeEvent aEvt(*this,RowChangeAction::UPDATE,1,aChangedBookmarks);
969cdf0e10cSrcweir 		notifyAllListenersRowBeforeChange(aGuard,aEvt);
970cdf0e10cSrcweir 
971cdf0e10cSrcweir         ::std::vector< Any > aBookmarks;
972cdf0e10cSrcweir         m_pCache->updateRow(m_aCurrentRow.operator ->(),aBookmarks);
973cdf0e10cSrcweir         if ( !aBookmarks.empty() )
974cdf0e10cSrcweir             aEvt.Bookmarks = Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size());
975cdf0e10cSrcweir         aEvt.Rows += aBookmarks.size();
976cdf0e10cSrcweir 		m_aBookmark		= m_pCache->getBookmark();
977cdf0e10cSrcweir 		m_aCurrentRow	= m_pCache->m_aMatrixIter;
978cdf0e10cSrcweir 		m_bIsInsertRow	= sal_False;
979cdf0e10cSrcweir         if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).isValid() )
980cdf0e10cSrcweir         {
981cdf0e10cSrcweir             if ( m_pCache->isResultSetChanged() )
982cdf0e10cSrcweir             {
983cdf0e10cSrcweir                 impl_rebuild_throw(aGuard);
984cdf0e10cSrcweir             }
985cdf0e10cSrcweir             else
986cdf0e10cSrcweir             {
987cdf0e10cSrcweir 		        m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody()));
988cdf0e10cSrcweir 
989cdf0e10cSrcweir 		        // notification order
990cdf0e10cSrcweir 		        // - column values
991cdf0e10cSrcweir 		        ORowSetBase::firePropertyChange(aOldValues);
992cdf0e10cSrcweir             }
993cdf0e10cSrcweir             // - rowChanged
994cdf0e10cSrcweir 	        notifyAllListenersRowChanged(aGuard,aEvt);
995cdf0e10cSrcweir 
996cdf0e10cSrcweir 	        // - IsModified
997cdf0e10cSrcweir 	        if(!m_bModified)
998cdf0e10cSrcweir 		        fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
999cdf0e10cSrcweir 	        OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" );
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir             // - RowCount/IsRowCountFinal
1002cdf0e10cSrcweir 	        fireRowcount();
1003cdf0e10cSrcweir         }
1004cdf0e10cSrcweir         else if ( !m_bAfterLast ) // the update went rong
1005cdf0e10cSrcweir         {
1006cdf0e10cSrcweir             ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), SQL_INVALID_CURSOR_POSITION, *this );
1007cdf0e10cSrcweir         }
1008cdf0e10cSrcweir 	}
1009cdf0e10cSrcweir }
1010cdf0e10cSrcweir // -------------------------------------------------------------------------
deleteRow()1011cdf0e10cSrcweir void SAL_CALL ORowSet::deleteRow(  ) throw(SQLException, RuntimeException)
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir 	::osl::ResettableMutexGuard aGuard( *m_pMutex );
1016cdf0e10cSrcweir     checkCache();
1017cdf0e10cSrcweir 
1018cdf0e10cSrcweir 	if ( m_bBeforeFirst || m_bAfterLast )
1019cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_BEFORE_AFTER ), SQL_INVALID_CURSOR_POSITION, *this );
1020cdf0e10cSrcweir     if ( m_bNew )
1021cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_INSERT_ROW ), SQL_INVALID_CURSOR_POSITION, *this );
1022cdf0e10cSrcweir     if  ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
1023cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
1024cdf0e10cSrcweir     if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE )
1025cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_PRIVILEGE ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
1026cdf0e10cSrcweir     if ( rowDeleted() )
1027cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir 	// this call position the cache indirect
1030cdf0e10cSrcweir     Any aBookmarkToDelete( m_aBookmark );
1031cdf0e10cSrcweir     positionCache( MOVE_NONE_REFRESH_ONLY );
1032cdf0e10cSrcweir     sal_Int32 nDeletePosition = m_pCache->getRow();
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir     notifyRowSetAndClonesRowDelete( aBookmarkToDelete );
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 	ORowSetRow aOldValues;
1037cdf0e10cSrcweir 	if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && m_pCache->m_aMatrixIter->isValid() )
1038cdf0e10cSrcweir 		aOldValues = new ORowSetValueVector( m_pCache->m_aMatrixIter->getBody() );
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir     Sequence<Any> aChangedBookmarks;
1041cdf0e10cSrcweir 	RowsChangeEvent aEvt(*this,RowChangeAction::DELETE,1,aChangedBookmarks);
1042cdf0e10cSrcweir 	notifyAllListenersRowBeforeChange(aGuard,aEvt);
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir     m_pCache->deleteRow();
1045cdf0e10cSrcweir 	notifyRowSetAndClonesRowDeleted( aBookmarkToDelete, nDeletePosition );
1046cdf0e10cSrcweir 
1047cdf0e10cSrcweir 	ORowSetNotifier aNotifier( this );
1048cdf0e10cSrcweir 		// this will call cancelRowModification on the cache if necessary
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 	// notification order
1051cdf0e10cSrcweir 	// - rowChanged
1052cdf0e10cSrcweir 	notifyAllListenersRowChanged(aGuard,aEvt);
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir 	// - IsModified
1055cdf0e10cSrcweir 	// - IsNew
1056cdf0e10cSrcweir 	aNotifier.fire( );
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir 	// - RowCount/IsRowCountFinal
1059cdf0e10cSrcweir 	fireRowcount();
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir // -------------------------------------------------------------------------
implCancelRowUpdates(sal_Bool _bNotifyModified)1063cdf0e10cSrcweir void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQLException, RuntimeException ) )
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1068cdf0e10cSrcweir 	if ( m_bBeforeFirst || m_bAfterLast || rowDeleted() )
1069cdf0e10cSrcweir 		return; // nothing to do so return
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir     checkCache();
1072cdf0e10cSrcweir 	// cancelRowUpdates is not allowed when:
1073cdf0e10cSrcweir 	// - standing on the insert row
1074cdf0e10cSrcweir 	// - the concurrency is read only
1075cdf0e10cSrcweir     // - the current row is deleted
1076cdf0e10cSrcweir 	if ( m_bNew || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
1077cdf0e10cSrcweir 		throwFunctionSequenceException(*this);
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir 	positionCache( MOVE_NONE_REFRESH_ONLY );
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir 	ORowSetRow aOldValues;
1082cdf0e10cSrcweir 	if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() )
1083cdf0e10cSrcweir 		aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() );
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir 	m_pCache->cancelRowUpdates();
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir 	m_aBookmark		= m_pCache->getBookmark();
1088cdf0e10cSrcweir 	m_aCurrentRow	= m_pCache->m_aMatrixIter;
1089cdf0e10cSrcweir 	m_bIsInsertRow	= sal_False;
1090cdf0e10cSrcweir 	m_aCurrentRow.setBookmark(m_aBookmark);
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir 	// notification order
1093cdf0e10cSrcweir 	// IsModified
1094cdf0e10cSrcweir 	if( !m_bModified && _bNotifyModified )
1095cdf0e10cSrcweir     {
1096cdf0e10cSrcweir         // - column values
1097cdf0e10cSrcweir 	    ORowSetBase::firePropertyChange(aOldValues);
1098cdf0e10cSrcweir 		fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
1099cdf0e10cSrcweir     }
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir // -------------------------------------------------------------------------
cancelRowUpdates()1103cdf0e10cSrcweir void SAL_CALL ORowSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir 	implCancelRowUpdates( sal_True );
1106cdf0e10cSrcweir }
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir // -------------------------------------------------------------------------
addRowSetListener(const Reference<XRowSetListener> & listener)1109cdf0e10cSrcweir void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException)
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
1114cdf0e10cSrcweir 	if(listener.is())
1115cdf0e10cSrcweir 		m_aRowsetListeners.addInterface(listener);
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir // -------------------------------------------------------------------------
removeRowSetListener(const Reference<XRowSetListener> & listener)1118cdf0e10cSrcweir void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException)
1119cdf0e10cSrcweir {
1120cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
1123cdf0e10cSrcweir 	if(listener.is())
1124cdf0e10cSrcweir 		m_aRowsetListeners.removeInterface(listener);
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir // -----------------------------------------------------------------------------
notifyAllListeners(::osl::ResettableMutexGuard & _rGuard)1127cdf0e10cSrcweir void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard)
1128cdf0e10cSrcweir {
1129cdf0e10cSrcweir 	EventObject aEvt(*m_pMySelf);
1130cdf0e10cSrcweir 	_rGuard.clear();
1131cdf0e10cSrcweir     m_aRowsetListeners.notifyEach( &XRowSetListener::rowSetChanged, aEvt );
1132cdf0e10cSrcweir 	_rGuard.reset();
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir // -------------------------------------------------------------------------
notifyAllListenersCursorMoved(::osl::ResettableMutexGuard & _rGuard)1135cdf0e10cSrcweir void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard)
1136cdf0e10cSrcweir {
1137cdf0e10cSrcweir 	EventObject aEvt(*m_pMySelf);
1138cdf0e10cSrcweir 	_rGuard.clear();
1139cdf0e10cSrcweir     m_aRowsetListeners.notifyEach( &XRowSetListener::cursorMoved, aEvt );
1140cdf0e10cSrcweir 	_rGuard.reset();
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir // -------------------------------------------------------------------------
notifyAllListenersRowChanged(::osl::ResettableMutexGuard & _rGuard,const RowsChangeEvent & aEvt)1143cdf0e10cSrcweir void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, const RowsChangeEvent& aEvt)
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir 	_rGuard.clear();
1146cdf0e10cSrcweir     m_aRowsetListeners.notifyEach( &XRowSetListener::rowChanged, (EventObject)aEvt );
1147cdf0e10cSrcweir     m_aRowsChangeListener.notifyEach( &XRowsChangeListener::rowsChanged, aEvt );
1148cdf0e10cSrcweir 	_rGuard.reset();
1149cdf0e10cSrcweir }
1150cdf0e10cSrcweir // -------------------------------------------------------------------------
notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard & _rGuard)1151cdf0e10cSrcweir sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard)
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir 	EventObject aEvt(*m_pMySelf);
1154cdf0e10cSrcweir 	NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove);
1155cdf0e10cSrcweir 	return bCheck;
1156cdf0e10cSrcweir }
1157cdf0e10cSrcweir // -------------------------------------------------------------------------
notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard & _rGuard,const RowChangeEvent & aEvt)1158cdf0e10cSrcweir void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt)
1159cdf0e10cSrcweir {
1160cdf0e10cSrcweir 	NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange);
1161cdf0e10cSrcweir     if ( !bCheck )
1162cdf0e10cSrcweir         m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() );
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir // -------------------------------------------------------------------------
fireRowcount()1165cdf0e10cSrcweir void ORowSet::fireRowcount()
1166cdf0e10cSrcweir {
1167cdf0e10cSrcweir     sal_Int32 nCurrentRowCount( impl_getRowCount() );
1168cdf0e10cSrcweir     sal_Bool bCurrentRowCountFinal( m_pCache->m_bRowCountFinal );
1169cdf0e10cSrcweir 
1170cdf0e10cSrcweir     if ( m_nLastKnownRowCount != nCurrentRowCount )
1171cdf0e10cSrcweir 	{
1172cdf0e10cSrcweir 		sal_Int32 nHandle = PROPERTY_ID_ROWCOUNT;
1173cdf0e10cSrcweir 		Any aNew,aOld;
1174cdf0e10cSrcweir 		aNew <<= nCurrentRowCount; aOld <<= m_nLastKnownRowCount;
1175cdf0e10cSrcweir 		fire(&nHandle,&aNew,&aOld,1,sal_False);
1176cdf0e10cSrcweir 		m_nLastKnownRowCount = nCurrentRowCount;
1177cdf0e10cSrcweir 	}
1178cdf0e10cSrcweir 	if ( !m_bLastKnownRowCountFinal && ( m_bLastKnownRowCountFinal != bCurrentRowCountFinal ) )
1179cdf0e10cSrcweir 	{
1180cdf0e10cSrcweir 		sal_Int32 nHandle = PROPERTY_ID_ISROWCOUNTFINAL;
1181cdf0e10cSrcweir 		Any aNew,aOld;
1182cdf0e10cSrcweir 		aNew <<= bCurrentRowCountFinal;
1183cdf0e10cSrcweir 		aOld <<= m_bLastKnownRowCountFinal;
1184cdf0e10cSrcweir 		fire(&nHandle,&aNew,&aOld,1,sal_False);
1185cdf0e10cSrcweir 		m_bLastKnownRowCountFinal = bCurrentRowCountFinal;
1186cdf0e10cSrcweir 	}
1187cdf0e10cSrcweir }
1188cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToInsertRow()1189cdf0e10cSrcweir void SAL_CALL ORowSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1192cdf0e10cSrcweir 
1193cdf0e10cSrcweir 	::osl::ResettableMutexGuard aGuard( *m_pMutex );
1194cdf0e10cSrcweir 	checkPositioningAllowed();
1195cdf0e10cSrcweir 	if ( ( m_pCache->m_nPrivileges & Privilege::INSERT ) != Privilege::INSERT )
1196cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_INSERT_PRIVILEGE ), SQL_GENERAL_ERROR, *this );
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir 	if ( notifyAllListenersCursorBeforeMove( aGuard ) )
1199cdf0e10cSrcweir 	{
1200cdf0e10cSrcweir 		// remember old value for fire
1201cdf0e10cSrcweir 		ORowSetRow aOldValues;
1202cdf0e10cSrcweir 		if ( rowDeleted() )
1203cdf0e10cSrcweir         {
1204cdf0e10cSrcweir 			positionCache( MOVE_FORWARD );
1205cdf0e10cSrcweir 		    m_pCache->next();
1206cdf0e10cSrcweir 			setCurrentRow( sal_True, sal_False, aOldValues, aGuard);
1207cdf0e10cSrcweir         }
1208cdf0e10cSrcweir         else
1209cdf0e10cSrcweir 			positionCache( MOVE_NONE_REFRESH_ONLY );
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir         // check before because the resultset could be empty
1212cdf0e10cSrcweir 		if  (   !m_bBeforeFirst
1213cdf0e10cSrcweir             &&  !m_bAfterLast
1214cdf0e10cSrcweir             &&  m_pCache->m_aMatrixIter != m_pCache->getEnd()
1215cdf0e10cSrcweir             &&  m_pCache->m_aMatrixIter->isValid()
1216cdf0e10cSrcweir             )
1217cdf0e10cSrcweir 			aOldValues = new ORowSetValueVector( m_pCache->m_aMatrixIter->getBody() );
1218cdf0e10cSrcweir 
1219cdf0e10cSrcweir 		const sal_Bool bNewState = m_bNew;
1220cdf0e10cSrcweir 		const sal_Bool bModState = m_bModified;
1221cdf0e10cSrcweir 
1222cdf0e10cSrcweir 		m_pCache->moveToInsertRow();
1223cdf0e10cSrcweir 		m_aCurrentRow = m_pCache->m_aInsertRow;
1224cdf0e10cSrcweir 		m_bIsInsertRow	= sal_True;
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir         // set read-only flag to false
1227cdf0e10cSrcweir         impl_setDataColumnsWriteable_throw();
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir 		// notification order
1230cdf0e10cSrcweir 		// - column values
1231cdf0e10cSrcweir 		ORowSetBase::firePropertyChange(aOldValues);
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir 		// - cursorMoved
1234cdf0e10cSrcweir 		notifyAllListenersCursorMoved(aGuard);
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir 		// - IsModified
1237cdf0e10cSrcweir 		if ( bModState != m_bModified )
1238cdf0e10cSrcweir 			fireProperty( PROPERTY_ID_ISMODIFIED, m_bModified, bModState );
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir 		// - IsNew
1241cdf0e10cSrcweir 		if ( bNewState != m_bNew )
1242cdf0e10cSrcweir 			fireProperty( PROPERTY_ID_ISNEW, m_bNew, bNewState );
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir         // - RowCount/IsRowCountFinal
1245cdf0e10cSrcweir 	    fireRowcount();
1246cdf0e10cSrcweir 	}
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir // -------------------------------------------------------------------------
impl_setDataColumnsWriteable_throw()1249cdf0e10cSrcweir void ORowSet::impl_setDataColumnsWriteable_throw()
1250cdf0e10cSrcweir {
1251cdf0e10cSrcweir     impl_restoreDataColumnsWriteable_throw();
1252cdf0e10cSrcweir     TDataColumns::iterator aIter = m_aDataColumns.begin();
1253cdf0e10cSrcweir     m_aReadOnlyDataColumns.resize(m_aDataColumns.size(),false);
1254cdf0e10cSrcweir     ::std::bit_vector::iterator aReadIter = m_aReadOnlyDataColumns.begin();
1255cdf0e10cSrcweir     for(;aIter != m_aDataColumns.end();++aIter,++aReadIter)
1256cdf0e10cSrcweir     {
1257cdf0e10cSrcweir         sal_Bool bReadOnly = sal_False;
1258cdf0e10cSrcweir         (*aIter)->getPropertyValue(PROPERTY_ISREADONLY) >>= bReadOnly;
1259cdf0e10cSrcweir         *aReadIter = bReadOnly;
1260cdf0e10cSrcweir 
1261cdf0e10cSrcweir         (*aIter)->setPropertyValue(PROPERTY_ISREADONLY,makeAny(sal_False));
1262cdf0e10cSrcweir     }
1263cdf0e10cSrcweir }
1264cdf0e10cSrcweir // -------------------------------------------------------------------------
impl_restoreDataColumnsWriteable_throw()1265cdf0e10cSrcweir void ORowSet::impl_restoreDataColumnsWriteable_throw()
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir     TDataColumns::iterator aIter = m_aDataColumns.begin();
1268cdf0e10cSrcweir     ::std::bit_vector::iterator aReadIter = m_aReadOnlyDataColumns.begin();
1269cdf0e10cSrcweir     for(;aReadIter != m_aReadOnlyDataColumns.end();++aIter,++aReadIter)
1270cdf0e10cSrcweir     {
1271cdf0e10cSrcweir         (*aIter)->setPropertyValue(PROPERTY_ISREADONLY,makeAny((sal_Bool)*aReadIter ));
1272cdf0e10cSrcweir     }
1273cdf0e10cSrcweir     m_aReadOnlyDataColumns.clear();
1274cdf0e10cSrcweir }
1275cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToCurrentRow()1276cdf0e10cSrcweir void SAL_CALL ORowSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
1277cdf0e10cSrcweir {
1278cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir 	::osl::ResettableMutexGuard aGuard( *m_pMutex );
1281cdf0e10cSrcweir 	checkPositioningAllowed();
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir     if ( !m_pCache->m_bNew && !m_bModified )
1284cdf0e10cSrcweir         // nothing to do if we're not on the insertion row, and not modified otherwise
1285cdf0e10cSrcweir         return;
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir     if ( rowDeleted() )
1288cdf0e10cSrcweir         // this would perhaps even justify a RuntimeException ....
1289cdf0e10cSrcweir         // if the current row is deleted, then no write access to this row should be possible. So,
1290cdf0e10cSrcweir         // m_bModified should be true. Also, as soon as somebody calls moveToInsertRow,
1291cdf0e10cSrcweir         // our current row should not be deleted anymore. So, we should not have survived the above
1292cdf0e10cSrcweir         // check "if ( !m_pCache->m_bNew && !m_bModified )"
1293cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
1294cdf0e10cSrcweir 
1295cdf0e10cSrcweir 	if ( notifyAllListenersCursorBeforeMove( aGuard ) )
1296cdf0e10cSrcweir 	{
1297cdf0e10cSrcweir         positionCache( MOVE_NONE_REFRESH_ONLY );
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir 		ORowSetNotifier aNotifier( this );
1300cdf0e10cSrcweir 
1301cdf0e10cSrcweir 		// notification order
1302cdf0e10cSrcweir 		// - cursorMoved
1303cdf0e10cSrcweir 		notifyAllListenersCursorMoved(aGuard);
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir 		// - IsModified
1306cdf0e10cSrcweir 		// - IsNew
1307cdf0e10cSrcweir 		aNotifier.fire();
1308cdf0e10cSrcweir 	}
1309cdf0e10cSrcweir }
1310cdf0e10cSrcweir // -------------------------------------------------------------------------
1311cdf0e10cSrcweir // XRow
wasNull()1312cdf0e10cSrcweir sal_Bool SAL_CALL ORowSet::wasNull(  ) throw(SQLException, RuntimeException)
1313cdf0e10cSrcweir {
1314cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1315cdf0e10cSrcweir 	checkCache();
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir 	return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull();
1318cdf0e10cSrcweir }
1319cdf0e10cSrcweir // -----------------------------------------------------------------------------
getInsertValue(sal_Int32 columnIndex)1320cdf0e10cSrcweir const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex)
1321cdf0e10cSrcweir {
1322cdf0e10cSrcweir 	checkCache();
1323cdf0e10cSrcweir 
1324cdf0e10cSrcweir 	if ( m_pCache && isInsertRow() )
1325cdf0e10cSrcweir 		return 	((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex];
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir 	return getValue(columnIndex);
1328cdf0e10cSrcweir }
1329cdf0e10cSrcweir // -------------------------------------------------------------------------
getString(sal_Int32 columnIndex)1330cdf0e10cSrcweir ::rtl::OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1331cdf0e10cSrcweir {
1332cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1333cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1334cdf0e10cSrcweir }
1335cdf0e10cSrcweir // -------------------------------------------------------------------------
getBoolean(sal_Int32 columnIndex)1336cdf0e10cSrcweir sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1337cdf0e10cSrcweir {
1338cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1339cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1340cdf0e10cSrcweir }
1341cdf0e10cSrcweir // -------------------------------------------------------------------------
getByte(sal_Int32 columnIndex)1342cdf0e10cSrcweir sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1343cdf0e10cSrcweir {
1344cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1345cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1346cdf0e10cSrcweir }
1347cdf0e10cSrcweir // -------------------------------------------------------------------------
getShort(sal_Int32 columnIndex)1348cdf0e10cSrcweir sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1349cdf0e10cSrcweir {
1350cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1351cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1352cdf0e10cSrcweir }
1353cdf0e10cSrcweir // -------------------------------------------------------------------------
getInt(sal_Int32 columnIndex)1354cdf0e10cSrcweir sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1355cdf0e10cSrcweir {
1356cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1357cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1358cdf0e10cSrcweir }
1359cdf0e10cSrcweir // -------------------------------------------------------------------------
getLong(sal_Int32 columnIndex)1360cdf0e10cSrcweir sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1363cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1364cdf0e10cSrcweir }
1365cdf0e10cSrcweir // -------------------------------------------------------------------------
getFloat(sal_Int32 columnIndex)1366cdf0e10cSrcweir float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1367cdf0e10cSrcweir {
1368cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1369cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1370cdf0e10cSrcweir }
1371cdf0e10cSrcweir // -------------------------------------------------------------------------
getDouble(sal_Int32 columnIndex)1372cdf0e10cSrcweir double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1373cdf0e10cSrcweir {
1374cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1375cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1376cdf0e10cSrcweir }
1377cdf0e10cSrcweir // -------------------------------------------------------------------------
getBytes(sal_Int32 columnIndex)1378cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1379cdf0e10cSrcweir {
1380cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1381cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1382cdf0e10cSrcweir }
1383cdf0e10cSrcweir // -------------------------------------------------------------------------
getDate(sal_Int32 columnIndex)1384cdf0e10cSrcweir ::com::sun::star::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1385cdf0e10cSrcweir {
1386cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1387cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1388cdf0e10cSrcweir }
1389cdf0e10cSrcweir // -------------------------------------------------------------------------
getTime(sal_Int32 columnIndex)1390cdf0e10cSrcweir ::com::sun::star::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1391cdf0e10cSrcweir {
1392cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1393cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir // -------------------------------------------------------------------------
getTimestamp(sal_Int32 columnIndex)1396cdf0e10cSrcweir ::com::sun::star::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1397cdf0e10cSrcweir {
1398cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1399cdf0e10cSrcweir 	return getInsertValue(columnIndex);
1400cdf0e10cSrcweir }
1401cdf0e10cSrcweir // -------------------------------------------------------------------------
getBinaryStream(sal_Int32 columnIndex)1402cdf0e10cSrcweir Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1403cdf0e10cSrcweir {
1404cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1405cdf0e10cSrcweir 	if ( m_pCache && isInsertRow() )
1406cdf0e10cSrcweir 	{
1407cdf0e10cSrcweir 		checkCache();
1408cdf0e10cSrcweir 		return new ::comphelper::SequenceInputStream(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
1409cdf0e10cSrcweir 	}
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir 	return ORowSetBase::getBinaryStream(columnIndex);
1412cdf0e10cSrcweir }
1413cdf0e10cSrcweir // -------------------------------------------------------------------------
getCharacterStream(sal_Int32 columnIndex)1414cdf0e10cSrcweir Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1415cdf0e10cSrcweir {
1416cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1417cdf0e10cSrcweir 	if(m_pCache && isInsertRow() )
1418cdf0e10cSrcweir 	{
1419cdf0e10cSrcweir 		checkCache();
1420cdf0e10cSrcweir 		return new ::comphelper::SequenceInputStream(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
1421cdf0e10cSrcweir 	}
1422cdf0e10cSrcweir 
1423cdf0e10cSrcweir 	return ORowSetBase::getCharacterStream(columnIndex);
1424cdf0e10cSrcweir }
1425cdf0e10cSrcweir // -------------------------------------------------------------------------
getObject(sal_Int32 columnIndex,const Reference<XNameAccess> &)1426cdf0e10cSrcweir Any SAL_CALL ORowSet::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
1427cdf0e10cSrcweir {
1428cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1429cdf0e10cSrcweir 	return getInsertValue(columnIndex).makeAny();
1430cdf0e10cSrcweir }
1431cdf0e10cSrcweir // -------------------------------------------------------------------------
getRef(sal_Int32)1432cdf0e10cSrcweir Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
1433cdf0e10cSrcweir {
1434cdf0e10cSrcweir 	return Reference< XRef >();
1435cdf0e10cSrcweir }
1436cdf0e10cSrcweir // -------------------------------------------------------------------------
getBlob(sal_Int32 columnIndex)1437cdf0e10cSrcweir Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1438cdf0e10cSrcweir {
1439cdf0e10cSrcweir     if ( m_pCache && isInsertRow() )
1440cdf0e10cSrcweir 	{
1441cdf0e10cSrcweir 		checkCache();
1442cdf0e10cSrcweir 		return new ::connectivity::BlobHelper(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
1443cdf0e10cSrcweir 	}
1444cdf0e10cSrcweir 	return ORowSetBase::getBlob(columnIndex);
1445cdf0e10cSrcweir }
1446cdf0e10cSrcweir // -------------------------------------------------------------------------
getClob(sal_Int32 columnIndex)1447cdf0e10cSrcweir Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1448cdf0e10cSrcweir {
1449cdf0e10cSrcweir 	return Reference< XClob >(getInsertValue(columnIndex).makeAny(),UNO_QUERY);
1450cdf0e10cSrcweir }
1451cdf0e10cSrcweir // -------------------------------------------------------------------------
getArray(sal_Int32)1452cdf0e10cSrcweir Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
1453cdf0e10cSrcweir {
1454cdf0e10cSrcweir 	return Reference< XArray >();
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir // -------------------------------------------------------------------------
executeWithCompletion(const Reference<XInteractionHandler> & _rxHandler)1457cdf0e10cSrcweir void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException)
1458cdf0e10cSrcweir {
1459cdf0e10cSrcweir 	if (!_rxHandler.is())
1460cdf0e10cSrcweir 		execute();
1461cdf0e10cSrcweir 
1462cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1463cdf0e10cSrcweir 
1464cdf0e10cSrcweir 	// tell everybody that we will change the result set
1465cdf0e10cSrcweir 	approveExecution();
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir 	ResettableMutexGuard aGuard( m_aMutex );
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir 	try
1470cdf0e10cSrcweir 	{
1471cdf0e10cSrcweir         freeResources( m_bCommandFacetsDirty );
1472cdf0e10cSrcweir 
1473cdf0e10cSrcweir 		// calc the connection to be used
1474cdf0e10cSrcweir 		if (m_xActiveConnection.is() && m_bRebuildConnOnExecute)
1475cdf0e10cSrcweir         {
1476cdf0e10cSrcweir 			// there was a setProperty(ActiveConnection), but a setProperty(DataSource) _after_ that, too
1477cdf0e10cSrcweir             Reference< XConnection > xXConnection;
1478cdf0e10cSrcweir             setActiveConnection( xXConnection );
1479cdf0e10cSrcweir         }
1480cdf0e10cSrcweir 		calcConnection( _rxHandler );
1481cdf0e10cSrcweir 		m_bRebuildConnOnExecute = sal_False;
1482cdf0e10cSrcweir 
1483cdf0e10cSrcweir         Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext.getLegacyServiceFactory() );
1484cdf0e10cSrcweir         Reference<XParametersSupplier>  xParameters(xComposer, UNO_QUERY);
1485cdf0e10cSrcweir 
1486cdf0e10cSrcweir 	    Reference<XIndexAccess>  xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>();
1487cdf0e10cSrcweir 	    const sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0;
1488cdf0e10cSrcweir         if ( m_aParametersSet.size() < (size_t)nParamCount )
1489cdf0e10cSrcweir 		    m_aParametersSet.resize( nParamCount ,false);
1490cdf0e10cSrcweir 
1491cdf0e10cSrcweir 		::dbtools::askForParameters( xComposer, this, m_xActiveConnection, _rxHandler,m_aParametersSet );
1492cdf0e10cSrcweir 	}
1493cdf0e10cSrcweir 	// ensure that only the allowed exceptions leave this block
1494cdf0e10cSrcweir 	catch(SQLException&)
1495cdf0e10cSrcweir 	{
1496cdf0e10cSrcweir 		throw;
1497cdf0e10cSrcweir 	}
1498cdf0e10cSrcweir 	catch(RuntimeException&)
1499cdf0e10cSrcweir 	{
1500cdf0e10cSrcweir 		throw;
1501cdf0e10cSrcweir 	}
1502cdf0e10cSrcweir 	catch(Exception&)
1503cdf0e10cSrcweir 	{
1504cdf0e10cSrcweir 		DBG_ERROR("ORowSet::executeWithCompletion: caught an unexpected exception type while filling in the parameters!");
1505cdf0e10cSrcweir 	}
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir 	// we're done with the parameters, now for the real execution
1508cdf0e10cSrcweir 
1509cdf0e10cSrcweir 	//  do the real execute
1510cdf0e10cSrcweir 	execute_NoApprove_NoNewConn(aGuard);
1511cdf0e10cSrcweir }
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir // -------------------------------------------------------------------------
getParameters()1514cdf0e10cSrcweir Reference< XIndexAccess > SAL_CALL ORowSet::getParameters(  ) throw (RuntimeException)
1515cdf0e10cSrcweir {
1516cdf0e10cSrcweir 	::osl::MutexGuard aGuard( *m_pMutex );
1517cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1518cdf0e10cSrcweir 
1519cdf0e10cSrcweir     if ( m_bCommandFacetsDirty )
1520cdf0e10cSrcweir         // need to rebuild the parameters, since some property which contributes to the
1521cdf0e10cSrcweir         // complete command, and thus the parameters, changed
1522cdf0e10cSrcweir         impl_disposeParametersContainer_nothrow();
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir     if ( !m_pParameters.get() && m_aCommand.getLength() )
1525cdf0e10cSrcweir     {
1526cdf0e10cSrcweir         try
1527cdf0e10cSrcweir         {
1528cdf0e10cSrcweir             ::rtl::OUString sNotInterestedIn;
1529cdf0e10cSrcweir             impl_initComposer_throw( sNotInterestedIn );
1530cdf0e10cSrcweir         }
1531cdf0e10cSrcweir         catch( const Exception& )
1532cdf0e10cSrcweir         {
1533cdf0e10cSrcweir         	// silence it
1534cdf0e10cSrcweir         }
1535cdf0e10cSrcweir     }
1536cdf0e10cSrcweir 
1537cdf0e10cSrcweir     return m_pParameters.get();
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir 
1540cdf0e10cSrcweir // -------------------------------------------------------------------------
approveExecution()1541cdf0e10cSrcweir void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException)
1542cdf0e10cSrcweir {
1543cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
1544cdf0e10cSrcweir 	EventObject aEvt(*this);
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir     OInterfaceIteratorHelper aApproveIter( m_aApproveListeners );
1547cdf0e10cSrcweir 	while ( aApproveIter.hasMoreElements() )
1548cdf0e10cSrcweir 	{
1549cdf0e10cSrcweir         Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aApproveIter.next() ) );
1550cdf0e10cSrcweir         try
1551cdf0e10cSrcweir         {
1552cdf0e10cSrcweir             if ( xListener.is() && !xListener->approveRowSetChange( aEvt ) )
1553cdf0e10cSrcweir 			    throw RowSetVetoException();
1554cdf0e10cSrcweir         }
1555cdf0e10cSrcweir         catch ( const DisposedException& e )
1556cdf0e10cSrcweir         {
1557cdf0e10cSrcweir             if ( e.Context == xListener )
1558cdf0e10cSrcweir                 aApproveIter.remove();
1559cdf0e10cSrcweir         }
1560cdf0e10cSrcweir         catch ( const RuntimeException& ) { throw; }
1561cdf0e10cSrcweir         catch ( const RowSetVetoException& ) { throw; }
1562cdf0e10cSrcweir         catch ( const Exception& )
1563cdf0e10cSrcweir         {
1564cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
1565cdf0e10cSrcweir         }
1566cdf0e10cSrcweir 	}
1567cdf0e10cSrcweir }
1568cdf0e10cSrcweir // -------------------------------------------------------------------------
1569cdf0e10cSrcweir // XRowSet
1570cdf0e10cSrcweir // -------------------------------------------------------------------------
execute()1571cdf0e10cSrcweir void SAL_CALL ORowSet::execute(  ) throw(SQLException, RuntimeException)
1572cdf0e10cSrcweir {
1573cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
1574cdf0e10cSrcweir 
1575cdf0e10cSrcweir 	// tell everybody that we will change the result set
1576cdf0e10cSrcweir 	approveExecution();
1577cdf0e10cSrcweir 
1578cdf0e10cSrcweir 	ResettableMutexGuard aGuard( m_aMutex );
1579cdf0e10cSrcweir 	freeResources( m_bCommandFacetsDirty );
1580cdf0e10cSrcweir 
1581cdf0e10cSrcweir 	// calc the connection to be used
1582cdf0e10cSrcweir 	if (m_xActiveConnection.is() && m_bRebuildConnOnExecute) {
1583cdf0e10cSrcweir 		// there was a setProperty(ActiveConnection), but a setProperty(DataSource) _after_ that, too
1584cdf0e10cSrcweir         Reference< XConnection> xXConnection;
1585cdf0e10cSrcweir 		setActiveConnection( xXConnection );
1586cdf0e10cSrcweir     }
1587cdf0e10cSrcweir 
1588cdf0e10cSrcweir 	calcConnection(NULL);
1589cdf0e10cSrcweir 	m_bRebuildConnOnExecute = sal_False;
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir 	// do the real execute
1592cdf0e10cSrcweir 	execute_NoApprove_NoNewConn(aGuard);
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir 
1595cdf0e10cSrcweir //------------------------------------------------------------------------------
setStatementResultSetType(const Reference<XPropertySet> & _rxStatement,sal_Int32 _nDesiredResultSetType,sal_Int32 _nDesiredResultSetConcurrency)1596cdf0e10cSrcweir void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxStatement, sal_Int32 _nDesiredResultSetType, sal_Int32 _nDesiredResultSetConcurrency )
1597cdf0e10cSrcweir {
1598cdf0e10cSrcweir     OSL_ENSURE( _rxStatement.is(), "ORowSet::setStatementResultSetType: invalid statement - this will crash!" );
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir     sal_Int32 nResultSetType( _nDesiredResultSetType );
1601cdf0e10cSrcweir     sal_Int32 nResultSetConcurrency( _nDesiredResultSetConcurrency );
1602cdf0e10cSrcweir 
1603cdf0e10cSrcweir     // there *might* be a data source setting which tells use to be more defensive with those settings
1604cdf0e10cSrcweir     // #i15113# / 2005-02-10 / frank.schoenheit@sun.com
1605cdf0e10cSrcweir     sal_Bool bRespectDriverRST = sal_False;
1606cdf0e10cSrcweir     Any aSetting;
1607cdf0e10cSrcweir     if ( getDataSourceSetting( ::dbaccess::getDataSource( m_xActiveConnection ), "RespectDriverResultSetType", aSetting ) )
1608cdf0e10cSrcweir     {
1609cdf0e10cSrcweir         OSL_VERIFY( aSetting >>= bRespectDriverRST );
1610cdf0e10cSrcweir     }
1611cdf0e10cSrcweir 
1612cdf0e10cSrcweir     if ( bRespectDriverRST )
1613cdf0e10cSrcweir     {
1614cdf0e10cSrcweir         // try type/concurrency settings with decreasing usefullness, and rely on what the connection claims
1615cdf0e10cSrcweir         // to support
1616cdf0e10cSrcweir         Reference< XDatabaseMetaData > xMeta( m_xActiveConnection->getMetaData() );
1617cdf0e10cSrcweir 
1618cdf0e10cSrcweir         sal_Int32 nCharacteristics[5][2] =
1619cdf0e10cSrcweir         {   { ResultSetType::SCROLL_SENSITIVE, ResultSetConcurrency::UPDATABLE },
1620cdf0e10cSrcweir             { ResultSetType::SCROLL_INSENSITIVE, ResultSetConcurrency::UPDATABLE },
1621cdf0e10cSrcweir             { ResultSetType::SCROLL_SENSITIVE, ResultSetConcurrency::READ_ONLY },
1622cdf0e10cSrcweir             { ResultSetType::SCROLL_INSENSITIVE, ResultSetConcurrency::READ_ONLY },
1623cdf0e10cSrcweir             { ResultSetType::FORWARD_ONLY, ResultSetConcurrency::READ_ONLY }
1624cdf0e10cSrcweir         };
1625cdf0e10cSrcweir         sal_Int32 i=0;
1626cdf0e10cSrcweir         if ( m_xActiveConnection->getMetaData()->isReadOnly() )
1627cdf0e10cSrcweir             i = 2; // if the database is read-only we only should use read-only concurrency
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir         for ( ; i<5; ++i )
1630cdf0e10cSrcweir         {
1631cdf0e10cSrcweir 			nResultSetType = nCharacteristics[i][0];
1632cdf0e10cSrcweir 			nResultSetConcurrency = nCharacteristics[i][1];
1633cdf0e10cSrcweir 
1634cdf0e10cSrcweir             // don't try type/concurrency pairs which are more featured than what our caller requested
1635cdf0e10cSrcweir             if ( nResultSetType > _nDesiredResultSetType )
1636cdf0e10cSrcweir                 continue;
1637cdf0e10cSrcweir             if ( nResultSetConcurrency > _nDesiredResultSetConcurrency )
1638cdf0e10cSrcweir                 continue;
1639cdf0e10cSrcweir 
1640cdf0e10cSrcweir             if ( xMeta.is() && xMeta->supportsResultSetConcurrency( nResultSetType, nResultSetConcurrency ) )
1641cdf0e10cSrcweir                 break;
1642cdf0e10cSrcweir         }
1643cdf0e10cSrcweir     }
1644cdf0e10cSrcweir 
1645cdf0e10cSrcweir 	_rxStatement->setPropertyValue( PROPERTY_RESULTSETTYPE, makeAny( nResultSetType ) );
1646cdf0e10cSrcweir     _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) );
1647cdf0e10cSrcweir }
1648cdf0e10cSrcweir 
1649cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_prepareAndExecute_throw()1650cdf0e10cSrcweir Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
1651cdf0e10cSrcweir {
1652cdf0e10cSrcweir     ::rtl::OUString sCommandToExecute;
1653cdf0e10cSrcweir     sal_Bool bUseEscapeProcessing = impl_initComposer_throw( sCommandToExecute );
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir     Reference< XResultSet> xResultSet;
1656cdf0e10cSrcweir     try
1657cdf0e10cSrcweir     {
1658cdf0e10cSrcweir         m_xStatement = m_xActiveConnection->prepareStatement( sCommandToExecute );
1659cdf0e10cSrcweir         if ( !m_xStatement.is() )
1660cdf0e10cSrcweir 		{
1661cdf0e10cSrcweir             ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INTERNAL_ERROR ), SQL_GENERAL_ERROR, *this );
1662cdf0e10cSrcweir 		}
1663cdf0e10cSrcweir 
1664cdf0e10cSrcweir 		Reference< XPropertySet > xStatementProps( m_xStatement, UNO_QUERY_THROW );
1665cdf0e10cSrcweir         // set the result set type and concurrency
1666cdf0e10cSrcweir         try
1667cdf0e10cSrcweir 		{
1668cdf0e10cSrcweir             xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( sal_True ) );
1669cdf0e10cSrcweir             xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) );
1670cdf0e10cSrcweir 
1671cdf0e10cSrcweir             setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency );
1672cdf0e10cSrcweir 		}
1673cdf0e10cSrcweir 		catch ( const Exception& )
1674cdf0e10cSrcweir 		{
1675cdf0e10cSrcweir 			// this exception doesn't matter here because when we catch an exception
1676cdf0e10cSrcweir 			// then the driver doesn't support this feature
1677cdf0e10cSrcweir 		}
1678cdf0e10cSrcweir         m_aParameterValueForCache.get().resize(1);
1679cdf0e10cSrcweir 		Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
1680cdf0e10cSrcweir         size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
1681cdf0e10cSrcweir         for ( size_t i=1; i<=nParamCount; ++i )
1682cdf0e10cSrcweir         {
1683cdf0e10cSrcweir             ORowSetValue& rParamValue( getParameterStorage( (sal_Int32)i ) );
1684cdf0e10cSrcweir             ::dbtools::setObjectWithInfo( xParam, i, rParamValue.makeAny(), rParamValue.getTypeKind() );
1685cdf0e10cSrcweir             m_aParameterValueForCache.get().push_back(rParamValue);
1686cdf0e10cSrcweir         }
1687cdf0e10cSrcweir 
1688cdf0e10cSrcweir 		xResultSet = m_xStatement->executeQuery();
1689cdf0e10cSrcweir     }
1690cdf0e10cSrcweir     catch( const SQLException& )
1691cdf0e10cSrcweir     {
1692cdf0e10cSrcweir         SQLExceptionInfo aError( ::cppu::getCaughtException() );
1693cdf0e10cSrcweir         OSL_ENSURE( aError.isValid(), "ORowSet::impl_prepareAndExecute_throw: caught an SQLException which we cannot analyze!" );
1694cdf0e10cSrcweir 
1695cdf0e10cSrcweir         // append information about what we were actually going to execute
1696cdf0e10cSrcweir         try
1697cdf0e10cSrcweir         {
1698cdf0e10cSrcweir             String sQuery = bUseEscapeProcessing && m_xComposer.is() ? m_xComposer->getQuery() : m_aActiveCommand;
1699cdf0e10cSrcweir             String sInfo( DBA_RES_PARAM( RID_STR_COMMAND_LEADING_TO_ERROR, "$command$", sQuery ) );
1700cdf0e10cSrcweir             aError.append( SQLExceptionInfo::SQL_CONTEXT, sInfo );
1701cdf0e10cSrcweir         }
1702cdf0e10cSrcweir         catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
1703cdf0e10cSrcweir 
1704cdf0e10cSrcweir         // propagate
1705cdf0e10cSrcweir         aError.doThrow();
1706cdf0e10cSrcweir     }
1707cdf0e10cSrcweir 
1708cdf0e10cSrcweir     return xResultSet;
1709cdf0e10cSrcweir }
1710cdf0e10cSrcweir 
1711cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_initializeColumnSettings_nothrow(const Reference<XPropertySet> & _rxTemplateColumn,const Reference<XPropertySet> & _rxRowSetColumn)1712cdf0e10cSrcweir void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertySet >& _rxTemplateColumn, const Reference< XPropertySet >& _rxRowSetColumn )
1713cdf0e10cSrcweir {
1714cdf0e10cSrcweir     OSL_ENSURE( _rxTemplateColumn.is() && _rxRowSetColumn.is(),
1715cdf0e10cSrcweir         "ORowSet::impl_initializeColumnSettings_nothrow: this will crash!" );
1716cdf0e10cSrcweir 
1717cdf0e10cSrcweir     bool bHaveAnyColumnSetting = false;
1718cdf0e10cSrcweir 	try
1719cdf0e10cSrcweir 	{
1720cdf0e10cSrcweir         Reference< XPropertySetInfo > xInfo( _rxTemplateColumn->getPropertySetInfo(), UNO_QUERY_THROW );
1721cdf0e10cSrcweir 
1722cdf0e10cSrcweir         // a number of properties is plain copied
1723cdf0e10cSrcweir         const ::rtl::OUString aPropertyNames[] = {
1724cdf0e10cSrcweir             PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL,
1725cdf0e10cSrcweir             PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT
1726cdf0e10cSrcweir         };
1727cdf0e10cSrcweir         for ( size_t i=0; i<sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
1728cdf0e10cSrcweir         {
1729cdf0e10cSrcweir 			if ( xInfo->hasPropertyByName( aPropertyNames[i] ) )
1730cdf0e10cSrcweir             {
1731cdf0e10cSrcweir 				_rxRowSetColumn->setPropertyValue( aPropertyNames[i], _rxTemplateColumn->getPropertyValue( aPropertyNames[i] ) );
1732cdf0e10cSrcweir                 bHaveAnyColumnSetting = true;
1733cdf0e10cSrcweir             }
1734cdf0e10cSrcweir         }
1735cdf0e10cSrcweir 
1736cdf0e10cSrcweir         // the format key is slightly more complex
1737cdf0e10cSrcweir 		sal_Int32 nFormatKey = 0;
1738cdf0e10cSrcweir 		if( xInfo->hasPropertyByName( PROPERTY_NUMBERFORMAT ) )
1739cdf0e10cSrcweir         {
1740cdf0e10cSrcweir 			_rxTemplateColumn->getPropertyValue( PROPERTY_NUMBERFORMAT ) >>= nFormatKey;
1741cdf0e10cSrcweir             bHaveAnyColumnSetting = true;
1742cdf0e10cSrcweir         }
1743cdf0e10cSrcweir 		if ( !nFormatKey && m_xNumberFormatTypes.is() )
1744cdf0e10cSrcweir 			nFormatKey = ::dbtools::getDefaultNumberFormat( _rxTemplateColumn, m_xNumberFormatTypes, SvtSysLocale().GetLocaleData().getLocale() );
1745cdf0e10cSrcweir 		_rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, makeAny( nFormatKey ) );
1746cdf0e10cSrcweir 	}
1747cdf0e10cSrcweir 	catch(Exception&)
1748cdf0e10cSrcweir 	{
1749cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
1750cdf0e10cSrcweir         return;
1751cdf0e10cSrcweir 	}
1752cdf0e10cSrcweir 
1753cdf0e10cSrcweir     if ( bHaveAnyColumnSetting )
1754cdf0e10cSrcweir         return;
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir     // the template column could not provide *any* setting. Okay, probably it's a parser column, which
1757cdf0e10cSrcweir     // does not offer those. However, perhaps the template column referes to a table column, which we
1758cdf0e10cSrcweir     // can use as new template column
1759cdf0e10cSrcweir     try
1760cdf0e10cSrcweir     {
1761cdf0e10cSrcweir         Reference< XPropertySetInfo > xInfo( _rxTemplateColumn->getPropertySetInfo(), UNO_QUERY_THROW );
1762cdf0e10cSrcweir         if ( !xInfo->hasPropertyByName( PROPERTY_TABLENAME ) )
1763cdf0e10cSrcweir             // no chance
1764cdf0e10cSrcweir             return;
1765cdf0e10cSrcweir 
1766cdf0e10cSrcweir         ::rtl::OUString sTableName;
1767cdf0e10cSrcweir         OSL_VERIFY( _rxTemplateColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName );
1768cdf0e10cSrcweir 
1769cdf0e10cSrcweir         Reference< XNameAccess > xTables( impl_getTables_throw(), UNO_QUERY_THROW );
1770cdf0e10cSrcweir         if ( !xTables->hasByName( sTableName ) )
1771cdf0e10cSrcweir             // no chance
1772cdf0e10cSrcweir             return;
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir         Reference< XColumnsSupplier > xTableColSup( xTables->getByName( sTableName ), UNO_QUERY_THROW );
1775cdf0e10cSrcweir         Reference< XNameAccess > xTableCols( xTableColSup->getColumns(), UNO_QUERY_THROW );
1776cdf0e10cSrcweir 
1777cdf0e10cSrcweir         ::rtl::OUString sTableColumnName;
1778cdf0e10cSrcweir 
1779cdf0e10cSrcweir         // get the "Name" or (preferred) "RealName" property of the column
1780cdf0e10cSrcweir         ::rtl::OUString sNamePropertyName( PROPERTY_NAME );
1781cdf0e10cSrcweir         if ( xInfo->hasPropertyByName( PROPERTY_REALNAME ) )
1782cdf0e10cSrcweir             sNamePropertyName = PROPERTY_REALNAME;
1783cdf0e10cSrcweir         OSL_VERIFY( _rxTemplateColumn->getPropertyValue( sNamePropertyName ) >>= sTableColumnName );
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir         if ( !xTableCols->hasByName( sTableColumnName ) )
1786cdf0e10cSrcweir             return;
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir         Reference< XPropertySet > xTableColumn( xTableCols->getByName( sTableColumnName ), UNO_QUERY_THROW );
1789cdf0e10cSrcweir         impl_initializeColumnSettings_nothrow( xTableColumn, _rxRowSetColumn );
1790cdf0e10cSrcweir     }
1791cdf0e10cSrcweir     catch( const Exception& )
1792cdf0e10cSrcweir     {
1793cdf0e10cSrcweir     	DBG_UNHANDLED_EXCEPTION();
1794cdf0e10cSrcweir     }
1795cdf0e10cSrcweir }
1796cdf0e10cSrcweir 
1797cdf0e10cSrcweir // -----------------------------------------------------------------------------
execute_NoApprove_NoNewConn(ResettableMutexGuard & _rClearForNotification)1798cdf0e10cSrcweir void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotification)
1799cdf0e10cSrcweir {
1800cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn" );
1801cdf0e10cSrcweir 
1802cdf0e10cSrcweir 	// now we can dispose our old connection
1803cdf0e10cSrcweir 	::comphelper::disposeComponent(m_xOldConnection);
1804cdf0e10cSrcweir 	m_xOldConnection = NULL;
1805cdf0e10cSrcweir 
1806cdf0e10cSrcweir 	// do we need a new statement
1807cdf0e10cSrcweir 	if ( m_bCommandFacetsDirty )
1808cdf0e10cSrcweir 	{
1809cdf0e10cSrcweir 		m_xStatement	= NULL;
1810cdf0e10cSrcweir 		m_xComposer		= NULL;
1811cdf0e10cSrcweir 
1812cdf0e10cSrcweir         Reference< XResultSet > xResultSet( impl_prepareAndExecute_throw() );
1813cdf0e10cSrcweir 
1814cdf0e10cSrcweir         // let our warnings container forget the reference to the (possibly disposed) old result set
1815cdf0e10cSrcweir         m_aWarnings.setExternalWarnings( NULL );
1816cdf0e10cSrcweir         // clear all current warnings
1817cdf0e10cSrcweir         m_aWarnings.clearWarnings();
1818cdf0e10cSrcweir         // let the warnings container know about the new "external warnings"
1819cdf0e10cSrcweir         m_aWarnings.setExternalWarnings( Reference< XWarningsSupplier >( xResultSet, UNO_QUERY ) );
1820cdf0e10cSrcweir 
1821cdf0e10cSrcweir 		::rtl::OUString aComposedUpdateTableName;
1822cdf0e10cSrcweir 		if ( m_aUpdateTableName.getLength() )
1823cdf0e10cSrcweir 			aComposedUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), m_aUpdateCatalogName, m_aUpdateSchemaName, m_aUpdateTableName, sal_False, ::dbtools::eInDataManipulation );
1824cdf0e10cSrcweir 
1825cdf0e10cSrcweir         {
1826cdf0e10cSrcweir             RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" );
1827cdf0e10cSrcweir             m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter,m_nMaxRows );
1828cdf0e10cSrcweir             if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
1829cdf0e10cSrcweir             {
1830cdf0e10cSrcweir                 m_nPrivileges = Privilege::SELECT;
1831cdf0e10cSrcweir                 m_pCache->m_nPrivileges = Privilege::SELECT;
1832cdf0e10cSrcweir             }
1833cdf0e10cSrcweir             m_pCache->setFetchSize(m_nFetchSize);
1834cdf0e10cSrcweir             m_aCurrentRow	= m_pCache->createIterator(this);
1835cdf0e10cSrcweir 			m_bIsInsertRow	= sal_False;
1836cdf0e10cSrcweir             m_aOldRow       = m_pCache->registerOldRow();
1837cdf0e10cSrcweir         }
1838cdf0e10cSrcweir 
1839cdf0e10cSrcweir 		// get the locale
1840cdf0e10cSrcweir 		//	ConfigManager*	pConfigMgr = ConfigManager::GetConfigManager();
1841cdf0e10cSrcweir 		Locale aLocale = SvtSysLocale().GetLocaleData().getLocale();
1842cdf0e10cSrcweir 		//	pConfigMgr->GetDirectConfigProperty(ConfigManager::LOCALE) >>= aLocale;
1843cdf0e10cSrcweir 
1844cdf0e10cSrcweir 		// get the numberformatTypes
1845cdf0e10cSrcweir 		OSL_ENSURE(m_xActiveConnection.is(),"No ActiveConnection");
1846cdf0e10cSrcweir 		Reference< XNumberFormatTypes> xNumberFormatTypes;
1847cdf0e10cSrcweir 		Reference< XNumberFormatsSupplier> xNumberFormat = ::dbtools::getNumberFormats(m_xActiveConnection);
1848cdf0e10cSrcweir 		if ( xNumberFormat.is() )
1849cdf0e10cSrcweir 			m_xNumberFormatTypes.set(xNumberFormat->getNumberFormats(),UNO_QUERY);
1850cdf0e10cSrcweir 
1851cdf0e10cSrcweir 		::vos::ORef< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns();
1852cdf0e10cSrcweir 		::std::vector< ::rtl::OUString> aNames;
1853cdf0e10cSrcweir 		::rtl::OUString aDescription;
1854cdf0e10cSrcweir 		sal_Int32 nFormatKey = 0;
1855cdf0e10cSrcweir 
1856cdf0e10cSrcweir         const ::std::map<sal_Int32,sal_Int32>& rKeyColumns = m_pCache->getKeyColumns();
1857cdf0e10cSrcweir 		if(!m_xColumns.is())
1858cdf0e10cSrcweir 		{
1859cdf0e10cSrcweir             RTL_LOGFILE_CONTEXT_AUTHOR( aColumnCreateLog, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn::creating columns" );
1860cdf0e10cSrcweir 			// use the meta data
1861cdf0e10cSrcweir 			Reference<XResultSetMetaDataSupplier> xMetaSup(m_xStatement,UNO_QUERY);
1862cdf0e10cSrcweir 			try
1863cdf0e10cSrcweir 			{
1864cdf0e10cSrcweir 				Reference<XResultSetMetaData> xMetaData = xMetaSup->getMetaData();
1865cdf0e10cSrcweir 				if ( xMetaData.is() )
1866cdf0e10cSrcweir 				{
1867cdf0e10cSrcweir 					sal_Int32 nCount = xMetaData->getColumnCount();
1868cdf0e10cSrcweir 					m_aDataColumns.reserve(nCount+1);
1869cdf0e10cSrcweir 					aColumns->get().reserve(nCount+1);
1870cdf0e10cSrcweir 					DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
1871cdf0e10cSrcweir 					StringMap aColumnMap;
1872cdf0e10cSrcweir 					for (sal_Int32 i = 0 ; i < nCount; ++i)
1873cdf0e10cSrcweir 					{
1874cdf0e10cSrcweir 						// retrieve the name of the column
1875cdf0e10cSrcweir 						::rtl::OUString sName = xMetaData->getColumnName(i + 1);
1876cdf0e10cSrcweir 						// check for duplicate entries
1877cdf0e10cSrcweir 						if(aColumnMap.find(sName) != aColumnMap.end())
1878cdf0e10cSrcweir 						{
1879cdf0e10cSrcweir 							::rtl::OUString sAlias(sName);
1880cdf0e10cSrcweir 							sal_Int32 searchIndex=1;
1881cdf0e10cSrcweir 							while(aColumnMap.find(sAlias) != aColumnMap.end())
1882cdf0e10cSrcweir 							{
1883cdf0e10cSrcweir                                 (sAlias = sName) += ::rtl::OUString::valueOf(searchIndex++);
1884cdf0e10cSrcweir 							}
1885cdf0e10cSrcweir 							sName = sAlias;
1886cdf0e10cSrcweir 						}
1887cdf0e10cSrcweir 						ORowSetDataColumn* pColumn = new ORowSetDataColumn(	getMetaData(),
1888cdf0e10cSrcweir 																			this,
1889cdf0e10cSrcweir 																			this,
1890cdf0e10cSrcweir 																			i+1,
1891cdf0e10cSrcweir                                                                             m_xActiveConnection->getMetaData(),
1892cdf0e10cSrcweir 																			aDescription,
1893cdf0e10cSrcweir                                                                             ::rtl::OUString(),
1894cdf0e10cSrcweir 																			m_aCurrentRow);
1895cdf0e10cSrcweir 						aColumnMap.insert(StringMap::value_type(sName,0));
1896cdf0e10cSrcweir 						aColumns->get().push_back(pColumn);
1897cdf0e10cSrcweir 						pColumn->setName(sName);
1898cdf0e10cSrcweir 						aNames.push_back(sName);
1899cdf0e10cSrcweir 						m_aDataColumns.push_back(pColumn);
1900cdf0e10cSrcweir 
1901cdf0e10cSrcweir                         pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i+1) != rKeyColumns.end()));
1902cdf0e10cSrcweir 
1903cdf0e10cSrcweir 						try
1904cdf0e10cSrcweir 						{
1905cdf0e10cSrcweir 							nFormatKey = 0;
1906cdf0e10cSrcweir 							if(m_xNumberFormatTypes.is())
1907cdf0e10cSrcweir 								nFormatKey = ::dbtools::getDefaultNumberFormat(pColumn,m_xNumberFormatTypes,aLocale);
1908cdf0e10cSrcweir 
1909cdf0e10cSrcweir 
1910cdf0e10cSrcweir 							pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
1911cdf0e10cSrcweir 							pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,makeAny(sal_Int32(i+1)));
1912cdf0e10cSrcweir 							pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,makeAny(sal_Int32(227)));
1913cdf0e10cSrcweir 							pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,makeAny((sal_Int32)0));
1914cdf0e10cSrcweir 							pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,::cppu::bool2any(sal_False));
1915cdf0e10cSrcweir 						}
1916cdf0e10cSrcweir 						catch(Exception&)
1917cdf0e10cSrcweir 						{
1918cdf0e10cSrcweir 						}
1919cdf0e10cSrcweir 					}
1920cdf0e10cSrcweir 				}
1921cdf0e10cSrcweir 			}
1922cdf0e10cSrcweir 			catch (SQLException&)
1923cdf0e10cSrcweir 			{
1924cdf0e10cSrcweir 			}
1925cdf0e10cSrcweir 		}
1926cdf0e10cSrcweir 		else
1927cdf0e10cSrcweir 		{
1928cdf0e10cSrcweir 			// create the rowset columns
1929cdf0e10cSrcweir 			Reference< XResultSetMetaData > xMeta( getMetaData(), UNO_QUERY_THROW );
1930cdf0e10cSrcweir 			sal_Int32 nCount = xMeta->getColumnCount();
1931cdf0e10cSrcweir 			m_aDataColumns.reserve(nCount+1);
1932cdf0e10cSrcweir 			aColumns->get().reserve(nCount+1);
1933cdf0e10cSrcweir 			::std::set< Reference< XPropertySet > > aAllColumns;
1934cdf0e10cSrcweir 
1935cdf0e10cSrcweir 			for(sal_Int32 i=1; i <= nCount ;++i)
1936cdf0e10cSrcweir 			{
1937cdf0e10cSrcweir 				::rtl::OUString sName = xMeta->getColumnName(i);
1938cdf0e10cSrcweir                 ::rtl::OUString sColumnLabel = xMeta->getColumnLabel(i);
1939cdf0e10cSrcweir 
1940cdf0e10cSrcweir                 // retrieve the column number |i|
1941cdf0e10cSrcweir 				Reference<XPropertySet> xColumn;
1942cdf0e10cSrcweir                 {
1943cdf0e10cSrcweir 				    sal_Bool bReFetchName = sal_False;
1944cdf0e10cSrcweir                     if (m_xColumns->hasByName(sColumnLabel))
1945cdf0e10cSrcweir 					    m_xColumns->getByName(sColumnLabel) >>= xColumn;
1946cdf0e10cSrcweir 				    if (!xColumn.is() && m_xColumns->hasByName(sName))
1947cdf0e10cSrcweir 					    m_xColumns->getByName(sName) >>= xColumn;
1948cdf0e10cSrcweir 
1949cdf0e10cSrcweir 				    // check if column already in the list we need another
1950cdf0e10cSrcweir 				    if ( aAllColumns.find( xColumn ) != aAllColumns.end() )
1951cdf0e10cSrcweir 				    {
1952cdf0e10cSrcweir 					    xColumn = NULL;
1953cdf0e10cSrcweir 					    bReFetchName = sal_True;
1954cdf0e10cSrcweir                         sColumnLabel = ::rtl::OUString();
1955cdf0e10cSrcweir 				    }
1956cdf0e10cSrcweir 				    if(!xColumn.is())
1957cdf0e10cSrcweir 				    {
1958cdf0e10cSrcweir 					    // no column found so we could look at the position i
1959cdf0e10cSrcweir                         //bReFetchName = sal_True;
1960cdf0e10cSrcweir                         //sColumnLabel = ::rtl::OUString();
1961cdf0e10cSrcweir 					    Reference<XIndexAccess> xIndexAccess(m_xColumns,UNO_QUERY);
1962cdf0e10cSrcweir 					    if(xIndexAccess.is() && i <= xIndexAccess->getCount())
1963cdf0e10cSrcweir 					    {
1964cdf0e10cSrcweir 						    xIndexAccess->getByIndex(i-1) >>= xColumn;
1965cdf0e10cSrcweir 					    }
1966cdf0e10cSrcweir 					    else
1967cdf0e10cSrcweir 					    {
1968cdf0e10cSrcweir 						    Sequence< ::rtl::OUString> aSeq = m_xColumns->getElementNames();
1969cdf0e10cSrcweir 						    if( i <= aSeq.getLength())
1970cdf0e10cSrcweir                             {
1971cdf0e10cSrcweir 							    m_xColumns->getByName(aSeq.getConstArray()[i-1]) >>= xColumn;
1972cdf0e10cSrcweir                             }
1973cdf0e10cSrcweir 					    }
1974cdf0e10cSrcweir 				    }
1975cdf0e10cSrcweir 				    if(bReFetchName && xColumn.is())
1976cdf0e10cSrcweir 					    xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
1977cdf0e10cSrcweir 				    aAllColumns.insert( xColumn );
1978cdf0e10cSrcweir                 }
1979cdf0e10cSrcweir 
1980cdf0e10cSrcweir                 // create a RowSetDataColumn
1981cdf0e10cSrcweir                 {
1982cdf0e10cSrcweir 				    Reference<XPropertySetInfo> xInfo = xColumn.is() ? xColumn->getPropertySetInfo() : Reference<XPropertySetInfo>();
1983cdf0e10cSrcweir 				    if(xInfo.is() && xInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
1984cdf0e10cSrcweir 					    aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
1985cdf0e10cSrcweir 
1986cdf0e10cSrcweir                     ::rtl::OUString sParseLabel;
1987cdf0e10cSrcweir                     if ( xColumn.is() )
1988cdf0e10cSrcweir                     {
1989cdf0e10cSrcweir                         xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
1990cdf0e10cSrcweir                     }
1991cdf0e10cSrcweir 				    ORowSetDataColumn* pColumn = new ORowSetDataColumn(	getMetaData(),
1992cdf0e10cSrcweir 																	    this,
1993cdf0e10cSrcweir 																	    this,
1994cdf0e10cSrcweir 																	    i,
1995cdf0e10cSrcweir                                                                         m_xActiveConnection->getMetaData(),
1996cdf0e10cSrcweir 																	    aDescription,
1997cdf0e10cSrcweir                                                                         sParseLabel,
1998cdf0e10cSrcweir 																	    m_aCurrentRow);
1999cdf0e10cSrcweir 				    aColumns->get().push_back(pColumn);
2000cdf0e10cSrcweir 
2001cdf0e10cSrcweir                     pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i) != rKeyColumns.end()));
2002cdf0e10cSrcweir 
2003cdf0e10cSrcweir 				    if(!sColumnLabel.getLength())
2004cdf0e10cSrcweir 				    {
2005cdf0e10cSrcweir 					    if(xColumn.is())
2006cdf0e10cSrcweir 						    xColumn->getPropertyValue(PROPERTY_NAME) >>= sColumnLabel;
2007cdf0e10cSrcweir 					    else
2008cdf0e10cSrcweir 						    sColumnLabel = DBACORE_RESSTRING( RID_STR_EXPRESSION1 );
2009cdf0e10cSrcweir 				    }
2010cdf0e10cSrcweir 				    pColumn->setName(sColumnLabel);
2011cdf0e10cSrcweir 				    aNames.push_back(sColumnLabel);
2012cdf0e10cSrcweir 				    m_aDataColumns.push_back(pColumn);
2013cdf0e10cSrcweir 
2014cdf0e10cSrcweir                     if ( xColumn.is() )
2015cdf0e10cSrcweir                         impl_initializeColumnSettings_nothrow( xColumn, pColumn );
2016cdf0e10cSrcweir                 }
2017cdf0e10cSrcweir 			}
2018cdf0e10cSrcweir 		}
2019cdf0e10cSrcweir 		// now create the columns we need
2020cdf0e10cSrcweir 		if(m_pColumns)
2021cdf0e10cSrcweir 			m_pColumns->assign(aColumns,aNames);
2022cdf0e10cSrcweir 		else
2023cdf0e10cSrcweir 		{
2024cdf0e10cSrcweir 			Reference<XDatabaseMetaData> xMeta = m_xActiveConnection->getMetaData();
2025cdf0e10cSrcweir 			m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),
2026cdf0e10cSrcweir 												aColumns,*this,m_aColumnsMutex,aNames);
2027cdf0e10cSrcweir 		}
2028cdf0e10cSrcweir 	}
2029cdf0e10cSrcweir 	checkCache();
2030cdf0e10cSrcweir 	// notify the rowset listeners
2031cdf0e10cSrcweir 	notifyAllListeners(_rClearForNotification);
2032cdf0e10cSrcweir }
2033cdf0e10cSrcweir // -------------------------------------------------------------------------
2034cdf0e10cSrcweir // XRowSetApproveBroadcaster
addRowSetApproveListener(const Reference<XRowSetApproveListener> & listener)2035cdf0e10cSrcweir void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException)
2036cdf0e10cSrcweir {
2037cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2038cdf0e10cSrcweir 
2039cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2040cdf0e10cSrcweir 
2041cdf0e10cSrcweir 	m_aApproveListeners.addInterface(listener);
2042cdf0e10cSrcweir }
2043cdf0e10cSrcweir // -------------------------------------------------------------------------
removeRowSetApproveListener(const Reference<XRowSetApproveListener> & listener)2044cdf0e10cSrcweir void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException)
2045cdf0e10cSrcweir {
2046cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2047cdf0e10cSrcweir 
2048cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2049cdf0e10cSrcweir 
2050cdf0e10cSrcweir 	m_aApproveListeners.removeInterface(listener);
2051cdf0e10cSrcweir }
2052cdf0e10cSrcweir // XRowsChangeBroadcaster
addRowsChangeListener(const Reference<XRowsChangeListener> & listener)2053cdf0e10cSrcweir void SAL_CALL ORowSet::addRowsChangeListener( const Reference< XRowsChangeListener >& listener ) throw(RuntimeException)
2054cdf0e10cSrcweir {
2055cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2056cdf0e10cSrcweir 
2057cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2058cdf0e10cSrcweir 
2059cdf0e10cSrcweir 	m_aRowsChangeListener.addInterface(listener);
2060cdf0e10cSrcweir }
2061cdf0e10cSrcweir // -------------------------------------------------------------------------
removeRowsChangeListener(const Reference<XRowsChangeListener> & listener)2062cdf0e10cSrcweir void SAL_CALL ORowSet::removeRowsChangeListener( const Reference< XRowsChangeListener >& listener ) throw(RuntimeException)
2063cdf0e10cSrcweir {
2064cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2065cdf0e10cSrcweir 
2066cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2067cdf0e10cSrcweir 
2068cdf0e10cSrcweir 	m_aRowsChangeListener.removeInterface(listener);
2069cdf0e10cSrcweir }
2070cdf0e10cSrcweir // -------------------------------------------------------------------------
2071cdf0e10cSrcweir 
2072cdf0e10cSrcweir // XResultSetAccess
createResultSet()2073cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ORowSet::createResultSet(  ) throw(SQLException, RuntimeException)
2074cdf0e10cSrcweir {
2075cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2076cdf0e10cSrcweir 
2077cdf0e10cSrcweir 	if(m_xStatement.is())
2078cdf0e10cSrcweir 	{
2079cdf0e10cSrcweir 		ORowSetClone* pClone = new ORowSetClone( m_aContext, *this, m_pMutex );
2080cdf0e10cSrcweir 		Reference< XResultSet > xRet(pClone);
2081cdf0e10cSrcweir 		m_aClones.push_back(WeakReferenceHelper(xRet));
2082cdf0e10cSrcweir 		return xRet;
2083cdf0e10cSrcweir 	}
2084cdf0e10cSrcweir 	return Reference< XResultSet >();
2085cdf0e10cSrcweir }
2086cdf0e10cSrcweir // -------------------------------------------------------------------------
2087cdf0e10cSrcweir 
2088cdf0e10cSrcweir // ::com::sun::star::util::XCancellable
cancel()2089cdf0e10cSrcweir void SAL_CALL ORowSet::cancel(  ) throw(RuntimeException)
2090cdf0e10cSrcweir {
2091cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2092cdf0e10cSrcweir }
2093cdf0e10cSrcweir // -------------------------------------------------------------------------
2094cdf0e10cSrcweir 
2095cdf0e10cSrcweir // ::com::sun::star::sdbcx::XDeleteRows
deleteRows(const Sequence<Any> & rows)2096cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException)
2097cdf0e10cSrcweir {
2098cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2099cdf0e10cSrcweir 
2100cdf0e10cSrcweir 	if(!m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
2101cdf0e10cSrcweir 		throwFunctionSequenceException(*this);
2102cdf0e10cSrcweir 
2103cdf0e10cSrcweir 	::osl::ResettableMutexGuard aGuard( *m_pMutex );
2104cdf0e10cSrcweir 
2105cdf0e10cSrcweir     Sequence<Any> aChangedBookmarks;
2106cdf0e10cSrcweir 	RowsChangeEvent aEvt(*this,RowChangeAction::DELETE,rows.getLength(),aChangedBookmarks);
2107cdf0e10cSrcweir 	// notify the rowset listeners
2108cdf0e10cSrcweir 	notifyAllListenersRowBeforeChange(aGuard,aEvt);
2109cdf0e10cSrcweir 
2110cdf0e10cSrcweir     Sequence< sal_Int32 > aResults( rows.getLength() );
2111cdf0e10cSrcweir     const Any* row = rows.getConstArray();
2112cdf0e10cSrcweir     const Any* rowEnd = rows.getConstArray() + rows.getLength();
2113cdf0e10cSrcweir     sal_Int32* result = aResults.getArray();
2114cdf0e10cSrcweir     for ( ; row != rowEnd; ++row, ++result )
2115cdf0e10cSrcweir     {
2116cdf0e10cSrcweir         *result = 0;
2117cdf0e10cSrcweir         if ( !m_pCache->moveToBookmark( *row ) )
2118cdf0e10cSrcweir             continue;
2119cdf0e10cSrcweir         sal_Int32 nDeletePosition = m_pCache->getRow();
2120cdf0e10cSrcweir 
2121cdf0e10cSrcweir         // first notify the clones so that they can save their position
2122cdf0e10cSrcweir 		notifyRowSetAndClonesRowDelete( *row );
2123cdf0e10cSrcweir 
2124cdf0e10cSrcweir         // now delete the row
2125cdf0e10cSrcweir         if ( !m_pCache->deleteRow() )
2126cdf0e10cSrcweir             continue;
2127cdf0e10cSrcweir         *result = 1;
2128cdf0e10cSrcweir         // now notify that we have deleted
2129cdf0e10cSrcweir 		notifyRowSetAndClonesRowDeleted( *row, nDeletePosition );
2130cdf0e10cSrcweir     }
2131cdf0e10cSrcweir 	aEvt.Rows = aResults.getLength();
2132cdf0e10cSrcweir 
2133cdf0e10cSrcweir 	// we have to check if we stand on the insert row and if so we have to reset it
2134cdf0e10cSrcweir 	ORowSetNotifier aNotifier( this );
2135cdf0e10cSrcweir 		// this will call cancelRowModification on the cache if necessary
2136cdf0e10cSrcweir 	// notification order
2137cdf0e10cSrcweir 	// - rowChanged
2138cdf0e10cSrcweir 	notifyAllListenersRowChanged(aGuard,aEvt);
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir 	// - IsModified
2141cdf0e10cSrcweir 	// - IsNew
2142cdf0e10cSrcweir 	aNotifier.fire();
2143cdf0e10cSrcweir 
2144cdf0e10cSrcweir 	// - RowCount/IsRowCountFinal
2145cdf0e10cSrcweir 	fireRowcount();
2146cdf0e10cSrcweir 
2147cdf0e10cSrcweir     return aResults;
2148cdf0e10cSrcweir }
2149cdf0e10cSrcweir // -----------------------------------------------------------------------------
notifyRowSetAndClonesRowDelete(const Any & _rBookmark)2150cdf0e10cSrcweir void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
2151cdf0e10cSrcweir {
2152cdf0e10cSrcweir     // notify ourself
2153cdf0e10cSrcweir     onDeleteRow( _rBookmark );
2154cdf0e10cSrcweir     // notify the clones
2155cdf0e10cSrcweir     connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
2156cdf0e10cSrcweir 	for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
2157cdf0e10cSrcweir 	{
2158cdf0e10cSrcweir 		Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
2159cdf0e10cSrcweir 		if(xTunnel.is())
2160cdf0e10cSrcweir 		{
2161cdf0e10cSrcweir 			ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelImplementationId()));
2162cdf0e10cSrcweir 			if(pClone)
2163cdf0e10cSrcweir 				pClone->onDeleteRow( _rBookmark );
2164cdf0e10cSrcweir 		}
2165cdf0e10cSrcweir 	}
2166cdf0e10cSrcweir }
2167cdf0e10cSrcweir //------------------------------------------------------------------------------
notifyRowSetAndClonesRowDeleted(const Any & _rBookmark,sal_Int32 _nPos)2168cdf0e10cSrcweir void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 _nPos )
2169cdf0e10cSrcweir {
2170cdf0e10cSrcweir     // notify ourself
2171cdf0e10cSrcweir     onDeletedRow( _rBookmark, _nPos );
2172cdf0e10cSrcweir     // notify the clones
2173cdf0e10cSrcweir     connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
2174cdf0e10cSrcweir 	for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
2175cdf0e10cSrcweir 	{
2176cdf0e10cSrcweir 		Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
2177cdf0e10cSrcweir 		if(xTunnel.is())
2178cdf0e10cSrcweir 		{
2179cdf0e10cSrcweir 			ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelImplementationId()));
2180cdf0e10cSrcweir 			if(pClone)
2181cdf0e10cSrcweir 				pClone->onDeletedRow( _rBookmark, _nPos );
2182cdf0e10cSrcweir 		}
2183cdf0e10cSrcweir 	}
2184cdf0e10cSrcweir }
2185cdf0e10cSrcweir //------------------------------------------------------------------------------
calcConnection(const Reference<XInteractionHandler> & _rxHandler)2186cdf0e10cSrcweir Reference< XConnection >  ORowSet::calcConnection(const Reference< XInteractionHandler >& _rxHandler) throw( SQLException, RuntimeException )
2187cdf0e10cSrcweir {
2188cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
2189cdf0e10cSrcweir 	if (!m_xActiveConnection.is())
2190cdf0e10cSrcweir 	{
2191cdf0e10cSrcweir 		Reference< XConnection > xNewConn;
2192cdf0e10cSrcweir 		if ( m_aDataSourceName.getLength() )
2193cdf0e10cSrcweir 		{
2194cdf0e10cSrcweir             Reference< XNameAccess > xDatabaseContext(
2195cdf0e10cSrcweir                 m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ),
2196cdf0e10cSrcweir                 UNO_QUERY_THROW );
2197cdf0e10cSrcweir             try
2198cdf0e10cSrcweir             {
2199cdf0e10cSrcweir                 Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_aDataSourceName ), UNO_QUERY_THROW );
2200cdf0e10cSrcweir 
2201cdf0e10cSrcweir                 // try connecting with the interaction handler
2202cdf0e10cSrcweir                 Reference< XCompletedConnection > xComplConn( xDataSource, UNO_QUERY );
2203cdf0e10cSrcweir                 if ( _rxHandler.is() && xComplConn.is() )
2204cdf0e10cSrcweir                 {
2205cdf0e10cSrcweir                     xNewConn = xComplConn->connectWithCompletion( _rxHandler );
2206cdf0e10cSrcweir                 }
2207cdf0e10cSrcweir                 else
2208cdf0e10cSrcweir                 {
2209cdf0e10cSrcweir                     xNewConn = xDataSource->getConnection( m_aUser, m_aPassword );
2210cdf0e10cSrcweir                 }
2211cdf0e10cSrcweir             }
2212cdf0e10cSrcweir             catch ( const SQLException& e )
2213cdf0e10cSrcweir             {
2214cdf0e10cSrcweir                 throw;
2215cdf0e10cSrcweir             }
2216cdf0e10cSrcweir             catch ( const Exception& e )
2217cdf0e10cSrcweir             {
2218cdf0e10cSrcweir                 Any aError = ::cppu::getCaughtException();
2219cdf0e10cSrcweir                 ::rtl::OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE,
2220cdf0e10cSrcweir                     "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) );
2221cdf0e10cSrcweir                 ::dbtools::throwGenericSQLException( sMessage, *this );
2222cdf0e10cSrcweir             }
2223cdf0e10cSrcweir         }
2224cdf0e10cSrcweir 		setActiveConnection(xNewConn);
2225cdf0e10cSrcweir 		m_bOwnConnection = sal_True;
2226cdf0e10cSrcweir 	}
2227cdf0e10cSrcweir 	return m_xActiveConnection;
2228cdf0e10cSrcweir }
2229cdf0e10cSrcweir //------------------------------------------------------------------------------
impl_getTables_throw()2230cdf0e10cSrcweir Reference< XNameAccess > ORowSet::impl_getTables_throw()
2231cdf0e10cSrcweir {
2232cdf0e10cSrcweir     Reference< XNameAccess > xTables;
2233cdf0e10cSrcweir 
2234cdf0e10cSrcweir 	Reference< XTablesSupplier >  xTablesAccess( m_xActiveConnection, UNO_QUERY );
2235cdf0e10cSrcweir 	if ( xTablesAccess.is() )
2236cdf0e10cSrcweir 	{
2237cdf0e10cSrcweir 		xTables.set( xTablesAccess->getTables(), UNO_QUERY_THROW );
2238cdf0e10cSrcweir 	}
2239cdf0e10cSrcweir 	else if ( m_pTables )
2240cdf0e10cSrcweir     {
2241cdf0e10cSrcweir         xTables = m_pTables;
2242cdf0e10cSrcweir     }
2243cdf0e10cSrcweir     else
2244cdf0e10cSrcweir 	{
2245cdf0e10cSrcweir 		if ( !m_xActiveConnection.is() )
2246cdf0e10cSrcweir             throw SQLException(DBA_RES(RID_STR_CONNECTION_INVALID),*this,SQLSTATE_GENERAL,1000,Any() );
2247cdf0e10cSrcweir 
2248cdf0e10cSrcweir         sal_Bool bCase = sal_True;
2249cdf0e10cSrcweir 		try
2250cdf0e10cSrcweir 		{
2251cdf0e10cSrcweir 			Reference<XDatabaseMetaData> xMeta = m_xActiveConnection->getMetaData();
2252cdf0e10cSrcweir 			bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers();
2253cdf0e10cSrcweir 		}
2254cdf0e10cSrcweir 		catch(SQLException&)
2255cdf0e10cSrcweir 		{
2256cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
2257cdf0e10cSrcweir 		}
2258cdf0e10cSrcweir 
2259cdf0e10cSrcweir         m_pTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,NULL,NULL,NULL,m_nInAppend);
2260cdf0e10cSrcweir 		xTables = m_pTables;
2261cdf0e10cSrcweir 		Sequence< ::rtl::OUString> aTableFilter(1);
2262cdf0e10cSrcweir 		aTableFilter[0] = ::rtl::OUString::createFromAscii("%");
2263cdf0e10cSrcweir 		m_pTables->construct(aTableFilter,Sequence< ::rtl::OUString>());
2264cdf0e10cSrcweir 	}
2265cdf0e10cSrcweir 
2266cdf0e10cSrcweir     return xTables;
2267cdf0e10cSrcweir }
2268cdf0e10cSrcweir 
2269cdf0e10cSrcweir //------------------------------------------------------------------------------
impl_resetTables_nothrow()2270cdf0e10cSrcweir void ORowSet::impl_resetTables_nothrow()
2271cdf0e10cSrcweir {
2272cdf0e10cSrcweir     if ( !m_pTables )
2273cdf0e10cSrcweir         return;
2274cdf0e10cSrcweir 
2275cdf0e10cSrcweir     try
2276cdf0e10cSrcweir     {
2277cdf0e10cSrcweir 		m_pTables->dispose();
2278cdf0e10cSrcweir     }
2279cdf0e10cSrcweir     catch( const Exception& )
2280cdf0e10cSrcweir     {
2281cdf0e10cSrcweir     	DBG_UNHANDLED_EXCEPTION();
2282cdf0e10cSrcweir     }
2283cdf0e10cSrcweir 
2284cdf0e10cSrcweir     DELETEZ( m_pTables );
2285cdf0e10cSrcweir }
2286cdf0e10cSrcweir 
2287cdf0e10cSrcweir //------------------------------------------------------------------------------
impl_initComposer_throw(::rtl::OUString & _out_rCommandToExecute)2288cdf0e10cSrcweir sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecute )
2289cdf0e10cSrcweir {
2290cdf0e10cSrcweir 	sal_Bool bUseEscapeProcessing = impl_buildActiveCommand_throw( );
2291cdf0e10cSrcweir     _out_rCommandToExecute = m_aActiveCommand;
2292cdf0e10cSrcweir     if ( !bUseEscapeProcessing )
2293cdf0e10cSrcweir         return bUseEscapeProcessing;
2294cdf0e10cSrcweir 
2295cdf0e10cSrcweir 	Reference< XMultiServiceFactory > xFactory( m_xActiveConnection, UNO_QUERY );
2296cdf0e10cSrcweir     if ( xFactory.is() )
2297cdf0e10cSrcweir     {
2298cdf0e10cSrcweir 	    try
2299cdf0e10cSrcweir 	    {
2300cdf0e10cSrcweir             ::comphelper::disposeComponent( m_xComposer );
2301cdf0e10cSrcweir 		    m_xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW );
2302cdf0e10cSrcweir 	    }
2303cdf0e10cSrcweir 	    catch (const Exception& ) { m_xComposer = NULL; }
2304cdf0e10cSrcweir     }
2305cdf0e10cSrcweir 	if ( !m_xComposer.is() )
2306cdf0e10cSrcweir 		m_xComposer = new OSingleSelectQueryComposer( impl_getTables_throw(), m_xActiveConnection, m_aContext );
2307cdf0e10cSrcweir 
2308cdf0e10cSrcweir 	m_xComposer->setCommand( m_aCommand,m_nCommandType );
2309cdf0e10cSrcweir     m_aActiveCommand = m_xComposer->getQuery();
2310cdf0e10cSrcweir 
2311cdf0e10cSrcweir     m_xComposer->setFilter( m_bApplyFilter ? m_aFilter : ::rtl::OUString() );
2312cdf0e10cSrcweir     m_xComposer->setHavingClause( m_bApplyFilter ? m_aHavingClause : ::rtl::OUString() );
2313cdf0e10cSrcweir 
2314cdf0e10cSrcweir     if ( m_bIgnoreResult )
2315cdf0e10cSrcweir     {   // append a "0=1" filter
2316cdf0e10cSrcweir         // don't simply overwrite an existent filter, this would lead to problems if this existent
231707a3d7f1SPedro Giffuni         // filter contains parameters (since a keyset may add parameters itself)
2318cdf0e10cSrcweir         // 2003-12-12 - #23418# - fs@openoffice.org
2319cdf0e10cSrcweir         m_xComposer->setElementaryQuery( m_xComposer->getQuery( ) );
2320cdf0e10cSrcweir         m_xComposer->setFilter( ::rtl::OUString::createFromAscii( "0 = 1" ) );
2321cdf0e10cSrcweir     }
2322cdf0e10cSrcweir 
2323cdf0e10cSrcweir 	m_xComposer->setOrder( m_aOrder );
2324cdf0e10cSrcweir 	m_xComposer->setGroup( m_aGroupBy );
2325cdf0e10cSrcweir 
2326cdf0e10cSrcweir     if ( !m_xColumns.is() )
2327cdf0e10cSrcweir     {
2328cdf0e10cSrcweir 	    Reference< XColumnsSupplier > xCols( m_xComposer, UNO_QUERY_THROW );
2329cdf0e10cSrcweir 	    m_xColumns = xCols->getColumns();
2330cdf0e10cSrcweir     }
2331cdf0e10cSrcweir 
2332cdf0e10cSrcweir     impl_initParametersContainer_nothrow();
2333cdf0e10cSrcweir 
2334cdf0e10cSrcweir     _out_rCommandToExecute = m_xComposer->getQueryWithSubstitution();
2335cdf0e10cSrcweir 
2336cdf0e10cSrcweir     return bUseEscapeProcessing;
2337cdf0e10cSrcweir }
2338cdf0e10cSrcweir 
2339cdf0e10cSrcweir //------------------------------------------------------------------------------
impl_buildActiveCommand_throw()2340cdf0e10cSrcweir sal_Bool ORowSet::impl_buildActiveCommand_throw()
2341cdf0e10cSrcweir {
2342cdf0e10cSrcweir 	// create the sql command
2343cdf0e10cSrcweir 	// from a table name or get the command out of a query (not a view)
2344cdf0e10cSrcweir 	// the last use the command as it is
2345cdf0e10cSrcweir 	sal_Bool bDoEscapeProcessing = m_bUseEscapeProcessing;
2346cdf0e10cSrcweir 
2347cdf0e10cSrcweir     m_aActiveCommand = ::rtl::OUString();
2348cdf0e10cSrcweir     ::rtl::OUString sCommand;
2349cdf0e10cSrcweir 
2350cdf0e10cSrcweir 	if ( !m_aCommand.getLength() )
2351cdf0e10cSrcweir         return bDoEscapeProcessing;
2352cdf0e10cSrcweir 
2353cdf0e10cSrcweir 	switch (m_nCommandType)
2354cdf0e10cSrcweir 	{
2355cdf0e10cSrcweir 		case CommandType::TABLE:
2356cdf0e10cSrcweir 		{
2357cdf0e10cSrcweir             impl_resetTables_nothrow();
2358cdf0e10cSrcweir             if ( bDoEscapeProcessing )
2359cdf0e10cSrcweir             {
2360cdf0e10cSrcweir                 Reference< XNameAccess > xTables( impl_getTables_throw() );
2361cdf0e10cSrcweir                 if ( xTables->hasByName(m_aCommand) )
2362cdf0e10cSrcweir 			    {
2363cdf0e10cSrcweir /*
2364cdf0e10cSrcweir 				    Reference< XPropertySet > xTable;
2365cdf0e10cSrcweir 				    try
2366cdf0e10cSrcweir 				    {
2367cdf0e10cSrcweir                         xTables->getByName( m_aCommand ) >>= xTable;
2368cdf0e10cSrcweir 				    }
2369cdf0e10cSrcweir 				    catch(const WrappedTargetException& e)
2370cdf0e10cSrcweir 				    {
2371cdf0e10cSrcweir 					    SQLException e2;
2372cdf0e10cSrcweir 					    if ( e.TargetException >>= e2 )
2373cdf0e10cSrcweir 						    throw e2;
2374cdf0e10cSrcweir 				    }
2375cdf0e10cSrcweir 				    catch(Exception&)
2376cdf0e10cSrcweir 				    {
2377cdf0e10cSrcweir                         DBG_UNHANDLED_EXCEPTION();
2378cdf0e10cSrcweir 				    }
2379cdf0e10cSrcweir 
2380cdf0e10cSrcweir 				    Reference<XColumnsSupplier> xSup(xTable,UNO_QUERY);
2381cdf0e10cSrcweir 				    if ( xSup.is() )
2382cdf0e10cSrcweir 					    m_xColumns = xSup->getColumns();
2383cdf0e10cSrcweir 
2384cdf0e10cSrcweir 				    sCommand = rtl::OUString::createFromAscii("SELECT * FROM ");
2385cdf0e10cSrcweir 				    ::rtl::OUString sCatalog, sSchema, sTable;
2386cdf0e10cSrcweir 				    ::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
2387cdf0e10cSrcweir 				    sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable );
2388cdf0e10cSrcweir */
2389cdf0e10cSrcweir 			    }
2390cdf0e10cSrcweir 			    else
2391cdf0e10cSrcweir 			    {
2392cdf0e10cSrcweir                     String sMessage( DBACORE_RESSTRING( RID_STR_TABLE_DOES_NOT_EXIST ) );
2393cdf0e10cSrcweir                     sMessage.SearchAndReplaceAscii( "$table$", m_aCommand );
2394cdf0e10cSrcweir                     throwGenericSQLException(sMessage,*this);
2395cdf0e10cSrcweir 			    }
2396cdf0e10cSrcweir             }
2397cdf0e10cSrcweir             else
2398cdf0e10cSrcweir             {
2399cdf0e10cSrcweir                 sCommand = rtl::OUString::createFromAscii("SELECT * FROM ");
2400cdf0e10cSrcweir 			    ::rtl::OUString sCatalog, sSchema, sTable;
2401cdf0e10cSrcweir 			    ::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
2402cdf0e10cSrcweir 			    sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable );
2403cdf0e10cSrcweir             }
2404cdf0e10cSrcweir 		}
2405cdf0e10cSrcweir         break;
2406cdf0e10cSrcweir 
2407cdf0e10cSrcweir 		case CommandType::QUERY:
2408cdf0e10cSrcweir 		{
2409cdf0e10cSrcweir 			Reference< XQueriesSupplier >  xQueriesAccess(m_xActiveConnection, UNO_QUERY);
2410cdf0e10cSrcweir 			if (xQueriesAccess.is())
2411cdf0e10cSrcweir 			{
2412cdf0e10cSrcweir 				Reference< ::com::sun::star::container::XNameAccess >  xQueries(xQueriesAccess->getQueries());
2413cdf0e10cSrcweir 				if (xQueries->hasByName(m_aCommand))
2414cdf0e10cSrcweir 				{
2415cdf0e10cSrcweir 					Reference< XPropertySet > xQuery(xQueries->getByName(m_aCommand),UNO_QUERY);
2416cdf0e10cSrcweir 					OSL_ENSURE(xQuery.is(),"ORowSet::impl_buildActiveCommand_throw: Query is NULL!");
2417cdf0e10cSrcweir 					if ( xQuery.is() )
2418cdf0e10cSrcweir 					{
2419cdf0e10cSrcweir 						xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sCommand;
2420cdf0e10cSrcweir                         xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bDoEscapeProcessing;
2421cdf0e10cSrcweir                         if ( bDoEscapeProcessing != m_bUseEscapeProcessing )
2422cdf0e10cSrcweir                         {
2423cdf0e10cSrcweir                             sal_Bool bOldValue = m_bUseEscapeProcessing;
2424cdf0e10cSrcweir                             m_bUseEscapeProcessing = bDoEscapeProcessing;
2425cdf0e10cSrcweir                             fireProperty(PROPERTY_ID_ESCAPE_PROCESSING,bOldValue,bDoEscapeProcessing);
2426cdf0e10cSrcweir                         }
2427cdf0e10cSrcweir 
2428cdf0e10cSrcweir 						::rtl::OUString aCatalog,aSchema,aTable;
2429cdf0e10cSrcweir 						xQuery->getPropertyValue(PROPERTY_UPDATE_CATALOGNAME)	>>= aCatalog;
2430cdf0e10cSrcweir 						xQuery->getPropertyValue(PROPERTY_UPDATE_SCHEMANAME)	>>= aSchema;
2431cdf0e10cSrcweir 						xQuery->getPropertyValue(PROPERTY_UPDATE_TABLENAME)		>>= aTable;
2432cdf0e10cSrcweir 						if(aTable.getLength())
2433cdf0e10cSrcweir 							m_aUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), aCatalog, aSchema, aTable, sal_False, ::dbtools::eInDataManipulation );
2434cdf0e10cSrcweir /*
2435cdf0e10cSrcweir 						Reference<XColumnsSupplier> xSup(xQuery,UNO_QUERY);
2436cdf0e10cSrcweir 						if(xSup.is())
2437cdf0e10cSrcweir 							m_xColumns = xSup->getColumns();
2438cdf0e10cSrcweir */
2439cdf0e10cSrcweir 					}
2440cdf0e10cSrcweir 				}
2441cdf0e10cSrcweir 				else
2442cdf0e10cSrcweir 				{
2443cdf0e10cSrcweir                     String sMessage( DBACORE_RESSTRING( RID_STR_QUERY_DOES_NOT_EXIST ) );
2444cdf0e10cSrcweir                     sMessage.SearchAndReplaceAscii( "$table$", m_aCommand );
2445cdf0e10cSrcweir                     throwGenericSQLException(sMessage,*this);
2446cdf0e10cSrcweir 				}
2447cdf0e10cSrcweir 			}
2448cdf0e10cSrcweir 			else
2449cdf0e10cSrcweir 				throw SQLException(DBA_RES(RID_STR_NO_XQUERIESSUPPLIER),*this,::rtl::OUString(),0,Any());
2450cdf0e10cSrcweir 		}
2451cdf0e10cSrcweir         break;
2452cdf0e10cSrcweir 
2453cdf0e10cSrcweir         default:
2454cdf0e10cSrcweir 			sCommand = m_aCommand;
2455cdf0e10cSrcweir             break;
2456cdf0e10cSrcweir 	}
2457cdf0e10cSrcweir 
2458cdf0e10cSrcweir     m_aActiveCommand = sCommand;
2459cdf0e10cSrcweir 
2460cdf0e10cSrcweir     if ( !m_aActiveCommand.getLength() && !bDoEscapeProcessing )
2461cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
2462cdf0e10cSrcweir 
2463cdf0e10cSrcweir     return bDoEscapeProcessing;
2464cdf0e10cSrcweir }
2465cdf0e10cSrcweir 
2466cdf0e10cSrcweir //------------------------------------------------------------------------------
impl_initParametersContainer_nothrow()2467cdf0e10cSrcweir void ORowSet::impl_initParametersContainer_nothrow()
2468cdf0e10cSrcweir {
2469cdf0e10cSrcweir     OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" );
2470cdf0e10cSrcweir 
2471cdf0e10cSrcweir     m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() );
2472cdf0e10cSrcweir     // copy the premature parameters into the final ones
2473cdf0e10cSrcweir     size_t nParamCount( ::std::min( m_pParameters->size(), m_aPrematureParamValues.get().size() ) );
2474cdf0e10cSrcweir     for ( size_t i=0; i<nParamCount; ++i )
2475cdf0e10cSrcweir     {
2476cdf0e10cSrcweir         (*m_pParameters)[i] = m_aPrematureParamValues.get()[i];
2477cdf0e10cSrcweir     }
2478cdf0e10cSrcweir }
2479cdf0e10cSrcweir 
2480cdf0e10cSrcweir //------------------------------------------------------------------------------
impl_disposeParametersContainer_nothrow()2481cdf0e10cSrcweir void ORowSet::impl_disposeParametersContainer_nothrow()
2482cdf0e10cSrcweir {
2483cdf0e10cSrcweir     if ( !m_pParameters.is() )
2484cdf0e10cSrcweir         return;
2485cdf0e10cSrcweir 
2486cdf0e10cSrcweir     // copy the actual values to our "premature" ones, to preserve them for later use
2487cdf0e10cSrcweir     size_t nParamCount( m_pParameters->size() );
2488cdf0e10cSrcweir     m_aPrematureParamValues.get().resize( nParamCount );
2489cdf0e10cSrcweir     for ( size_t i=0; i<nParamCount; ++i )
2490cdf0e10cSrcweir     {
2491cdf0e10cSrcweir         m_aPrematureParamValues.get()[i] = (*m_pParameters)[i];
2492cdf0e10cSrcweir     }
2493cdf0e10cSrcweir 
2494cdf0e10cSrcweir     m_pParameters->dispose();
2495cdf0e10cSrcweir     m_pParameters = NULL;
2496cdf0e10cSrcweir }
2497cdf0e10cSrcweir 
2498cdf0e10cSrcweir // -----------------------------------------------------------------------------
getParameterStorage(sal_Int32 parameterIndex)2499cdf0e10cSrcweir ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex)
2500cdf0e10cSrcweir {
2501cdf0e10cSrcweir 	::connectivity::checkDisposed( ORowSet_BASE1::rBHelper.bDisposed );
2502cdf0e10cSrcweir 	if ( parameterIndex < 1 )
2503cdf0e10cSrcweir 		throwInvalidIndexException( *this );
2504cdf0e10cSrcweir 
2505cdf0e10cSrcweir     if ( m_aParametersSet.size() < (size_t)parameterIndex )
2506cdf0e10cSrcweir 		m_aParametersSet.resize( parameterIndex ,false);
2507cdf0e10cSrcweir     m_aParametersSet[parameterIndex - 1] = true;
2508cdf0e10cSrcweir 
2509cdf0e10cSrcweir     if ( m_aParametersSet.size() < (size_t)parameterIndex )
2510cdf0e10cSrcweir 		m_aParametersSet.resize( parameterIndex ,false);
2511cdf0e10cSrcweir     m_aParametersSet[parameterIndex - 1] = true;
2512cdf0e10cSrcweir 
2513cdf0e10cSrcweir     if ( m_pParameters.is() )
2514cdf0e10cSrcweir     {
2515cdf0e10cSrcweir 		if ( m_bCommandFacetsDirty )
2516cdf0e10cSrcweir         // need to rebuild the parameters, since some property which contributes to the
2517cdf0e10cSrcweir         // complete command, and thus the parameters, changed
2518cdf0e10cSrcweir 			impl_disposeParametersContainer_nothrow();
2519cdf0e10cSrcweir 		if ( m_pParameters.is() )
2520cdf0e10cSrcweir 		{
2521cdf0e10cSrcweir 			if ( (size_t)parameterIndex > m_pParameters->size() )
2522cdf0e10cSrcweir 				throwInvalidIndexException( *this );
2523cdf0e10cSrcweir 			return (*m_pParameters)[ parameterIndex - 1 ];
2524cdf0e10cSrcweir 		}
2525cdf0e10cSrcweir     }
2526cdf0e10cSrcweir 
2527cdf0e10cSrcweir     if ( m_aPrematureParamValues.get().size() < (size_t)parameterIndex )
2528cdf0e10cSrcweir 		m_aPrematureParamValues.get().resize( parameterIndex );
2529cdf0e10cSrcweir     return m_aPrematureParamValues.get()[ parameterIndex - 1 ];
2530cdf0e10cSrcweir }
2531cdf0e10cSrcweir // -------------------------------------------------------------------------
2532cdf0e10cSrcweir // XParameters
setNull(sal_Int32 parameterIndex,sal_Int32)2533cdf0e10cSrcweir void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
2534cdf0e10cSrcweir {
2535cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2536cdf0e10cSrcweir 
2537cdf0e10cSrcweir     getParameterStorage( parameterIndex ).setNull();
2538cdf0e10cSrcweir }
2539cdf0e10cSrcweir // -------------------------------------------------------------------------
setObjectNull(sal_Int32 parameterIndex,sal_Int32 sqlType,const::rtl::OUString &)2540cdf0e10cSrcweir void SAL_CALL ORowSet::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
2541cdf0e10cSrcweir {
2542cdf0e10cSrcweir     setNull( parameterIndex, sqlType );
2543cdf0e10cSrcweir }
2544cdf0e10cSrcweir // -----------------------------------------------------------------------------
setParameter(sal_Int32 parameterIndex,const ORowSetValue & x)2545cdf0e10cSrcweir void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x)
2546cdf0e10cSrcweir {
2547cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2548cdf0e10cSrcweir 
2549cdf0e10cSrcweir     getParameterStorage( parameterIndex ) = x;
2550cdf0e10cSrcweir }
2551cdf0e10cSrcweir 
2552cdf0e10cSrcweir // -------------------------------------------------------------------------
setBoolean(sal_Int32 parameterIndex,sal_Bool x)2553cdf0e10cSrcweir void SAL_CALL ORowSet::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
2554cdf0e10cSrcweir {
2555cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2556cdf0e10cSrcweir }
2557cdf0e10cSrcweir // -------------------------------------------------------------------------
setByte(sal_Int32 parameterIndex,sal_Int8 x)2558cdf0e10cSrcweir void SAL_CALL ORowSet::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
2559cdf0e10cSrcweir {
2560cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2561cdf0e10cSrcweir }
2562cdf0e10cSrcweir // -------------------------------------------------------------------------
setShort(sal_Int32 parameterIndex,sal_Int16 x)2563cdf0e10cSrcweir void SAL_CALL ORowSet::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
2564cdf0e10cSrcweir {
2565cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2566cdf0e10cSrcweir }
2567cdf0e10cSrcweir // -------------------------------------------------------------------------
setInt(sal_Int32 parameterIndex,sal_Int32 x)2568cdf0e10cSrcweir void SAL_CALL ORowSet::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
2569cdf0e10cSrcweir {
2570cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2571cdf0e10cSrcweir }
2572cdf0e10cSrcweir // -------------------------------------------------------------------------
setLong(sal_Int32 parameterIndex,sal_Int64 x)2573cdf0e10cSrcweir void SAL_CALL ORowSet::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
2574cdf0e10cSrcweir {
2575cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2576cdf0e10cSrcweir }
2577cdf0e10cSrcweir // -------------------------------------------------------------------------
setFloat(sal_Int32 parameterIndex,float x)2578cdf0e10cSrcweir void SAL_CALL ORowSet::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
2579cdf0e10cSrcweir {
2580cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2581cdf0e10cSrcweir }
2582cdf0e10cSrcweir // -------------------------------------------------------------------------
setDouble(sal_Int32 parameterIndex,double x)2583cdf0e10cSrcweir void SAL_CALL ORowSet::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
2584cdf0e10cSrcweir {
2585cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2586cdf0e10cSrcweir }
2587cdf0e10cSrcweir // -------------------------------------------------------------------------
setString(sal_Int32 parameterIndex,const::rtl::OUString & x)2588cdf0e10cSrcweir void SAL_CALL ORowSet::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
2589cdf0e10cSrcweir {
2590cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2591cdf0e10cSrcweir }
2592cdf0e10cSrcweir // -------------------------------------------------------------------------
setBytes(sal_Int32 parameterIndex,const Sequence<sal_Int8> & x)2593cdf0e10cSrcweir void SAL_CALL ORowSet::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
2594cdf0e10cSrcweir {
2595cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2596cdf0e10cSrcweir }
2597cdf0e10cSrcweir // -------------------------------------------------------------------------
setDate(sal_Int32 parameterIndex,const::com::sun::star::util::Date & x)2598cdf0e10cSrcweir void SAL_CALL ORowSet::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
2599cdf0e10cSrcweir {
2600cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2601cdf0e10cSrcweir }
2602cdf0e10cSrcweir // -------------------------------------------------------------------------
setTime(sal_Int32 parameterIndex,const::com::sun::star::util::Time & x)2603cdf0e10cSrcweir void SAL_CALL ORowSet::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
2604cdf0e10cSrcweir {
2605cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2606cdf0e10cSrcweir }
2607cdf0e10cSrcweir // -------------------------------------------------------------------------
setTimestamp(sal_Int32 parameterIndex,const::com::sun::star::util::DateTime & x)2608cdf0e10cSrcweir void SAL_CALL ORowSet::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
2609cdf0e10cSrcweir {
2610cdf0e10cSrcweir 	setParameter(parameterIndex,x);
2611cdf0e10cSrcweir }
2612cdf0e10cSrcweir // -------------------------------------------------------------------------
setBinaryStream(sal_Int32 parameterIndex,const Reference<::com::sun::star::io::XInputStream> & x,sal_Int32 length)2613cdf0e10cSrcweir void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
2614cdf0e10cSrcweir {
2615cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2616cdf0e10cSrcweir     ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) );
2617cdf0e10cSrcweir 
2618cdf0e10cSrcweir     try
2619cdf0e10cSrcweir 	{
2620cdf0e10cSrcweir 		Sequence <sal_Int8> aData;
2621cdf0e10cSrcweir 		x->readBytes(aData, length);
2622cdf0e10cSrcweir 		rParamValue = aData;
2623cdf0e10cSrcweir 		x->closeInput();
2624cdf0e10cSrcweir 	}
2625cdf0e10cSrcweir 	catch( Exception& )
2626cdf0e10cSrcweir 	{
2627cdf0e10cSrcweir 		throw SQLException();
2628cdf0e10cSrcweir 	}
2629cdf0e10cSrcweir }
2630cdf0e10cSrcweir // -------------------------------------------------------------------------
setCharacterStream(sal_Int32 parameterIndex,const Reference<::com::sun::star::io::XInputStream> & x,sal_Int32 length)2631cdf0e10cSrcweir void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
2632cdf0e10cSrcweir {
2633cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2634cdf0e10cSrcweir 	ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) );
2635cdf0e10cSrcweir 	try
2636cdf0e10cSrcweir 	{
2637cdf0e10cSrcweir 		Sequence <sal_Int8> aData;
2638cdf0e10cSrcweir 		rtl::OUString aDataStr;
2639cdf0e10cSrcweir 		// the data is given as character data and the length defines the character length
2640cdf0e10cSrcweir 		sal_Int32 nSize = x->readBytes(aData, length * sizeof(sal_Unicode));
2641cdf0e10cSrcweir 		if (nSize / sizeof(sal_Unicode))
2642cdf0e10cSrcweir 			aDataStr = rtl::OUString((sal_Unicode*)aData.getConstArray(), nSize / sizeof(sal_Unicode));
2643cdf0e10cSrcweir 		rParamValue = aDataStr;
2644cdf0e10cSrcweir 		rParamValue.setTypeKind( DataType::LONGVARCHAR );
2645cdf0e10cSrcweir 		x->closeInput();
2646cdf0e10cSrcweir 	}
2647cdf0e10cSrcweir 	catch( Exception& )
2648cdf0e10cSrcweir 	{
2649cdf0e10cSrcweir 		throw SQLException();
2650cdf0e10cSrcweir 	}
2651cdf0e10cSrcweir }
2652cdf0e10cSrcweir // -------------------------------------------------------------------------
setObject(sal_Int32 parameterIndex,const Any & x)2653cdf0e10cSrcweir void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
2654cdf0e10cSrcweir {
2655cdf0e10cSrcweir 	if ( !::dbtools::implSetObject( this, parameterIndex, x ) )
2656cdf0e10cSrcweir 	{	// there is no other setXXX call which can handle the value in x
2657cdf0e10cSrcweir 		throw SQLException();
2658cdf0e10cSrcweir 	}
2659cdf0e10cSrcweir }
2660cdf0e10cSrcweir // -------------------------------------------------------------------------
setObjectWithInfo(sal_Int32 parameterIndex,const Any & x,sal_Int32 targetSqlType,sal_Int32)2661cdf0e10cSrcweir void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
2662cdf0e10cSrcweir {
2663cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2664cdf0e10cSrcweir 	ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) );
2665cdf0e10cSrcweir 	setObject( parameterIndex, x );
2666cdf0e10cSrcweir 	rParamValue.setTypeKind( targetSqlType );
2667cdf0e10cSrcweir }
2668cdf0e10cSrcweir // -------------------------------------------------------------------------
setRef(sal_Int32,const Reference<XRef> &)2669cdf0e10cSrcweir void SAL_CALL ORowSet::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
2670cdf0e10cSrcweir {
2671cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this );
2672cdf0e10cSrcweir }
2673cdf0e10cSrcweir // -------------------------------------------------------------------------
setBlob(sal_Int32,const Reference<XBlob> &)2674cdf0e10cSrcweir void SAL_CALL ORowSet::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
2675cdf0e10cSrcweir {
2676cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this );
2677cdf0e10cSrcweir }
2678cdf0e10cSrcweir // -------------------------------------------------------------------------
setClob(sal_Int32,const Reference<XClob> &)2679cdf0e10cSrcweir void SAL_CALL ORowSet::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
2680cdf0e10cSrcweir {
2681cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this );
2682cdf0e10cSrcweir }
2683cdf0e10cSrcweir // -------------------------------------------------------------------------
setArray(sal_Int32,const Reference<XArray> &)2684cdf0e10cSrcweir void SAL_CALL ORowSet::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
2685cdf0e10cSrcweir {
2686cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this );
2687cdf0e10cSrcweir }
2688cdf0e10cSrcweir // -------------------------------------------------------------------------
clearParameters()2689cdf0e10cSrcweir void SAL_CALL ORowSet::clearParameters(  ) throw(SQLException, RuntimeException)
2690cdf0e10cSrcweir {
2691cdf0e10cSrcweir 	::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
2692cdf0e10cSrcweir 
2693cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aColumnsMutex );
2694cdf0e10cSrcweir 
2695cdf0e10cSrcweir     size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
2696cdf0e10cSrcweir     for ( size_t i=1; i<=nParamCount; ++i )
2697cdf0e10cSrcweir         getParameterStorage( (sal_Int32)i ).setNull();
2698cdf0e10cSrcweir     m_aParametersSet.clear();
2699cdf0e10cSrcweir }
2700cdf0e10cSrcweir 
2701cdf0e10cSrcweir // -------------------------------------------------------------------------
getWarnings()2702cdf0e10cSrcweir Any SAL_CALL ORowSet::getWarnings(  ) throw (SQLException, RuntimeException)
2703cdf0e10cSrcweir {
2704cdf0e10cSrcweir     return m_aWarnings.getWarnings();
2705cdf0e10cSrcweir }
2706cdf0e10cSrcweir 
2707cdf0e10cSrcweir // -------------------------------------------------------------------------
clearWarnings()2708cdf0e10cSrcweir void SAL_CALL ORowSet::clearWarnings(  ) throw (SQLException, RuntimeException)
2709cdf0e10cSrcweir {
2710cdf0e10cSrcweir     m_aWarnings.clearWarnings();
2711cdf0e10cSrcweir }
2712cdf0e10cSrcweir // -----------------------------------------------------------------------------
doCancelModification()2713cdf0e10cSrcweir void ORowSet::doCancelModification( )
2714cdf0e10cSrcweir {
2715cdf0e10cSrcweir 	//OSL_ENSURE( isModification(), "ORowSet::doCancelModification: invalid call (no cache!)!" );
2716cdf0e10cSrcweir 	if ( isModification() )
2717cdf0e10cSrcweir     {
2718cdf0e10cSrcweir         // read-only flag restored
2719cdf0e10cSrcweir         impl_restoreDataColumnsWriteable_throw();
2720cdf0e10cSrcweir 		m_pCache->cancelRowModification();
2721cdf0e10cSrcweir     }
2722cdf0e10cSrcweir     m_bModified = sal_False;
2723cdf0e10cSrcweir 	m_bIsInsertRow = sal_False;
2724cdf0e10cSrcweir }
2725cdf0e10cSrcweir 
2726cdf0e10cSrcweir // -----------------------------------------------------------------------------
isModification()2727cdf0e10cSrcweir sal_Bool ORowSet::isModification( )
2728cdf0e10cSrcweir {
2729cdf0e10cSrcweir 	return isNew();
2730cdf0e10cSrcweir }
2731cdf0e10cSrcweir 
2732cdf0e10cSrcweir // -----------------------------------------------------------------------------
isModified()2733cdf0e10cSrcweir sal_Bool ORowSet::isModified( )
2734cdf0e10cSrcweir {
2735cdf0e10cSrcweir 	return m_bModified;
2736cdf0e10cSrcweir }
2737cdf0e10cSrcweir 
2738cdf0e10cSrcweir // -----------------------------------------------------------------------------
isNew()2739cdf0e10cSrcweir sal_Bool ORowSet::isNew( )
2740cdf0e10cSrcweir {
2741cdf0e10cSrcweir 	return m_bNew;
2742cdf0e10cSrcweir }
2743cdf0e10cSrcweir 
2744cdf0e10cSrcweir // -----------------------------------------------------------------------------
checkUpdateIterator()2745cdf0e10cSrcweir void ORowSet::checkUpdateIterator()
2746cdf0e10cSrcweir {
2747cdf0e10cSrcweir 	if(!m_bIsInsertRow)
2748cdf0e10cSrcweir 	{
2749cdf0e10cSrcweir 		m_pCache->setUpdateIterator(m_aCurrentRow);
2750cdf0e10cSrcweir 		m_aCurrentRow = m_pCache->m_aInsertRow;
2751cdf0e10cSrcweir 		m_bIsInsertRow = sal_True;
2752cdf0e10cSrcweir 	}
2753cdf0e10cSrcweir }
2754cdf0e10cSrcweir // -----------------------------------------------------------------------------
checkUpdateConditions(sal_Int32 columnIndex)2755cdf0e10cSrcweir void ORowSet::checkUpdateConditions(sal_Int32 columnIndex)
2756cdf0e10cSrcweir {
2757cdf0e10cSrcweir     checkCache();
2758cdf0e10cSrcweir     if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
2759cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this );
2760cdf0e10cSrcweir 
2761cdf0e10cSrcweir     if ( rowDeleted() )
2762cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_INVALID_CURSOR_POSITION, *this );
2763cdf0e10cSrcweir 
2764cdf0e10cSrcweir     if ( m_aCurrentRow.isNull() )
2765cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), SQL_INVALID_CURSOR_STATE, *this );
2766cdf0e10cSrcweir 
2767cdf0e10cSrcweir     if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex )
2768cdf0e10cSrcweir         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this );
2769cdf0e10cSrcweir }
2770cdf0e10cSrcweir // -----------------------------------------------------------------------------
refreshRow()2771cdf0e10cSrcweir void SAL_CALL ORowSet::refreshRow(  ) throw(SQLException, RuntimeException)
2772cdf0e10cSrcweir {
2773cdf0e10cSrcweir 
2774cdf0e10cSrcweir 	ORowSetNotifier aNotifier( this );
2775cdf0e10cSrcweir 		// this will call cancelRowModification on the cache if necessary
2776cdf0e10cSrcweir 
2777cdf0e10cSrcweir 	// notification order:
2778cdf0e10cSrcweir 	if ( m_bModified && m_pCache )
2779cdf0e10cSrcweir 		implCancelRowUpdates( sal_False ); // do _not_ notify the IsModify - will do this ourself below
2780cdf0e10cSrcweir 
2781cdf0e10cSrcweir     // - column values
2782cdf0e10cSrcweir 	ORowSetBase::refreshRow();
2783cdf0e10cSrcweir 
2784cdf0e10cSrcweir 	// - IsModified
2785cdf0e10cSrcweir 	// - IsNew
2786cdf0e10cSrcweir 	aNotifier.fire( );
2787cdf0e10cSrcweir }
2788cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_rebuild_throw(::osl::ResettableMutexGuard & _rGuard)2789cdf0e10cSrcweir void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard)
2790cdf0e10cSrcweir {
2791cdf0e10cSrcweir     Reference< XResultSet > xResultSet( m_xStatement->executeQuery() );
2792cdf0e10cSrcweir     m_aWarnings.setExternalWarnings( Reference< XWarningsSupplier >( xResultSet, UNO_QUERY ) );
2793cdf0e10cSrcweir     m_pCache->reset(xResultSet);
2794cdf0e10cSrcweir     notifyAllListeners(_rGuard);
2795cdf0e10cSrcweir }
2796cdf0e10cSrcweir // ***********************************************************
2797cdf0e10cSrcweir //  ORowSetClone
2798cdf0e10cSrcweir // ***********************************************************
2799cdf0e10cSrcweir DBG_NAME(ORowSetClone);
2800cdf0e10cSrcweir //--------------------------------------------------------------------------
ORowSetClone(const::comphelper::ComponentContext & _rContext,ORowSet & rParent,::osl::Mutex * _pMutex)2801cdf0e10cSrcweir ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex )
2802cdf0e10cSrcweir 		     :OSubComponent(m_aMutex, rParent)
2803cdf0e10cSrcweir 		     ,ORowSetBase( _rContext, OComponentHelper::rBHelper, _pMutex )
2804cdf0e10cSrcweir 			 ,m_pParent(&rParent)
2805cdf0e10cSrcweir 			 ,m_nFetchDirection(rParent.m_nFetchDirection)
2806cdf0e10cSrcweir 			 ,m_nFetchSize(rParent.m_nFetchSize)
2807cdf0e10cSrcweir 			 ,m_bIsBookmarable(sal_True)
2808cdf0e10cSrcweir {
2809cdf0e10cSrcweir 	DBG_CTOR(ORowSetClone, NULL);
2810cdf0e10cSrcweir 
2811cdf0e10cSrcweir 	m_nResultSetType		= rParent.m_nResultSetType;
2812cdf0e10cSrcweir 	m_nResultSetConcurrency = ResultSetConcurrency::READ_ONLY;
2813cdf0e10cSrcweir 	m_pMySelf				= this;
2814cdf0e10cSrcweir 	m_bClone				= sal_True;
2815cdf0e10cSrcweir 	m_bBeforeFirst			= rParent.m_bBeforeFirst;
2816cdf0e10cSrcweir 	m_bAfterLast			= rParent.m_bAfterLast;
2817cdf0e10cSrcweir 	m_pCache				= rParent.m_pCache;
2818cdf0e10cSrcweir 	m_aBookmark				= rParent.m_aBookmark;
2819cdf0e10cSrcweir 	m_aCurrentRow			= m_pCache->createIterator(this);
2820cdf0e10cSrcweir 	m_xNumberFormatTypes	= rParent.m_xNumberFormatTypes;
2821cdf0e10cSrcweir 
2822cdf0e10cSrcweir 	m_aOldRow = m_pCache->registerOldRow();
2823cdf0e10cSrcweir 
2824cdf0e10cSrcweir 	::vos::ORef< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns();
2825cdf0e10cSrcweir 	::std::vector< ::rtl::OUString> aNames;
2826cdf0e10cSrcweir 
2827cdf0e10cSrcweir 	::rtl::OUString aDescription;
2828cdf0e10cSrcweir 	//	ConfigManager*	pConfigMgr = ConfigManager::GetConfigManager();
2829cdf0e10cSrcweir 	//	Locale aLocale;
2830cdf0e10cSrcweir 	//	pConfigMgr->GetDirectConfigProperty(ConfigManager::LOCALE) >>= aLocale;
2831cdf0e10cSrcweir 	Locale aLocale = SvtSysLocale().GetLocaleData().getLocale();
2832cdf0e10cSrcweir 
2833cdf0e10cSrcweir     if ( rParent.m_pColumns )
2834cdf0e10cSrcweir     {
2835cdf0e10cSrcweir 	    Sequence< ::rtl::OUString> aSeq = rParent.m_pColumns->getElementNames();
2836cdf0e10cSrcweir 	    const ::rtl::OUString* pIter	= aSeq.getConstArray();
2837cdf0e10cSrcweir 	    const ::rtl::OUString* pEnd		= pIter + aSeq.getLength();
2838cdf0e10cSrcweir 	    aColumns->get().reserve(aSeq.getLength()+1);
2839cdf0e10cSrcweir 	    for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i)
2840cdf0e10cSrcweir 	    {
2841cdf0e10cSrcweir 		    Reference<XPropertySet> xColumn;
2842cdf0e10cSrcweir 		    rParent.m_pColumns->getByName(*pIter) >>= xColumn;
2843cdf0e10cSrcweir 		    if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
2844cdf0e10cSrcweir 			    aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
2845cdf0e10cSrcweir 
2846cdf0e10cSrcweir             ::rtl::OUString sParseLabel;
2847cdf0e10cSrcweir             xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
2848cdf0e10cSrcweir 		    ORowSetColumn* pColumn = new ORowSetColumn(	rParent.getMetaData(),
2849cdf0e10cSrcweir 															    this,
2850cdf0e10cSrcweir 															    i,
2851cdf0e10cSrcweir                                                                 rParent.m_xActiveConnection->getMetaData(),
2852cdf0e10cSrcweir 															    aDescription,
2853cdf0e10cSrcweir                                                                 sParseLabel,
2854cdf0e10cSrcweir 															    m_aCurrentRow);
2855cdf0e10cSrcweir 		    aColumns->get().push_back(pColumn);
2856cdf0e10cSrcweir 		    pColumn->setName(*pIter);
2857cdf0e10cSrcweir 		    aNames.push_back(*pIter);
2858cdf0e10cSrcweir 		    m_aDataColumns.push_back(pColumn);
2859cdf0e10cSrcweir 
2860cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN));
2861cdf0e10cSrcweir 		    sal_Int32 nFormatKey = 0;
2862cdf0e10cSrcweir 			xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT) >>= nFormatKey;
2863cdf0e10cSrcweir 		    if(!nFormatKey && xColumn.is() && m_xNumberFormatTypes.is())
2864cdf0e10cSrcweir 			    nFormatKey = ::dbtools::getDefaultNumberFormat(xColumn,m_xNumberFormatTypes,aLocale);
2865cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
2866cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,xColumn->getPropertyValue(PROPERTY_RELATIVEPOSITION));
2867cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,xColumn->getPropertyValue(PROPERTY_WIDTH));
2868cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,xColumn->getPropertyValue(PROPERTY_HIDDEN));
2869cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLMODEL,xColumn->getPropertyValue(PROPERTY_CONTROLMODEL));
2870cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HELPTEXT,xColumn->getPropertyValue(PROPERTY_HELPTEXT));
2871cdf0e10cSrcweir 		    pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLDEFAULT,xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT));
2872cdf0e10cSrcweir 
2873cdf0e10cSrcweir 	    } // for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i)
2874cdf0e10cSrcweir     }
2875cdf0e10cSrcweir 	Reference<XDatabaseMetaData> xMeta = rParent.m_xActiveConnection->getMetaData();
2876cdf0e10cSrcweir 	m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),
2877cdf0e10cSrcweir 										aColumns,*this,m_aMutex,aNames);
2878cdf0e10cSrcweir 
2879cdf0e10cSrcweir 	sal_Int32 nRT	= PropertyAttribute::READONLY	| PropertyAttribute::TRANSIENT;
2880cdf0e10cSrcweir 
2881cdf0e10cSrcweir 	// sdb.RowSet Properties
2882cdf0e10cSrcweir 	//	registerProperty(PROPERTY_CURSORNAME,		PROPERTY_ID_CURSORNAME,			PropertyAttribute::READONLY,		&m_aDataSourceName,		::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
2883cdf0e10cSrcweir     registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION,	PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY,	&rParent.m_aActiveConnection,	::getCppuType(reinterpret_cast< Reference< XConnection >* >(NULL)));
2884cdf0e10cSrcweir 	registerProperty(PROPERTY_RESULTSETCONCURRENCY,	PROPERTY_ID_RESULTSETCONCURRENCY,	PropertyAttribute::READONLY,	&m_nResultSetConcurrency,::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
2885cdf0e10cSrcweir 	registerProperty(PROPERTY_RESULTSETTYPE,		PROPERTY_ID_RESULTSETTYPE,			PropertyAttribute::READONLY,	&m_nResultSetType,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
2886cdf0e10cSrcweir 	registerProperty(PROPERTY_FETCHDIRECTION,		PROPERTY_ID_FETCHDIRECTION,			PropertyAttribute::TRANSIENT,	&m_nFetchDirection,		::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
2887cdf0e10cSrcweir 	registerProperty(PROPERTY_FETCHSIZE,			PROPERTY_ID_FETCHSIZE,				PropertyAttribute::TRANSIENT,	&m_nFetchSize,			::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
2888cdf0e10cSrcweir 	registerProperty(PROPERTY_ISBOOKMARKABLE,		PROPERTY_ID_ISBOOKMARKABLE,			nRT,							&m_bIsBookmarable,		::getBooleanCppuType());
2889cdf0e10cSrcweir }
2890cdf0e10cSrcweir 
2891cdf0e10cSrcweir //--------------------------------------------------------------------------
~ORowSetClone()2892cdf0e10cSrcweir ORowSetClone::~ORowSetClone()
2893cdf0e10cSrcweir {
2894cdf0e10cSrcweir 	DBG_DTOR(ORowSetClone, NULL);
2895cdf0e10cSrcweir }
2896cdf0e10cSrcweir // com::sun::star::XTypeProvider
2897cdf0e10cSrcweir //--------------------------------------------------------------------------
getTypes()2898cdf0e10cSrcweir Sequence< Type > ORowSetClone::getTypes() throw (RuntimeException)
2899cdf0e10cSrcweir {
2900cdf0e10cSrcweir 	return ::comphelper::concatSequences(OSubComponent::getTypes(),ORowSetBase::getTypes());
2901cdf0e10cSrcweir }
2902cdf0e10cSrcweir // com::sun::star::XInterface
2903cdf0e10cSrcweir //--------------------------------------------------------------------------
queryInterface(const Type & rType)2904cdf0e10cSrcweir Any ORowSetClone::queryInterface( const Type & rType ) throw (RuntimeException)
2905cdf0e10cSrcweir {
2906cdf0e10cSrcweir 	Any aRet = ORowSetBase::queryInterface(rType);
2907cdf0e10cSrcweir 	if(!aRet.hasValue())
2908cdf0e10cSrcweir 		aRet = OSubComponent::queryInterface(rType);
2909cdf0e10cSrcweir 	return aRet;
2910cdf0e10cSrcweir }
2911cdf0e10cSrcweir //------------------------------------------------------------------------------
acquire()2912cdf0e10cSrcweir void ORowSetClone::acquire() throw()
2913cdf0e10cSrcweir {
2914cdf0e10cSrcweir 	OSubComponent::acquire();
2915cdf0e10cSrcweir }
2916cdf0e10cSrcweir 
2917cdf0e10cSrcweir //------------------------------------------------------------------------------
release()2918cdf0e10cSrcweir void ORowSetClone::release() throw()
2919cdf0e10cSrcweir {
2920cdf0e10cSrcweir 	OSubComponent::release();
2921cdf0e10cSrcweir }
2922cdf0e10cSrcweir 
2923cdf0e10cSrcweir // XServiceInfo
2924cdf0e10cSrcweir //------------------------------------------------------------------------------
getImplementationName()2925cdf0e10cSrcweir rtl::OUString ORowSetClone::getImplementationName(  ) throw(RuntimeException)
2926cdf0e10cSrcweir {
2927cdf0e10cSrcweir 	return rtl::OUString::createFromAscii("com.sun.star.sdb.ORowSetClone");
2928cdf0e10cSrcweir }
2929cdf0e10cSrcweir 
2930cdf0e10cSrcweir //------------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)2931cdf0e10cSrcweir sal_Bool ORowSetClone::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
2932cdf0e10cSrcweir {
2933cdf0e10cSrcweir 	return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
2934cdf0e10cSrcweir }
2935cdf0e10cSrcweir 
2936cdf0e10cSrcweir //------------------------------------------------------------------------------
getSupportedServiceNames()2937cdf0e10cSrcweir Sequence< ::rtl::OUString > ORowSetClone::getSupportedServiceNames(  ) throw (RuntimeException)
2938cdf0e10cSrcweir {
2939cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSNS( 2 );
2940cdf0e10cSrcweir 	aSNS[0] = SERVICE_SDBC_RESULTSET;
2941cdf0e10cSrcweir 	aSNS[1] = SERVICE_SDB_RESULTSET;
2942cdf0e10cSrcweir 	return aSNS;
2943cdf0e10cSrcweir }
2944cdf0e10cSrcweir 
2945cdf0e10cSrcweir // OComponentHelper
2946cdf0e10cSrcweir //------------------------------------------------------------------------------
disposing()2947cdf0e10cSrcweir void ORowSetClone::disposing()
2948cdf0e10cSrcweir {
2949cdf0e10cSrcweir 	MutexGuard aGuard( m_aMutex );
2950cdf0e10cSrcweir 	ORowSetBase::disposing();
2951cdf0e10cSrcweir 
2952cdf0e10cSrcweir 	m_pParent	= NULL;
2953cdf0e10cSrcweir 	m_pMutex	= &m_aMutex; // this must be done here because someone could hold a ref to us and try to do something
2954cdf0e10cSrcweir 	OSubComponent::disposing();
2955cdf0e10cSrcweir }
2956cdf0e10cSrcweir 
2957cdf0e10cSrcweir // XCloseable
2958cdf0e10cSrcweir //------------------------------------------------------------------------------
close(void)2959cdf0e10cSrcweir void ORowSetClone::close(void) throw( SQLException, RuntimeException )
2960cdf0e10cSrcweir {
2961cdf0e10cSrcweir 	{
2962cdf0e10cSrcweir 		MutexGuard aGuard( m_aMutex );
2963cdf0e10cSrcweir 		if (OComponentHelper::rBHelper.bDisposed)
2964cdf0e10cSrcweir 			throw DisposedException();
2965cdf0e10cSrcweir 	}
2966cdf0e10cSrcweir 	dispose();
2967cdf0e10cSrcweir }
2968cdf0e10cSrcweir // -------------------------------------------------------------------------
2969cdf0e10cSrcweir 
2970cdf0e10cSrcweir // comphelper::OPropertyArrayUsageHelper
createArrayHelper() const2971cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* ORowSetClone::createArrayHelper( ) const
2972cdf0e10cSrcweir {
2973cdf0e10cSrcweir 	Sequence< Property > aProps;
2974cdf0e10cSrcweir 	describeProperties(aProps);
2975cdf0e10cSrcweir 	return new ::cppu::OPropertyArrayHelper(aProps);
2976cdf0e10cSrcweir }
2977cdf0e10cSrcweir // -------------------------------------------------------------------------
2978cdf0e10cSrcweir 
2979cdf0e10cSrcweir // cppu::OPropertySetHelper
getInfoHelper()2980cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL ORowSetClone::getInfoHelper()
2981cdf0e10cSrcweir {
2982cdf0e10cSrcweir 	typedef ::comphelper::OPropertyArrayUsageHelper<ORowSetClone> ORowSetClone_PROP;
2983cdf0e10cSrcweir 	return *ORowSetClone_PROP::getArrayHelper();
2984cdf0e10cSrcweir }
2985cdf0e10cSrcweir // -------------------------------------------------------------------------
2986cdf0e10cSrcweir //--------------------------------------------------------------------------
getUnoTunnelImplementationId()2987cdf0e10cSrcweir Sequence< sal_Int8 > ORowSetClone::getUnoTunnelImplementationId()
2988cdf0e10cSrcweir {
2989cdf0e10cSrcweir 	static ::cppu::OImplementationId * pId = 0;
2990cdf0e10cSrcweir 	if (! pId)
2991cdf0e10cSrcweir 	{
2992cdf0e10cSrcweir 		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
2993cdf0e10cSrcweir 		if (! pId)
2994cdf0e10cSrcweir 		{
2995cdf0e10cSrcweir 			static ::cppu::OImplementationId aId;
2996cdf0e10cSrcweir 			pId = &aId;
2997cdf0e10cSrcweir 		}
2998cdf0e10cSrcweir 	}
2999cdf0e10cSrcweir 	return pId->getImplementationId();
3000cdf0e10cSrcweir }
3001cdf0e10cSrcweir // -----------------------------------------------------------------------------
3002cdf0e10cSrcweir // com::sun::star::XUnoTunnel
getSomething(const Sequence<sal_Int8> & rId)3003cdf0e10cSrcweir sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
3004cdf0e10cSrcweir {
3005cdf0e10cSrcweir 	if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
3006cdf0e10cSrcweir 		return reinterpret_cast<sal_Int64>(this);
3007cdf0e10cSrcweir 
3008cdf0e10cSrcweir 	return 0;
3009cdf0e10cSrcweir }
3010cdf0e10cSrcweir // -----------------------------------------------------------------------------
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any & rValue)3011cdf0e10cSrcweir void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
3012cdf0e10cSrcweir {
3013cdf0e10cSrcweir     if ( nHandle == PROPERTY_ID_FETCHSIZE )
3014cdf0e10cSrcweir     {
3015cdf0e10cSrcweir 		if ( m_pParent )
3016cdf0e10cSrcweir 			m_pParent->setFastPropertyValue_NoBroadcast( nHandle, rValue );
3017cdf0e10cSrcweir     }
3018cdf0e10cSrcweir 
3019cdf0e10cSrcweir     OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
3020cdf0e10cSrcweir }
3021cdf0e10cSrcweir 
3022cdf0e10cSrcweir // -----------------------------------------------------------------------------
doCancelModification()3023cdf0e10cSrcweir void ORowSetClone::doCancelModification( )
3024cdf0e10cSrcweir {
3025cdf0e10cSrcweir 	//OSL_ENSURE( sal_False, "ORowSetClone::doCancelModification: invalid call!" );
3026cdf0e10cSrcweir }
3027cdf0e10cSrcweir 
3028cdf0e10cSrcweir // -----------------------------------------------------------------------------
isModification()3029cdf0e10cSrcweir sal_Bool ORowSetClone::isModification( )
3030cdf0e10cSrcweir {
3031cdf0e10cSrcweir 	return sal_False;
3032cdf0e10cSrcweir }
3033cdf0e10cSrcweir 
3034cdf0e10cSrcweir // -----------------------------------------------------------------------------
isModified()3035cdf0e10cSrcweir sal_Bool ORowSetClone::isModified( )
3036cdf0e10cSrcweir {
3037cdf0e10cSrcweir 	return sal_False;
3038cdf0e10cSrcweir }
3039cdf0e10cSrcweir 
3040cdf0e10cSrcweir // -----------------------------------------------------------------------------
isNew()3041cdf0e10cSrcweir sal_Bool ORowSetClone::isNew( )
3042cdf0e10cSrcweir {
3043cdf0e10cSrcweir 	return sal_False;
3044cdf0e10cSrcweir }
3045cdf0e10cSrcweir 
3046cdf0e10cSrcweir // -------------------------------------------------------------------------
execute()3047cdf0e10cSrcweir void SAL_CALL ORowSetClone::execute(  ) throw(SQLException, RuntimeException)
3048cdf0e10cSrcweir {
3049cdf0e10cSrcweir     throwFunctionNotSupportedException( "RowSetClone::XRowSet::execute", *this );
3050cdf0e10cSrcweir }
3051cdf0e10cSrcweir 
3052cdf0e10cSrcweir // -------------------------------------------------------------------------
addRowSetListener(const Reference<XRowSetListener> &)3053cdf0e10cSrcweir void SAL_CALL ORowSetClone::addRowSetListener( const Reference< XRowSetListener >& ) throw(RuntimeException)
3054cdf0e10cSrcweir {
3055cdf0e10cSrcweir     throwFunctionNotSupportedException( "RowSetClone::XRowSet", *this );
3056cdf0e10cSrcweir }
3057cdf0e10cSrcweir 
3058cdf0e10cSrcweir // -------------------------------------------------------------------------
removeRowSetListener(const Reference<XRowSetListener> &)3059cdf0e10cSrcweir void SAL_CALL ORowSetClone::removeRowSetListener( const Reference< XRowSetListener >& ) throw(RuntimeException)
3060cdf0e10cSrcweir {
3061cdf0e10cSrcweir     throwFunctionNotSupportedException( "RowSetClone::XRowSet", *this );
3062cdf0e10cSrcweir }
3063cdf0e10cSrcweir 
3064cdf0e10cSrcweir } // dbaccess
3065