xref: /AOO41X/main/dbaccess/source/core/api/preparedstatement.cxx (revision 96de54900b79e13b861fbc62cbf36018b54e21b7)
1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "dbastrings.hrc"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
30cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
31cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <comphelper/property.hxx>
34cdf0e10cSrcweir #include <comphelper/sequence.hxx>
35cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
36cdf0e10cSrcweir #include <preparedstatement.hxx>
37cdf0e10cSrcweir #include <resultcolumn.hxx>
38cdf0e10cSrcweir #include <resultset.hxx>
39cdf0e10cSrcweir #include <tools/debug.hxx>
40cdf0e10cSrcweir #include <tools/diagnose_ex.h>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
43cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
44cdf0e10cSrcweir using namespace ::com::sun::star::beans;
45cdf0e10cSrcweir using namespace ::com::sun::star::uno;
46cdf0e10cSrcweir using namespace ::com::sun::star::lang;
47cdf0e10cSrcweir using namespace ::cppu;
48cdf0e10cSrcweir using namespace ::osl;
49cdf0e10cSrcweir using namespace dbaccess;
50cdf0e10cSrcweir 
DBG_NAME(OPreparedStatement)51cdf0e10cSrcweir DBG_NAME(OPreparedStatement)
52cdf0e10cSrcweir 
53cdf0e10cSrcweir //--------------------------------------------------------------------------
54cdf0e10cSrcweir OPreparedStatement::OPreparedStatement(const Reference< XConnection > & _xConn,
55cdf0e10cSrcweir 									  const Reference< XInterface > & _xStatement)
56cdf0e10cSrcweir 				   :OStatementBase(_xConn, _xStatement)
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	DBG_CTOR(OPreparedStatement, NULL);
59cdf0e10cSrcweir 	m_xAggregateAsParameters = Reference< XParameters >( m_xAggregateAsSet, UNO_QUERY_THROW );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     Reference<XDatabaseMetaData> xMeta = _xConn->getMetaData();
62cdf0e10cSrcweir 	m_pColumns = new OColumns(*this, m_aMutex, xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),::std::vector< ::rtl::OUString>(), NULL,NULL);
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir //--------------------------------------------------------------------------
~OPreparedStatement()66cdf0e10cSrcweir OPreparedStatement::~OPreparedStatement()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir     m_pColumns->acquire();
69cdf0e10cSrcweir 	m_pColumns->disposing();
70cdf0e10cSrcweir     delete m_pColumns;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     DBG_DTOR(OPreparedStatement, NULL);
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir // com::sun::star::lang::XTypeProvider
76cdf0e10cSrcweir //--------------------------------------------------------------------------
getTypes()77cdf0e10cSrcweir Sequence< Type > OPreparedStatement::getTypes() throw (RuntimeException)
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 	OTypeCollection aTypes(::getCppuType( (const Reference< XServiceInfo > *)0 ),
80cdf0e10cSrcweir 						   ::getCppuType( (const Reference< XPreparedStatement > *)0 ),
81cdf0e10cSrcweir 						   ::getCppuType( (const Reference< XParameters > *)0 ),
82cdf0e10cSrcweir 						   ::getCppuType( (const Reference< XResultSetMetaDataSupplier > *)0 ),
83cdf0e10cSrcweir 						   ::getCppuType( (const Reference< XColumnsSupplier > *)0 ),
84cdf0e10cSrcweir 							OStatementBase::getTypes() );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	return aTypes.getTypes();
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir //--------------------------------------------------------------------------
getImplementationId()90cdf0e10cSrcweir Sequence< sal_Int8 > OPreparedStatement::getImplementationId() throw (RuntimeException)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir 		static OImplementationId * pId = 0;
93cdf0e10cSrcweir 	if (! pId)
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		MutexGuard aGuard( Mutex::getGlobalMutex() );
96cdf0e10cSrcweir 		if (! pId)
97cdf0e10cSrcweir 		{
98cdf0e10cSrcweir 			static OImplementationId aId;
99cdf0e10cSrcweir 			pId = &aId;
100cdf0e10cSrcweir 		}
101cdf0e10cSrcweir 	}
102cdf0e10cSrcweir 	return pId->getImplementationId();
103cdf0e10cSrcweir }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir // com::sun::star::uno::XInterface
106cdf0e10cSrcweir //--------------------------------------------------------------------------
queryInterface(const Type & rType)107cdf0e10cSrcweir Any OPreparedStatement::queryInterface( const Type & rType ) throw (RuntimeException)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir 	Any aIface = OStatementBase::queryInterface( rType );
110cdf0e10cSrcweir 	if (!aIface.hasValue())
111cdf0e10cSrcweir 		aIface = ::cppu::queryInterface(
112cdf0e10cSrcweir 					rType,
113cdf0e10cSrcweir 					static_cast< XServiceInfo * >( this ),
114cdf0e10cSrcweir 					static_cast< XParameters * >( this ),
115cdf0e10cSrcweir 					static_cast< XColumnsSupplier * >( this ),
116cdf0e10cSrcweir 					static_cast< XResultSetMetaDataSupplier * >( this ),
117cdf0e10cSrcweir 					static_cast< XPreparedBatchExecution * >( this ),
118cdf0e10cSrcweir 					static_cast< XMultipleResults * >( this ),
119cdf0e10cSrcweir 					static_cast< XPreparedStatement * >( this ));
120cdf0e10cSrcweir 	return aIface;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir //--------------------------------------------------------------------------
acquire()124cdf0e10cSrcweir void OPreparedStatement::acquire() throw ()
125cdf0e10cSrcweir {
126cdf0e10cSrcweir 	OStatementBase::acquire();
127cdf0e10cSrcweir }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir //--------------------------------------------------------------------------
release()130cdf0e10cSrcweir void OPreparedStatement::release() throw ()
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	OStatementBase::release();
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir // XServiceInfo
136cdf0e10cSrcweir //------------------------------------------------------------------------------
getImplementationName()137cdf0e10cSrcweir rtl::OUString OPreparedStatement::getImplementationName(  ) throw(RuntimeException)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	return rtl::OUString::createFromAscii("com.sun.star.sdb.OPreparedStatement");
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //------------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)143cdf0e10cSrcweir sal_Bool OPreparedStatement::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
144cdf0e10cSrcweir {
145cdf0e10cSrcweir 	return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
146cdf0e10cSrcweir }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir //------------------------------------------------------------------------------
getSupportedServiceNames()149cdf0e10cSrcweir Sequence< ::rtl::OUString > OPreparedStatement::getSupportedServiceNames(  ) throw (RuntimeException)
150cdf0e10cSrcweir {
151cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSNS( 2 );
152cdf0e10cSrcweir 	aSNS.getArray()[0] = SERVICE_SDBC_PREPAREDSTATEMENT;
153cdf0e10cSrcweir 	aSNS.getArray()[1] = SERVICE_SDB_PREPAREDSTATMENT;
154cdf0e10cSrcweir 	return aSNS;
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir // OComponentHelper
158cdf0e10cSrcweir //------------------------------------------------------------------------------
disposing()159cdf0e10cSrcweir void OPreparedStatement::disposing()
160cdf0e10cSrcweir {
161cdf0e10cSrcweir 	{
162cdf0e10cSrcweir 		MutexGuard aGuard(m_aMutex);
163cdf0e10cSrcweir 		m_pColumns->disposing();
164cdf0e10cSrcweir 		m_xAggregateAsParameters = NULL;
165cdf0e10cSrcweir 	}
166cdf0e10cSrcweir 	OStatementBase::disposing();
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir // ::com::sun::star::sdbcx::XColumnsSupplier
170cdf0e10cSrcweir //------------------------------------------------------------------------------
getColumns(void)171cdf0e10cSrcweir Reference< ::com::sun::star::container::XNameAccess > OPreparedStatement::getColumns(void) throw( RuntimeException )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
174cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	// do we have to populate the columns
177cdf0e10cSrcweir 	if (!m_pColumns->isInitialized())
178cdf0e10cSrcweir 	{
179cdf0e10cSrcweir 		try
180cdf0e10cSrcweir 		{
181cdf0e10cSrcweir             Reference< XResultSetMetaDataSupplier > xSuppMeta( m_xAggregateAsSet, UNO_QUERY_THROW );
182cdf0e10cSrcweir 			Reference< XResultSetMetaData > xMetaData( xSuppMeta->getMetaData(), UNO_SET_THROW );
183cdf0e10cSrcweir 
184cdf0e10cSrcweir             Reference< XConnection > xConn( getConnection(), UNO_SET_THROW );
185cdf0e10cSrcweir             Reference< XDatabaseMetaData > xDBMeta( xConn->getMetaData(), UNO_SET_THROW );
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 			for (sal_Int32 i = 0, nCount = xMetaData->getColumnCount(); i < nCount; ++i)
188cdf0e10cSrcweir 			{
189cdf0e10cSrcweir 				// retrieve the name of the column
190cdf0e10cSrcweir 				rtl::OUString aName = xMetaData->getColumnName(i + 1);
191cdf0e10cSrcweir 				OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
192cdf0e10cSrcweir 				m_pColumns->append(aName, pColumn);
193cdf0e10cSrcweir 			}
194cdf0e10cSrcweir 		}
195cdf0e10cSrcweir 		catch (const SQLException& )
196cdf0e10cSrcweir 		{
197cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
198cdf0e10cSrcweir 		}
199cdf0e10cSrcweir 		m_pColumns->setInitialized();
200cdf0e10cSrcweir 	}
201cdf0e10cSrcweir 	return m_pColumns;
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir // XResultSetMetaDataSupplier
205cdf0e10cSrcweir //------------------------------------------------------------------------------
getMetaData(void)206cdf0e10cSrcweir Reference< XResultSetMetaData > OPreparedStatement::getMetaData(void) throw( SQLException, RuntimeException )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
209cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
210cdf0e10cSrcweir 	return Reference< XResultSetMetaDataSupplier >( m_xAggregateAsSet, UNO_QUERY_THROW )->getMetaData();
211cdf0e10cSrcweir }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir // XPreparedStatement
214cdf0e10cSrcweir //------------------------------------------------------------------------------
executeQuery()215cdf0e10cSrcweir Reference< XResultSet >  OPreparedStatement::executeQuery() throw( SQLException, RuntimeException )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
218cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 	disposeResultSet();
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	Reference< XResultSet > xResultSet;
223cdf0e10cSrcweir 	Reference< XResultSet > xDrvResultSet = Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeQuery();
224cdf0e10cSrcweir 	if (xDrvResultSet.is())
225cdf0e10cSrcweir 	{
226cdf0e10cSrcweir 		xResultSet = new OResultSet(xDrvResultSet, *this, m_pColumns->isCaseSensitive());
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 		// keep the resultset weak
229cdf0e10cSrcweir 		m_aResultSet = xResultSet;
230cdf0e10cSrcweir 	}
231cdf0e10cSrcweir 	return xResultSet;
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir //------------------------------------------------------------------------------
executeUpdate()235cdf0e10cSrcweir sal_Int32 OPreparedStatement::executeUpdate() throw( SQLException, RuntimeException )
236cdf0e10cSrcweir {
237cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
238cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	disposeResultSet();
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeUpdate();
243cdf0e10cSrcweir }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir //------------------------------------------------------------------------------
execute()246cdf0e10cSrcweir sal_Bool OPreparedStatement::execute() throw( SQLException, RuntimeException )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
249cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 	disposeResultSet();
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->execute();
254cdf0e10cSrcweir }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir //------------------------------------------------------------------------------
getConnection(void)257cdf0e10cSrcweir Reference< XConnection > OPreparedStatement::getConnection(void) throw( SQLException, RuntimeException )
258cdf0e10cSrcweir {
259cdf0e10cSrcweir 	return Reference< XConnection > (m_xParent, UNO_QUERY);
260cdf0e10cSrcweir }
261cdf0e10cSrcweir 
262cdf0e10cSrcweir // XParameters
263cdf0e10cSrcweir //------------------------------------------------------------------------------
setNull(sal_Int32 parameterIndex,sal_Int32 sqlType)264cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException)
265cdf0e10cSrcweir {
266cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
267cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	m_xAggregateAsParameters->setNull(parameterIndex, sqlType);
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir //------------------------------------------------------------------------------
setObjectNull(sal_Int32 parameterIndex,sal_Int32 sqlType,const::rtl::OUString & typeName)273cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
276cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	m_xAggregateAsParameters->setObjectNull(parameterIndex, sqlType, typeName);
279cdf0e10cSrcweir }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir //------------------------------------------------------------------------------
setBoolean(sal_Int32 parameterIndex,sal_Bool x)282cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
283cdf0e10cSrcweir {
284cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
285cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 	m_xAggregateAsParameters->setBoolean(parameterIndex, x);
288cdf0e10cSrcweir }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir //------------------------------------------------------------------------------
setByte(sal_Int32 parameterIndex,sal_Int8 x)291cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
292cdf0e10cSrcweir {
293cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
294cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	m_xAggregateAsParameters->setByte(parameterIndex, x);
297cdf0e10cSrcweir }
298cdf0e10cSrcweir 
299cdf0e10cSrcweir //------------------------------------------------------------------------------
setShort(sal_Int32 parameterIndex,sal_Int16 x)300cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
303cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 	m_xAggregateAsParameters->setShort(parameterIndex, x);
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir //------------------------------------------------------------------------------
setInt(sal_Int32 parameterIndex,sal_Int32 x)309cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
310cdf0e10cSrcweir {
311cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
312cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	m_xAggregateAsParameters->setInt(parameterIndex, x);
315cdf0e10cSrcweir }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir //------------------------------------------------------------------------------
setLong(sal_Int32 parameterIndex,sal_Int64 x)318cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
319cdf0e10cSrcweir {
320cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
321cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	m_xAggregateAsParameters->setLong(parameterIndex, x);
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
326cdf0e10cSrcweir //------------------------------------------------------------------------------
setFloat(sal_Int32 parameterIndex,float x)327cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
328cdf0e10cSrcweir {
329cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
330cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	m_xAggregateAsParameters->setFloat(parameterIndex, x);
333cdf0e10cSrcweir }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir //------------------------------------------------------------------------------
setDouble(sal_Int32 parameterIndex,double x)336cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
337cdf0e10cSrcweir {
338cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
339cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 	m_xAggregateAsParameters->setDouble(parameterIndex, x);
342cdf0e10cSrcweir }
343cdf0e10cSrcweir 
344cdf0e10cSrcweir //------------------------------------------------------------------------------
setString(sal_Int32 parameterIndex,const::rtl::OUString & x)345cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
348cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 	m_xAggregateAsParameters->setString(parameterIndex, x);
351cdf0e10cSrcweir }
352cdf0e10cSrcweir 
353cdf0e10cSrcweir //------------------------------------------------------------------------------
setBytes(sal_Int32 parameterIndex,const Sequence<sal_Int8> & x)354cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
355cdf0e10cSrcweir {
356cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
357cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	m_xAggregateAsParameters->setBytes(parameterIndex, x);
360cdf0e10cSrcweir }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir //------------------------------------------------------------------------------
setDate(sal_Int32 parameterIndex,const::com::sun::star::util::Date & x)363cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
364cdf0e10cSrcweir {
365cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
366cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 	m_xAggregateAsParameters->setDate(parameterIndex, x);
369cdf0e10cSrcweir }
370cdf0e10cSrcweir 
371cdf0e10cSrcweir //------------------------------------------------------------------------------
setTime(sal_Int32 parameterIndex,const::com::sun::star::util::Time & x)372cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
373cdf0e10cSrcweir {
374cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
375cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 	m_xAggregateAsParameters->setTime(parameterIndex, x);
378cdf0e10cSrcweir }
379cdf0e10cSrcweir 
380cdf0e10cSrcweir //------------------------------------------------------------------------------
setTimestamp(sal_Int32 parameterIndex,const::com::sun::star::util::DateTime & x)381cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
384cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 	m_xAggregateAsParameters->setTimestamp(parameterIndex, x);
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir //------------------------------------------------------------------------------
setBinaryStream(sal_Int32 parameterIndex,const Reference<::com::sun::star::io::XInputStream> & x,sal_Int32 length)390cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
391cdf0e10cSrcweir {
392cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
393cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 	m_xAggregateAsParameters->setBinaryStream(parameterIndex, x, length);
396cdf0e10cSrcweir }
397cdf0e10cSrcweir 
398cdf0e10cSrcweir //------------------------------------------------------------------------------
setCharacterStream(sal_Int32 parameterIndex,const Reference<::com::sun::star::io::XInputStream> & x,sal_Int32 length)399cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
400cdf0e10cSrcweir {
401cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
402cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	m_xAggregateAsParameters->setCharacterStream(parameterIndex, x, length);
405cdf0e10cSrcweir }
406cdf0e10cSrcweir 
407cdf0e10cSrcweir //------------------------------------------------------------------------------
setObject(sal_Int32 parameterIndex,const Any & x)408cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
409cdf0e10cSrcweir {
410cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
411cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	m_xAggregateAsParameters->setObject(parameterIndex, x);
414cdf0e10cSrcweir }
415cdf0e10cSrcweir 
416cdf0e10cSrcweir //------------------------------------------------------------------------------
setObjectWithInfo(sal_Int32 parameterIndex,const Any & x,sal_Int32 targetSqlType,sal_Int32 scale)417cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
418cdf0e10cSrcweir {
419cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
420cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 	m_xAggregateAsParameters->setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
423cdf0e10cSrcweir }
424cdf0e10cSrcweir 
425cdf0e10cSrcweir //------------------------------------------------------------------------------
setRef(sal_Int32 parameterIndex,const Reference<XRef> & x)426cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException)
427cdf0e10cSrcweir {
428cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
429cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 	m_xAggregateAsParameters->setRef(parameterIndex, x);
432cdf0e10cSrcweir }
433cdf0e10cSrcweir 
434cdf0e10cSrcweir //------------------------------------------------------------------------------
setBlob(sal_Int32 parameterIndex,const Reference<XBlob> & x)435cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException)
436cdf0e10cSrcweir {
437cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
438cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 	m_xAggregateAsParameters->setBlob(parameterIndex, x);
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir //------------------------------------------------------------------------------
setClob(sal_Int32 parameterIndex,const Reference<XClob> & x)444cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException)
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
447cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 	m_xAggregateAsParameters->setClob(parameterIndex, x);
450cdf0e10cSrcweir }
451cdf0e10cSrcweir 
452cdf0e10cSrcweir //------------------------------------------------------------------------------
setArray(sal_Int32 parameterIndex,const Reference<XArray> & x)453cdf0e10cSrcweir void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException)
454cdf0e10cSrcweir {
455cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
456cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	m_xAggregateAsParameters->setArray(parameterIndex, x);
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir //------------------------------------------------------------------------------
clearParameters()462cdf0e10cSrcweir void SAL_CALL OPreparedStatement::clearParameters(  ) throw(SQLException, RuntimeException)
463cdf0e10cSrcweir {
464cdf0e10cSrcweir 	MutexGuard aGuard(m_aMutex);
465cdf0e10cSrcweir 	::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	m_xAggregateAsParameters->clearParameters();
468cdf0e10cSrcweir }
469cdf0e10cSrcweir 
470