1*9b5730f6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9b5730f6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9b5730f6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9b5730f6SAndrew Rist * distributed with this work for additional information 6*9b5730f6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9b5730f6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9b5730f6SAndrew Rist * "License"); you may not use this file except in compliance 9*9b5730f6SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*9b5730f6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*9b5730f6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9b5730f6SAndrew Rist * software distributed under the License is distributed on an 15*9b5730f6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9b5730f6SAndrew Rist * KIND, either express or implied. See the License for the 17*9b5730f6SAndrew Rist * specific language governing permissions and limitations 18*9b5730f6SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*9b5730f6SAndrew Rist *************************************************************/ 21*9b5730f6SAndrew Rist 22*9b5730f6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_connectivity.hxx" 26cdf0e10cSrcweir #include "ado/AStatement.hxx" 27cdf0e10cSrcweir #include "ado/AConnection.hxx" 28cdf0e10cSrcweir #include "ado/AResultSet.hxx" 29cdf0e10cSrcweir #include <comphelper/property.hxx> 30cdf0e10cSrcweir #include <comphelper/uno3.hxx> 31cdf0e10cSrcweir #include <osl/thread.h> 32cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 33cdf0e10cSrcweir #include <comphelper/sequence.hxx> 34cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 35cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp> 36cdf0e10cSrcweir #include <com/sun/star/sdbc/FetchDirection.hpp> 37cdf0e10cSrcweir #include "connectivity/dbexception.hxx" 38cdf0e10cSrcweir #include <comphelper/types.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #undef max 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <algorithm> 43cdf0e10cSrcweir 44cdf0e10cSrcweir using namespace ::comphelper; 45cdf0e10cSrcweir 46cdf0e10cSrcweir #define CHECK_RETURN(x) \ 47cdf0e10cSrcweir if(!x) \ 48cdf0e10cSrcweir ADOS::ThrowException(*m_pConnection->getConnection(),*this); 49cdf0e10cSrcweir 50cdf0e10cSrcweir 51cdf0e10cSrcweir 52cdf0e10cSrcweir using namespace connectivity::ado; 53cdf0e10cSrcweir 54cdf0e10cSrcweir //------------------------------------------------------------------------------ 55cdf0e10cSrcweir using namespace com::sun::star::uno; 56cdf0e10cSrcweir using namespace com::sun::star::lang; 57cdf0e10cSrcweir using namespace com::sun::star::beans; 58cdf0e10cSrcweir using namespace com::sun::star::sdbc; 59cdf0e10cSrcweir using namespace ::std; 60cdf0e10cSrcweir //------------------------------------------------------------------------------ 61cdf0e10cSrcweir OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex) 62cdf0e10cSrcweir ,OPropertySetHelper(OStatement_BASE::rBHelper) 63cdf0e10cSrcweir ,OSubComponent<OStatement_Base, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this) 64cdf0e10cSrcweir ,m_pConnection(_pConnection) 65cdf0e10cSrcweir ,m_nFetchSize(1) 66cdf0e10cSrcweir ,m_nMaxRows(0) 67cdf0e10cSrcweir ,m_eLockType(adLockReadOnly) 68cdf0e10cSrcweir ,m_eCursorType(adOpenForwardOnly) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir m_Command.Create(); 73cdf0e10cSrcweir if(m_Command.IsValid()) 74cdf0e10cSrcweir m_Command.putref_ActiveConnection(m_pConnection->getConnection()); 75cdf0e10cSrcweir else 76cdf0e10cSrcweir ADOS::ThrowException(*m_pConnection->getConnection(),*this); 77cdf0e10cSrcweir 78cdf0e10cSrcweir m_RecordsAffected.setNoArg(); 79cdf0e10cSrcweir m_Parameters.setNoArg(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir m_pConnection->acquire(); 82cdf0e10cSrcweir 83cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount ); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir //------------------------------------------------------------------------------ 86cdf0e10cSrcweir void OStatement_Base::disposeResultSet() 87cdf0e10cSrcweir { 88cdf0e10cSrcweir // free the cursor if alive 89cdf0e10cSrcweir Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); 90cdf0e10cSrcweir if (xComp.is()) 91cdf0e10cSrcweir xComp->dispose(); 92cdf0e10cSrcweir m_xResultSet = Reference< XResultSet>(); 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir //------------------------------------------------------------------------------ 96cdf0e10cSrcweir void OStatement_Base::disposing() 97cdf0e10cSrcweir { 98cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 99cdf0e10cSrcweir 100cdf0e10cSrcweir 101cdf0e10cSrcweir disposeResultSet(); 102cdf0e10cSrcweir 103cdf0e10cSrcweir if ( m_Command.IsValid() ) 104cdf0e10cSrcweir m_Command.putref_ActiveConnection( NULL ); 105cdf0e10cSrcweir m_Command.clear(); 106cdf0e10cSrcweir 107cdf0e10cSrcweir if ( m_RecordSet.IsValid() ) 108cdf0e10cSrcweir m_RecordSet.PutRefDataSource( NULL ); 109cdf0e10cSrcweir m_RecordSet.clear(); 110cdf0e10cSrcweir 111cdf0e10cSrcweir if (m_pConnection) 112cdf0e10cSrcweir m_pConnection->release(); 113cdf0e10cSrcweir 114cdf0e10cSrcweir dispose_ChildImpl(); 115cdf0e10cSrcweir OStatement_BASE::disposing(); 116cdf0e10cSrcweir } 117cdf0e10cSrcweir //----------------------------------------------------------------------------- 118cdf0e10cSrcweir void SAL_CALL OStatement_Base::release() throw() 119cdf0e10cSrcweir { 120cdf0e10cSrcweir relase_ChildImpl(); 121cdf0e10cSrcweir } 122cdf0e10cSrcweir //----------------------------------------------------------------------------- 123cdf0e10cSrcweir Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir Any aRet = OStatement_BASE::queryInterface(rType); 126cdf0e10cSrcweir return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType); 127cdf0e10cSrcweir } 128cdf0e10cSrcweir // ------------------------------------------------------------------------- 129cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OStatement_Base::getTypes( ) throw(::com::sun::star::uno::RuntimeException) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), 132cdf0e10cSrcweir ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), 133cdf0e10cSrcweir ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); 134cdf0e10cSrcweir 135cdf0e10cSrcweir return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir // ------------------------------------------------------------------------- 139cdf0e10cSrcweir 140cdf0e10cSrcweir void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 143cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir CHECK_RETURN(m_Command.Cancel()) 147cdf0e10cSrcweir } 148cdf0e10cSrcweir // ------------------------------------------------------------------------- 149cdf0e10cSrcweir 150cdf0e10cSrcweir void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir { 153cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 154cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 155cdf0e10cSrcweir 156cdf0e10cSrcweir } 157cdf0e10cSrcweir dispose(); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir // ------------------------------------------------------------------------- 160cdf0e10cSrcweir 161cdf0e10cSrcweir void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir 164cdf0e10cSrcweir } 165cdf0e10cSrcweir // ------------------------------------------------------------------------- 166cdf0e10cSrcweir 167cdf0e10cSrcweir void OStatement_Base::reset() throw (SQLException) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 170cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 171cdf0e10cSrcweir 172cdf0e10cSrcweir 173cdf0e10cSrcweir clearWarnings (); 174cdf0e10cSrcweir 175cdf0e10cSrcweir if (m_xResultSet.get().is()) 176cdf0e10cSrcweir clearMyResultSet(); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir //-------------------------------------------------------------------- 179cdf0e10cSrcweir // clearMyResultSet 180cdf0e10cSrcweir // If a ResultSet was created for this Statement, close it 181cdf0e10cSrcweir //-------------------------------------------------------------------- 182cdf0e10cSrcweir 183cdf0e10cSrcweir void OStatement_Base::clearMyResultSet () throw (SQLException) 184cdf0e10cSrcweir { 185cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 186cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 187cdf0e10cSrcweir 188cdf0e10cSrcweir try 189cdf0e10cSrcweir { 190cdf0e10cSrcweir Reference<XCloseable> xCloseable; 191cdf0e10cSrcweir if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) ) 192cdf0e10cSrcweir xCloseable->close(); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir catch( const DisposedException& ) { } 195cdf0e10cSrcweir 196cdf0e10cSrcweir m_xResultSet = Reference< XResultSet >(); 197cdf0e10cSrcweir } 198cdf0e10cSrcweir //-------------------------------------------------------------------- 199cdf0e10cSrcweir sal_Int32 OStatement_Base::getRowCount () throw( SQLException) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 202cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 203cdf0e10cSrcweir 204cdf0e10cSrcweir 205cdf0e10cSrcweir return m_RecordsAffected; 206cdf0e10cSrcweir } 207cdf0e10cSrcweir //-------------------------------------------------------------------- 208cdf0e10cSrcweir // getPrecision 209cdf0e10cSrcweir // Given a SQL type, return the maximum precision for the column. 210cdf0e10cSrcweir // Returns -1 if not known 211cdf0e10cSrcweir //-------------------------------------------------------------------- 212cdf0e10cSrcweir 213cdf0e10cSrcweir sal_Int32 OStatement_Base::getPrecision ( sal_Int32 sqlType) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 216cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 217cdf0e10cSrcweir 218cdf0e10cSrcweir 219cdf0e10cSrcweir sal_Int32 prec = -1; 220cdf0e10cSrcweir OTypeInfo aInfo; 221cdf0e10cSrcweir aInfo.nType = (sal_Int16)sqlType; 222cdf0e10cSrcweir if (!m_aTypeInfo.empty()) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir ::std::vector<OTypeInfo>::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo); 225cdf0e10cSrcweir for(;aIter != m_aTypeInfo.end();++aIter) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir prec = ::std::max(prec,(*aIter).nPrecision); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir return prec; 232cdf0e10cSrcweir } 233cdf0e10cSrcweir //-------------------------------------------------------------------- 234cdf0e10cSrcweir // setWarning 235cdf0e10cSrcweir // Sets the warning 236cdf0e10cSrcweir //-------------------------------------------------------------------- 237cdf0e10cSrcweir 238cdf0e10cSrcweir void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 241cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 242cdf0e10cSrcweir 243cdf0e10cSrcweir 244cdf0e10cSrcweir m_aLastWarning = ex; 245cdf0e10cSrcweir } 246cdf0e10cSrcweir // ------------------------------------------------------------------------- 247cdf0e10cSrcweir void OStatement_Base::assignRecordSet( ADORecordset* _pRS ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir WpADORecordset aOldRS( m_RecordSet ); 250cdf0e10cSrcweir m_RecordSet = WpADORecordset( _pRS ); 251cdf0e10cSrcweir 252cdf0e10cSrcweir if ( aOldRS.IsValid() ) 253cdf0e10cSrcweir aOldRS.PutRefDataSource( NULL ); 254cdf0e10cSrcweir 255cdf0e10cSrcweir if ( m_RecordSet.IsValid() ) 256cdf0e10cSrcweir m_RecordSet.PutRefDataSource( (IDispatch*)m_Command ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir // ------------------------------------------------------------------------- 259cdf0e10cSrcweir sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) 260cdf0e10cSrcweir { 261cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 262cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 263cdf0e10cSrcweir 264cdf0e10cSrcweir 265cdf0e10cSrcweir // Reset the statement handle and warning 266cdf0e10cSrcweir 267cdf0e10cSrcweir reset(); 268cdf0e10cSrcweir 269cdf0e10cSrcweir try 270cdf0e10cSrcweir { 271cdf0e10cSrcweir ADORecordset* pSet = NULL; 272cdf0e10cSrcweir CHECK_RETURN(m_Command.put_CommandText(sql)) 273cdf0e10cSrcweir CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText,&pSet)) 274cdf0e10cSrcweir 275cdf0e10cSrcweir assignRecordSet( pSet ); 276cdf0e10cSrcweir } 277cdf0e10cSrcweir catch (SQLWarning& ex) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir 280cdf0e10cSrcweir // Save pointer to warning and save with ResultSet 281cdf0e10cSrcweir // object once it is created. 282cdf0e10cSrcweir 283cdf0e10cSrcweir m_aLastWarning = ex; 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir return m_RecordSet.IsValid(); 287cdf0e10cSrcweir } 288cdf0e10cSrcweir // ------------------------------------------------------------------------- 289cdf0e10cSrcweir Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 292cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 293cdf0e10cSrcweir 294cdf0e10cSrcweir 295cdf0e10cSrcweir reset(); 296cdf0e10cSrcweir 297cdf0e10cSrcweir m_xResultSet = WeakReference<XResultSet>(NULL); 298cdf0e10cSrcweir 299cdf0e10cSrcweir WpADORecordset aSet; 300cdf0e10cSrcweir aSet.Create(); 301cdf0e10cSrcweir CHECK_RETURN(m_Command.put_CommandText(sql)) 302cdf0e10cSrcweir OLEVariant aCmd; 303cdf0e10cSrcweir aCmd.setIDispatch(m_Command); 304cdf0e10cSrcweir OLEVariant aCon; 305cdf0e10cSrcweir aCon.setNoArg(); 306cdf0e10cSrcweir CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize)) 307cdf0e10cSrcweir CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows)) 308cdf0e10cSrcweir CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified)) 309cdf0e10cSrcweir 310cdf0e10cSrcweir 311cdf0e10cSrcweir CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize)) 312cdf0e10cSrcweir CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows)) 313cdf0e10cSrcweir CHECK_RETURN(aSet.get_CursorType(m_eCursorType)) 314cdf0e10cSrcweir CHECK_RETURN(aSet.get_LockType(m_eLockType)) 315cdf0e10cSrcweir 316cdf0e10cSrcweir OResultSet* pSet = new OResultSet(aSet,this); 317cdf0e10cSrcweir Reference< XResultSet > xRs = pSet; 318cdf0e10cSrcweir pSet->construct(); 319cdf0e10cSrcweir 320cdf0e10cSrcweir m_xResultSet = WeakReference<XResultSet>(xRs); 321cdf0e10cSrcweir 322cdf0e10cSrcweir return xRs; 323cdf0e10cSrcweir } 324cdf0e10cSrcweir // ------------------------------------------------------------------------- 325cdf0e10cSrcweir 326cdf0e10cSrcweir Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 329cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 330cdf0e10cSrcweir 331cdf0e10cSrcweir 332cdf0e10cSrcweir return (Reference< XConnection >)m_pConnection; 333cdf0e10cSrcweir } 334cdf0e10cSrcweir // ------------------------------------------------------------------------- 335cdf0e10cSrcweir 336cdf0e10cSrcweir Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this)); 339cdf0e10cSrcweir return aRet.hasValue() ? aRet : OStatement_Base::queryInterface(rType); 340cdf0e10cSrcweir } 341cdf0e10cSrcweir // ------------------------------------------------------------------------- 342cdf0e10cSrcweir 343cdf0e10cSrcweir void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 346cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 347cdf0e10cSrcweir 348cdf0e10cSrcweir 349cdf0e10cSrcweir m_aBatchList.push_back(sql); 350cdf0e10cSrcweir } 351cdf0e10cSrcweir // ------------------------------------------------------------------------- 352cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 355cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 356cdf0e10cSrcweir 357cdf0e10cSrcweir 358cdf0e10cSrcweir reset(); 359cdf0e10cSrcweir 360cdf0e10cSrcweir ::rtl::OUString aBatchSql; 361cdf0e10cSrcweir sal_Int32 nLen = 0; 362cdf0e10cSrcweir for(::std::list< ::rtl::OUString>::const_iterator i=m_aBatchList.begin();i != m_aBatchList.end();++i,++nLen) 363cdf0e10cSrcweir aBatchSql = aBatchSql + *i + ::rtl::OUString::createFromAscii(";"); 364cdf0e10cSrcweir 365cdf0e10cSrcweir 366cdf0e10cSrcweir if ( m_RecordSet.IsValid() ) 367cdf0e10cSrcweir m_RecordSet.PutRefDataSource( NULL ); 368cdf0e10cSrcweir m_RecordSet.clear(); 369cdf0e10cSrcweir m_RecordSet.Create(); 370cdf0e10cSrcweir 371cdf0e10cSrcweir CHECK_RETURN(m_Command.put_CommandText(aBatchSql)) 372cdf0e10cSrcweir if ( m_RecordSet.IsValid() ) 373cdf0e10cSrcweir m_RecordSet.PutRefDataSource((IDispatch*)m_Command); 374cdf0e10cSrcweir 375cdf0e10cSrcweir CHECK_RETURN(m_RecordSet.UpdateBatch(adAffectAll)) 376cdf0e10cSrcweir 377cdf0e10cSrcweir ADORecordset* pSet=NULL; 378cdf0e10cSrcweir Sequence< sal_Int32 > aRet(nLen); 379cdf0e10cSrcweir sal_Int32* pArray = aRet.getArray(); 380cdf0e10cSrcweir for(sal_Int32 j=0;j<nLen;++j) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir pSet = NULL; 383cdf0e10cSrcweir OLEVariant aRecordsAffected; 384cdf0e10cSrcweir if(m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir assignRecordSet( pSet ); 387cdf0e10cSrcweir 388cdf0e10cSrcweir sal_Int32 nValue; 389cdf0e10cSrcweir if(m_RecordSet.get_RecordCount(nValue)) 390cdf0e10cSrcweir pArray[j] = nValue; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393cdf0e10cSrcweir return aRet; 394cdf0e10cSrcweir } 395cdf0e10cSrcweir // ------------------------------------------------------------------------- 396cdf0e10cSrcweir 397cdf0e10cSrcweir 398cdf0e10cSrcweir sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 401cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 402cdf0e10cSrcweir 403cdf0e10cSrcweir 404cdf0e10cSrcweir reset(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir try { 407cdf0e10cSrcweir ADORecordset* pSet = NULL; 408cdf0e10cSrcweir CHECK_RETURN(m_Command.put_CommandText(sql)) 409cdf0e10cSrcweir CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText|adExecuteNoRecords,&pSet)) 410cdf0e10cSrcweir } 411cdf0e10cSrcweir catch (SQLWarning& ex) { 412cdf0e10cSrcweir 413cdf0e10cSrcweir // Save pointer to warning and save with ResultSet 414cdf0e10cSrcweir // object once it is created. 415cdf0e10cSrcweir 416cdf0e10cSrcweir m_aLastWarning = ex; 417cdf0e10cSrcweir } 418cdf0e10cSrcweir if(!m_RecordsAffected.isEmpty() && !m_RecordsAffected.isNull() && m_RecordsAffected.getType() != VT_ERROR) 419cdf0e10cSrcweir return m_RecordsAffected; 420cdf0e10cSrcweir 421cdf0e10cSrcweir return 0; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir // ------------------------------------------------------------------------- 424cdf0e10cSrcweir 425cdf0e10cSrcweir Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException) 426cdf0e10cSrcweir { 427cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 428cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 429cdf0e10cSrcweir 430cdf0e10cSrcweir 431cdf0e10cSrcweir return m_xResultSet; 432cdf0e10cSrcweir } 433cdf0e10cSrcweir // ------------------------------------------------------------------------- 434cdf0e10cSrcweir 435cdf0e10cSrcweir sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, RuntimeException) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 438cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 439cdf0e10cSrcweir 440cdf0e10cSrcweir 441cdf0e10cSrcweir sal_Int32 nRet; 442cdf0e10cSrcweir if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet)) 443cdf0e10cSrcweir return nRet; 444cdf0e10cSrcweir return -1; 445cdf0e10cSrcweir } 446cdf0e10cSrcweir // ------------------------------------------------------------------------- 447cdf0e10cSrcweir 448cdf0e10cSrcweir sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 451cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 452cdf0e10cSrcweir 453cdf0e10cSrcweir 454cdf0e10cSrcweir SQLWarning warning; 455cdf0e10cSrcweir 456cdf0e10cSrcweir // clear previous warnings 457cdf0e10cSrcweir 458cdf0e10cSrcweir clearWarnings (); 459cdf0e10cSrcweir 460cdf0e10cSrcweir // Call SQLMoreResults 461cdf0e10cSrcweir 462cdf0e10cSrcweir try 463cdf0e10cSrcweir { 464cdf0e10cSrcweir ADORecordset* pSet=NULL; 465cdf0e10cSrcweir OLEVariant aRecordsAffected; 466cdf0e10cSrcweir if(m_RecordSet.IsValid() && m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet) 467cdf0e10cSrcweir assignRecordSet( pSet ); 468cdf0e10cSrcweir } 469cdf0e10cSrcweir catch (SQLWarning &ex) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir 472cdf0e10cSrcweir // Save pointer to warning and save with ResultSet 473cdf0e10cSrcweir // object once it is created. 474cdf0e10cSrcweir 475cdf0e10cSrcweir warning = ex; 476cdf0e10cSrcweir } 477cdf0e10cSrcweir return m_RecordSet.IsValid(); 478cdf0e10cSrcweir } 479cdf0e10cSrcweir // ------------------------------------------------------------------------- 480cdf0e10cSrcweir 481cdf0e10cSrcweir // ------------------------------------------------------------------------- 482cdf0e10cSrcweir Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 485cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 486cdf0e10cSrcweir 487cdf0e10cSrcweir 488cdf0e10cSrcweir return makeAny(m_aLastWarning); 489cdf0e10cSrcweir } 490cdf0e10cSrcweir // ------------------------------------------------------------------------- 491cdf0e10cSrcweir 492cdf0e10cSrcweir // ------------------------------------------------------------------------- 493cdf0e10cSrcweir void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 496cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 497cdf0e10cSrcweir 498cdf0e10cSrcweir 499cdf0e10cSrcweir m_aLastWarning = SQLWarning(); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir // ------------------------------------------------------------------------- 502cdf0e10cSrcweir //------------------------------------------------------------------------------ 503cdf0e10cSrcweir sal_Int32 OStatement_Base::getQueryTimeOut() const throw(SQLException, RuntimeException) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir return m_Command.get_CommandTimeout(); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir //------------------------------------------------------------------------------ 508cdf0e10cSrcweir sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeException) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir sal_Int32 nRet=-1; 511cdf0e10cSrcweir if(!(m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet))) 512cdf0e10cSrcweir ::dbtools::throwFunctionSequenceException(NULL); 513cdf0e10cSrcweir return nRet; 514cdf0e10cSrcweir } 515cdf0e10cSrcweir //------------------------------------------------------------------------------ 516cdf0e10cSrcweir sal_Int32 OStatement_Base::getResultSetConcurrency() const throw(SQLException, RuntimeException) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir return m_eLockType; 519cdf0e10cSrcweir sal_Int32 nValue=0; 520cdf0e10cSrcweir switch(m_eLockType) 521cdf0e10cSrcweir { 522cdf0e10cSrcweir case adLockReadOnly: 523cdf0e10cSrcweir nValue = ResultSetConcurrency::READ_ONLY; 524cdf0e10cSrcweir break; 525cdf0e10cSrcweir default: 526cdf0e10cSrcweir nValue = ResultSetConcurrency::UPDATABLE; 527cdf0e10cSrcweir break; 528cdf0e10cSrcweir } 529cdf0e10cSrcweir 530cdf0e10cSrcweir return nValue; 531cdf0e10cSrcweir } 532cdf0e10cSrcweir //------------------------------------------------------------------------------ 533cdf0e10cSrcweir sal_Int32 OStatement_Base::getResultSetType() const throw(SQLException, RuntimeException) 534cdf0e10cSrcweir { 535cdf0e10cSrcweir sal_Int32 nValue=0; 536cdf0e10cSrcweir switch(m_eCursorType) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir case adOpenUnspecified: 539cdf0e10cSrcweir case adOpenForwardOnly: 540cdf0e10cSrcweir nValue = ResultSetType::FORWARD_ONLY; 541cdf0e10cSrcweir break; 542cdf0e10cSrcweir case adOpenStatic: 543cdf0e10cSrcweir case adOpenKeyset: 544cdf0e10cSrcweir nValue = ResultSetType::SCROLL_INSENSITIVE; 545cdf0e10cSrcweir break; 546cdf0e10cSrcweir case adOpenDynamic: 547cdf0e10cSrcweir nValue = ResultSetType::SCROLL_SENSITIVE; 548cdf0e10cSrcweir break; 549cdf0e10cSrcweir } 550cdf0e10cSrcweir return nValue; 551cdf0e10cSrcweir } 552cdf0e10cSrcweir //------------------------------------------------------------------------------ 553cdf0e10cSrcweir sal_Int32 OStatement_Base::getFetchDirection() const throw(SQLException, RuntimeException) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir return FetchDirection::FORWARD; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir //------------------------------------------------------------------------------ 558cdf0e10cSrcweir sal_Int32 OStatement_Base::getFetchSize() const throw(SQLException, RuntimeException) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir return m_nFetchSize; 561cdf0e10cSrcweir } 562cdf0e10cSrcweir //------------------------------------------------------------------------------ 563cdf0e10cSrcweir sal_Int32 OStatement_Base::getMaxFieldSize() const throw(SQLException, RuntimeException) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir return 0; 566cdf0e10cSrcweir } 567cdf0e10cSrcweir //------------------------------------------------------------------------------ 568cdf0e10cSrcweir ::rtl::OUString OStatement_Base::getCursorName() const throw(SQLException, RuntimeException) 569cdf0e10cSrcweir { 570cdf0e10cSrcweir return m_Command.GetName(); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir //------------------------------------------------------------------------------ 573cdf0e10cSrcweir void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) throw(SQLException, RuntimeException) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 576cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 577cdf0e10cSrcweir 578cdf0e10cSrcweir 579cdf0e10cSrcweir m_Command.put_CommandTimeout(seconds); 580cdf0e10cSrcweir } 581cdf0e10cSrcweir //------------------------------------------------------------------------------ 582cdf0e10cSrcweir void OStatement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 585cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 586cdf0e10cSrcweir 587cdf0e10cSrcweir m_nMaxRows = _par0; 588cdf0e10cSrcweir } 589cdf0e10cSrcweir //------------------------------------------------------------------------------ 590cdf0e10cSrcweir void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 593cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 594cdf0e10cSrcweir 595cdf0e10cSrcweir switch(_par0) 596cdf0e10cSrcweir { 597cdf0e10cSrcweir case ResultSetConcurrency::READ_ONLY: 598cdf0e10cSrcweir m_eLockType = adLockReadOnly; 599cdf0e10cSrcweir break; 600cdf0e10cSrcweir default: 601cdf0e10cSrcweir m_eLockType = adLockOptimistic; 602cdf0e10cSrcweir break; 603cdf0e10cSrcweir } 604cdf0e10cSrcweir } 605cdf0e10cSrcweir //------------------------------------------------------------------------------ 606cdf0e10cSrcweir void OStatement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 609cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 610cdf0e10cSrcweir 611cdf0e10cSrcweir 612cdf0e10cSrcweir switch(_par0) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir case ResultSetType::FORWARD_ONLY: 615cdf0e10cSrcweir m_eCursorType = adOpenForwardOnly; 616cdf0e10cSrcweir break; 617cdf0e10cSrcweir case ResultSetType::SCROLL_INSENSITIVE: 618cdf0e10cSrcweir m_eCursorType = adOpenKeyset; 619cdf0e10cSrcweir break; 620cdf0e10cSrcweir case ResultSetType::SCROLL_SENSITIVE: 621cdf0e10cSrcweir m_eCursorType = adOpenDynamic; 622cdf0e10cSrcweir break; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir } 625cdf0e10cSrcweir //------------------------------------------------------------------------------ 626cdf0e10cSrcweir void OStatement_Base::setFetchDirection(sal_Int32 /*_par0*/) throw(SQLException, RuntimeException) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 629cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 630cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "Statement::FetchDirection", *this ); 631cdf0e10cSrcweir } 632cdf0e10cSrcweir //------------------------------------------------------------------------------ 633cdf0e10cSrcweir void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 636cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 637cdf0e10cSrcweir 638cdf0e10cSrcweir 639cdf0e10cSrcweir m_nFetchSize = _par0; 640cdf0e10cSrcweir // m_RecordSet.put_CacheSize(_par0); 641cdf0e10cSrcweir } 642cdf0e10cSrcweir //------------------------------------------------------------------------------ 643cdf0e10cSrcweir void OStatement_Base::setMaxFieldSize(sal_Int32 /*_par0*/) throw(SQLException, RuntimeException) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 646cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 647cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "Statement::MaxFieldSize", *this ); 648cdf0e10cSrcweir } 649cdf0e10cSrcweir //------------------------------------------------------------------------------ 650cdf0e10cSrcweir void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException) 651cdf0e10cSrcweir { 652cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 653cdf0e10cSrcweir checkDisposed(OStatement_BASE::rBHelper.bDisposed); 654cdf0e10cSrcweir 655cdf0e10cSrcweir m_Command.put_Name(_par0); 656cdf0e10cSrcweir } 657cdf0e10cSrcweir 658cdf0e10cSrcweir // ------------------------------------------------------------------------- 659cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const 660cdf0e10cSrcweir { 661cdf0e10cSrcweir Sequence< com::sun::star::beans::Property > aProps(10); 662cdf0e10cSrcweir com::sun::star::beans::Property* pProperties = aProps.getArray(); 663cdf0e10cSrcweir sal_Int32 nPos = 0; 664cdf0e10cSrcweir DECL_PROP0(CURSORNAME, ::rtl::OUString); 665cdf0e10cSrcweir DECL_BOOL_PROP0(ESCAPEPROCESSING); 666cdf0e10cSrcweir DECL_PROP0(FETCHDIRECTION,sal_Int32); 667cdf0e10cSrcweir DECL_PROP0(FETCHSIZE, sal_Int32); 668cdf0e10cSrcweir DECL_PROP0(MAXFIELDSIZE,sal_Int32); 669cdf0e10cSrcweir DECL_PROP0(MAXROWS, sal_Int32); 670cdf0e10cSrcweir DECL_PROP0(QUERYTIMEOUT,sal_Int32); 671cdf0e10cSrcweir DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); 672cdf0e10cSrcweir DECL_PROP0(RESULTSETTYPE,sal_Int32); 673cdf0e10cSrcweir DECL_BOOL_PROP0(USEBOOKMARKS); 674cdf0e10cSrcweir 675cdf0e10cSrcweir 676cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper(aProps); 677cdf0e10cSrcweir } 678cdf0e10cSrcweir 679cdf0e10cSrcweir // ------------------------------------------------------------------------- 680cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() 681cdf0e10cSrcweir { 682cdf0e10cSrcweir return *const_cast<OStatement_Base*>(this)->getArrayHelper(); 683cdf0e10cSrcweir } 684cdf0e10cSrcweir // ------------------------------------------------------------------------- 685cdf0e10cSrcweir sal_Bool OStatement_Base::convertFastPropertyValue( 686cdf0e10cSrcweir Any & rConvertedValue, 687cdf0e10cSrcweir Any & rOldValue, 688cdf0e10cSrcweir sal_Int32 nHandle, 689cdf0e10cSrcweir const Any& rValue ) 690cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException) 691cdf0e10cSrcweir { 692cdf0e10cSrcweir sal_Bool bModified = sal_False; 693cdf0e10cSrcweir 694cdf0e10cSrcweir sal_Bool bValidAdoRS = m_RecordSet.IsValid(); 695cdf0e10cSrcweir // some of the properties below, when set, are remembered in a member, and applied in the next execute 696cdf0e10cSrcweir // For these properties, the record set does not need to be valid to allow setting them. 697cdf0e10cSrcweir // For all others (where the values are forwarded to the ADO RS directly), the recordset must be valid. 698cdf0e10cSrcweir 699cdf0e10cSrcweir try 700cdf0e10cSrcweir { 701cdf0e10cSrcweir switch(nHandle) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir case PROPERTY_ID_MAXROWS: 704cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue( rConvertedValue, rOldValue, rValue, bValidAdoRS ? getMaxRows() : m_nMaxRows ); 705cdf0e10cSrcweir break; 706cdf0e10cSrcweir 707cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 708cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType()); 709cdf0e10cSrcweir break; 710cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 711cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); 712cdf0e10cSrcweir break; 713cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 714cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency()); 715cdf0e10cSrcweir break; 716cdf0e10cSrcweir case PROPERTY_ID_QUERYTIMEOUT: 717cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut()); 718cdf0e10cSrcweir break; 719cdf0e10cSrcweir case PROPERTY_ID_MAXFIELDSIZE: 720cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize()); 721cdf0e10cSrcweir break; 722cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 723cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName()); 724cdf0e10cSrcweir break; 725cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 726cdf0e10cSrcweir bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); 727cdf0e10cSrcweir break; 728cdf0e10cSrcweir } 729cdf0e10cSrcweir } 730cdf0e10cSrcweir catch( const Exception& e ) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir bModified = sal_True; // will ensure that the property is set 733cdf0e10cSrcweir OSL_ENSURE( sal_False, "OStatement_Base::convertFastPropertyValue: caught something strange!" ); 734cdf0e10cSrcweir (void)e; 735cdf0e10cSrcweir } 736cdf0e10cSrcweir return bModified; 737cdf0e10cSrcweir } 738cdf0e10cSrcweir // ------------------------------------------------------------------------- 739cdf0e10cSrcweir void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir switch(nHandle) 742cdf0e10cSrcweir { 743cdf0e10cSrcweir case PROPERTY_ID_QUERYTIMEOUT: 744cdf0e10cSrcweir setQueryTimeOut(comphelper::getINT32(rValue)); 745cdf0e10cSrcweir break; 746cdf0e10cSrcweir case PROPERTY_ID_MAXFIELDSIZE: 747cdf0e10cSrcweir setMaxFieldSize(comphelper::getINT32(rValue)); 748cdf0e10cSrcweir break; 749cdf0e10cSrcweir case PROPERTY_ID_MAXROWS: 750cdf0e10cSrcweir setMaxRows(comphelper::getINT32(rValue)); 751cdf0e10cSrcweir break; 752cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 753cdf0e10cSrcweir setCursorName(comphelper::getString(rValue)); 754cdf0e10cSrcweir break; 755cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 756cdf0e10cSrcweir setResultSetConcurrency(comphelper::getINT32(rValue)); 757cdf0e10cSrcweir break; 758cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 759cdf0e10cSrcweir setResultSetType(comphelper::getINT32(rValue)); 760cdf0e10cSrcweir break; 761cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 762cdf0e10cSrcweir setFetchDirection(comphelper::getINT32(rValue)); 763cdf0e10cSrcweir break; 764cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 765cdf0e10cSrcweir setFetchSize(comphelper::getINT32(rValue)); 766cdf0e10cSrcweir break; 767cdf0e10cSrcweir case PROPERTY_ID_ESCAPEPROCESSING: 768cdf0e10cSrcweir // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); 769cdf0e10cSrcweir case PROPERTY_ID_USEBOOKMARKS: 770cdf0e10cSrcweir // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); 771cdf0e10cSrcweir default: 772cdf0e10cSrcweir ; 773cdf0e10cSrcweir } 774cdf0e10cSrcweir } 775cdf0e10cSrcweir // ------------------------------------------------------------------------- 776cdf0e10cSrcweir void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const 777cdf0e10cSrcweir { 778cdf0e10cSrcweir switch(nHandle) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir case PROPERTY_ID_QUERYTIMEOUT: 781cdf0e10cSrcweir rValue <<= getQueryTimeOut(); 782cdf0e10cSrcweir break; 783cdf0e10cSrcweir case PROPERTY_ID_MAXFIELDSIZE: 784cdf0e10cSrcweir rValue <<= getMaxFieldSize(); 785cdf0e10cSrcweir break; 786cdf0e10cSrcweir case PROPERTY_ID_MAXROWS: 787cdf0e10cSrcweir rValue <<= getMaxRows(); 788cdf0e10cSrcweir break; 789cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 790cdf0e10cSrcweir rValue <<= getCursorName(); 791cdf0e10cSrcweir break; 792cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 793cdf0e10cSrcweir rValue <<= getResultSetConcurrency(); 794cdf0e10cSrcweir break; 795cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 796cdf0e10cSrcweir rValue <<= getResultSetType(); 797cdf0e10cSrcweir break; 798cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 799cdf0e10cSrcweir rValue <<= getFetchDirection(); 800cdf0e10cSrcweir break; 801cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 802cdf0e10cSrcweir rValue <<= getFetchSize(); 803cdf0e10cSrcweir break; 804cdf0e10cSrcweir case PROPERTY_ID_ESCAPEPROCESSING: 805cdf0e10cSrcweir rValue <<= sal_True; 806cdf0e10cSrcweir break; 807cdf0e10cSrcweir case PROPERTY_ID_USEBOOKMARKS: 808cdf0e10cSrcweir default: 809cdf0e10cSrcweir ; 810cdf0e10cSrcweir } 811cdf0e10cSrcweir } 812cdf0e10cSrcweir // ------------------------------------------------------------------------- 813cdf0e10cSrcweir OStatement::~OStatement() 814cdf0e10cSrcweir { 815cdf0e10cSrcweir } 816cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement"); 817cdf0e10cSrcweir // ----------------------------------------------------------------------------- 818cdf0e10cSrcweir void SAL_CALL OStatement_Base::acquire() throw() 819cdf0e10cSrcweir { 820cdf0e10cSrcweir OStatement_BASE::acquire(); 821cdf0e10cSrcweir } 822cdf0e10cSrcweir // ----------------------------------------------------------------------------- 823cdf0e10cSrcweir void SAL_CALL OStatement::acquire() throw() 824cdf0e10cSrcweir { 825cdf0e10cSrcweir OStatement_Base::acquire(); 826cdf0e10cSrcweir } 827cdf0e10cSrcweir // ----------------------------------------------------------------------------- 828cdf0e10cSrcweir void SAL_CALL OStatement::release() throw() 829cdf0e10cSrcweir { 830cdf0e10cSrcweir OStatement_Base::release(); 831cdf0e10cSrcweir } 832cdf0e10cSrcweir // ----------------------------------------------------------------------------- 833cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 834cdf0e10cSrcweir { 835cdf0e10cSrcweir return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); 836cdf0e10cSrcweir } 837cdf0e10cSrcweir // ----------------------------------------------------------------------------- 838