1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright 2008 by Sun Microsystems, Inc. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * $RCSfile: mysqlc_statement.cxx,v $ 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * $Revision: 1.1.2.4 $ 11*cdf0e10cSrcweir * 12*cdf0e10cSrcweir * This file is part of OpenOffice.org. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 15*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 16*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 17*cdf0e10cSrcweir * 18*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 19*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 20*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 22*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 23*cdf0e10cSrcweir * 24*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 25*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 26*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 27*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 28*cdf0e10cSrcweir ************************************************************************/ 29*cdf0e10cSrcweir #include <stdio.h> 30*cdf0e10cSrcweir #include "mysqlc_connection.hxx" 31*cdf0e10cSrcweir #include "mysqlc_propertyids.hxx" 32*cdf0e10cSrcweir #include "mysqlc_resultset.hxx" 33*cdf0e10cSrcweir #include "mysqlc_statement.hxx" 34*cdf0e10cSrcweir #include "mysqlc_general.hxx" 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/sdbc/FetchDirection.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <cppconn/connection.h> 42*cdf0e10cSrcweir #include <cppconn/exception.h> 43*cdf0e10cSrcweir #include <cppconn/statement.h> 44*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 45*cdf0e10cSrcweir #include <osl/diagnose.h> 46*cdf0e10cSrcweir #include <osl/thread.h> 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #define USE_CPP_CONN 1 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir using namespace connectivity::mysqlc; 51*cdf0e10cSrcweir //------------------------------------------------------------------------------ 52*cdf0e10cSrcweir using namespace com::sun::star::uno; 53*cdf0e10cSrcweir using namespace com::sun::star::lang; 54*cdf0e10cSrcweir using namespace com::sun::star::beans; 55*cdf0e10cSrcweir using namespace com::sun::star::sdbc; 56*cdf0e10cSrcweir using namespace com::sun::star::sdbcx; 57*cdf0e10cSrcweir using namespace com::sun::star::container; 58*cdf0e10cSrcweir using namespace com::sun::star::io; 59*cdf0e10cSrcweir using namespace com::sun::star::util; 60*cdf0e10cSrcweir using ::osl::MutexGuard; 61*cdf0e10cSrcweir using ::rtl::OUString; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir #include <stdio.h> 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir /* {{{ OConnection::OCommonStatement() -I- */ 66*cdf0e10cSrcweir OCommonStatement::OCommonStatement(OConnection* _pConnection, sql::Statement *_cppStatement) 67*cdf0e10cSrcweir :OCommonStatement_IBase(m_aMutex) 68*cdf0e10cSrcweir ,OPropertySetHelper(OCommonStatement_IBase::rBHelper) 69*cdf0e10cSrcweir ,OStatement_CBase( (::cppu::OWeakObject*)_pConnection, this ) 70*cdf0e10cSrcweir ,m_pConnection(_pConnection) 71*cdf0e10cSrcweir ,cppStatement(_cppStatement) 72*cdf0e10cSrcweir ,rBHelper(OCommonStatement_IBase::rBHelper) 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::OCommonStatement"); 75*cdf0e10cSrcweir m_pConnection->acquire(); 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir /* }}} */ 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir /* {{{ OConnection::~OCommonStatement() -I- */ 81*cdf0e10cSrcweir OCommonStatement::~OCommonStatement() 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::~OCommonStatement"); 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir /* }}} */ 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir /* {{{ OConnection::disposeResultSet() -I- */ 89*cdf0e10cSrcweir void OCommonStatement::disposeResultSet() 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::disposeResultSet"); 92*cdf0e10cSrcweir // free the cursor if alive 93*cdf0e10cSrcweir delete cppStatement; 94*cdf0e10cSrcweir cppStatement = NULL; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir /* }}} */ 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir /* {{{ OConnection::disposing() -I- */ 100*cdf0e10cSrcweir void OCommonStatement::disposing() 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::disposing"); 103*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir disposeResultSet(); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir if (m_pConnection) { 108*cdf0e10cSrcweir m_pConnection->release(); 109*cdf0e10cSrcweir m_pConnection = NULL; 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir delete cppStatement; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir dispose_ChildImpl(); 114*cdf0e10cSrcweir OCommonStatement_IBase::disposing(); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir /* }}} */ 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir /* {{{ OCommonStatement::queryInterface() -I- */ 120*cdf0e10cSrcweir Any SAL_CALL OCommonStatement::queryInterface(const Type & rType) 121*cdf0e10cSrcweir throw(RuntimeException) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::queryInterface"); 124*cdf0e10cSrcweir Any aRet = OCommonStatement_IBase::queryInterface(rType); 125*cdf0e10cSrcweir if (!aRet.hasValue()) { 126*cdf0e10cSrcweir aRet = OPropertySetHelper::queryInterface(rType); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir return aRet; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir /* }}} */ 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir /* {{{ OCommonStatement::getTypes() -I- */ 134*cdf0e10cSrcweir Sequence< Type > SAL_CALL OCommonStatement::getTypes() 135*cdf0e10cSrcweir throw(RuntimeException) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getTypes"); 138*cdf0e10cSrcweir ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ), 139*cdf0e10cSrcweir ::getCppuType( (const Reference< XFastPropertySet > *)0 ), 140*cdf0e10cSrcweir ::getCppuType( (const Reference< XPropertySet > *)0 )); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir return concatSequences(aTypes.getTypes(), OCommonStatement_IBase::getTypes()); 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir /* }}} */ 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir /* {{{ OCommonStatement::cancel() -I- */ 148*cdf0e10cSrcweir void SAL_CALL OCommonStatement::cancel() 149*cdf0e10cSrcweir throw(RuntimeException) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::cancel"); 152*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 153*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 154*cdf0e10cSrcweir // cancel the current sql statement 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir /* }}} */ 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir /* {{{ OCommonStatement::close() -I- */ 160*cdf0e10cSrcweir void SAL_CALL OCommonStatement::close() 161*cdf0e10cSrcweir throw(SQLException, RuntimeException) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::close"); 164*cdf0e10cSrcweir /* 165*cdf0e10cSrcweir We need a block for the checkDisposed call. 166*cdf0e10cSrcweir After the check we can call dispose() as we are not under lock ?? 167*cdf0e10cSrcweir */ 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 170*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir dispose(); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir /* }}} */ 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir /* {{{ OStatement::clearBatch() -I- */ 178*cdf0e10cSrcweir void SAL_CALL OStatement::clearBatch() 179*cdf0e10cSrcweir throw(SQLException, RuntimeException) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir OSL_TRACE("OStatement::clearBatch"); 182*cdf0e10cSrcweir // if you support batches clear it here 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir /* }}} */ 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir /* {{{ OStatement::execute() -I- */ 188*cdf0e10cSrcweir sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) 189*cdf0e10cSrcweir throw(SQLException, RuntimeException) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::execute"); 192*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 193*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 194*cdf0e10cSrcweir const ::rtl::OUString sSqlStatement = m_pConnection->transFormPreparedStatement( sql ); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir sal_Bool success = false; 197*cdf0e10cSrcweir try { 198*cdf0e10cSrcweir success = cppStatement->execute(OUStringToOString(sSqlStatement, m_pConnection->getConnectionSettings().encoding).getStr())? sal_True:sal_False; 199*cdf0e10cSrcweir } catch (sql::SQLException &e) { 200*cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding()); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir return success; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir /* }}} */ 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir /* {{{ OStatement::executeQuery() -I- */ 208*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery(const OUString& sql) 209*cdf0e10cSrcweir throw(SQLException, RuntimeException) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::executeQuery"); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 214*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 215*cdf0e10cSrcweir const ::rtl::OUString sSqlStatement = m_pConnection->transFormPreparedStatement(sql); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir Reference< XResultSet > xResultSet; 218*cdf0e10cSrcweir try { 219*cdf0e10cSrcweir std::auto_ptr< sql::ResultSet > rset(cppStatement->executeQuery(OUStringToOString(sSqlStatement, m_pConnection->getConnectionEncoding()).getStr())); 220*cdf0e10cSrcweir xResultSet = new OResultSet(this, rset.get(), m_pConnection->getConnectionEncoding()); 221*cdf0e10cSrcweir rset.release(); 222*cdf0e10cSrcweir } catch (sql::SQLException &e) { 223*cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding()); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir return xResultSet; 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir /* }}} */ 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir /* {{{ OStatement::getConnection() -I- */ 231*cdf0e10cSrcweir Reference< XConnection > SAL_CALL OCommonStatement::getConnection() 232*cdf0e10cSrcweir throw(SQLException, RuntimeException) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getConnection"); 235*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 236*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir // just return(our connection here 239*cdf0e10cSrcweir return ((Reference< XConnection >)m_pConnection); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir /* }}} */ 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir /* {{{ OStatement::getUpdateCount() -I- */ 245*cdf0e10cSrcweir sal_Int32 SAL_CALL OCommonStatement::getUpdateCount() 246*cdf0e10cSrcweir throw(SQLException, RuntimeException) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getUpdateCount"); 249*cdf0e10cSrcweir return 0; 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir /* }}} */ 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir /* {{{ OStatement::queryInterface() -I- */ 255*cdf0e10cSrcweir Any SAL_CALL OStatement::queryInterface(const Type & rType) 256*cdf0e10cSrcweir throw(RuntimeException) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir OSL_TRACE("OStatement::queryInterface"); 259*cdf0e10cSrcweir Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this)); 260*cdf0e10cSrcweir if (!aRet.hasValue()) { 261*cdf0e10cSrcweir aRet = OCommonStatement::queryInterface(rType); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir return (aRet); 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir /* }}} */ 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir /* {{{ OStatement::addBatch() -I- */ 269*cdf0e10cSrcweir void SAL_CALL OStatement::addBatch(const OUString& sql) 270*cdf0e10cSrcweir throw(SQLException, RuntimeException) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir OSL_TRACE("OStatement::addBatch"); 273*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 274*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir m_aBatchList.push_back(sql); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir /* }}} */ 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir /* {{{ OStatement::executeBatch() -I- */ 282*cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch() 283*cdf0e10cSrcweir throw(SQLException, RuntimeException) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir OSL_TRACE("OStatement::executeBatch"); 286*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 287*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir Sequence< sal_Int32 > aRet = Sequence< sal_Int32 >(); 290*cdf0e10cSrcweir return aRet; 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir /* }}} */ 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir /* {{{ OCommonStatement::executeUpdate() -I- */ 296*cdf0e10cSrcweir sal_Int32 SAL_CALL OCommonStatement::executeUpdate(const OUString& sql) 297*cdf0e10cSrcweir throw(SQLException, RuntimeException) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::executeUpdate"); 300*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 301*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 302*cdf0e10cSrcweir const ::rtl::OUString sSqlStatement = m_pConnection->transFormPreparedStatement(sql); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir sal_Int32 affectedRows = 0; 305*cdf0e10cSrcweir try { 306*cdf0e10cSrcweir affectedRows = cppStatement->executeUpdate(OUStringToOString(sSqlStatement, m_pConnection->getConnectionEncoding()).getStr()); 307*cdf0e10cSrcweir } catch (sql::SQLException &e) { 308*cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding()); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir return affectedRows; 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir /* }}} */ 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir /* {{{ OCommonStatement::getResultSet() -I- */ 316*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL OCommonStatement::getResultSet() 317*cdf0e10cSrcweir throw(SQLException, RuntimeException) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getResultSet"); 320*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 321*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir Reference< XResultSet > xResultSet; 324*cdf0e10cSrcweir try { 325*cdf0e10cSrcweir std::auto_ptr< sql::ResultSet > rset(cppStatement->getResultSet()); 326*cdf0e10cSrcweir xResultSet = new OResultSet(this, rset.get(), m_pConnection->getConnectionEncoding()); 327*cdf0e10cSrcweir rset.release(); 328*cdf0e10cSrcweir } catch (sql::SQLException &e) { 329*cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding()); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir return xResultSet; 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir /* }}} */ 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir /* {{{ OCommonStatement::getMoreResults() -I- */ 337*cdf0e10cSrcweir sal_Bool SAL_CALL OCommonStatement::getMoreResults() 338*cdf0e10cSrcweir throw(SQLException, RuntimeException) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getMoreResults"); 341*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 342*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir // if your driver supports more than only one resultset 345*cdf0e10cSrcweir // and has one more at this moment return(true 346*cdf0e10cSrcweir return (sal_False); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir /* }}} */ 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir /* {{{ OCommonStatement::getWarnings() -I- */ 352*cdf0e10cSrcweir Any SAL_CALL OCommonStatement::getWarnings() 353*cdf0e10cSrcweir throw(SQLException, RuntimeException) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getWarnings"); 356*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 357*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir return makeAny(m_aLastWarning); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir /* }}} */ 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir /* {{{ OCommonStatement::clearWarnings() -I- */ 365*cdf0e10cSrcweir void SAL_CALL OCommonStatement::clearWarnings() 366*cdf0e10cSrcweir throw(SQLException, RuntimeException) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::clearWarnings"); 369*cdf0e10cSrcweir MutexGuard aGuard(m_aMutex); 370*cdf0e10cSrcweir checkDisposed(rBHelper.bDisposed); 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir m_aLastWarning = SQLWarning(); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir /* }}} */ 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir /* {{{ OCommonStatement::createArrayHelper() -I- */ 378*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::createArrayHelper"); 381*cdf0e10cSrcweir // this properties are define by the service statement 382*cdf0e10cSrcweir // they must in alphabetic order 383*cdf0e10cSrcweir Sequence< Property > aProps(10); 384*cdf0e10cSrcweir Property* pProperties = aProps.getArray(); 385*cdf0e10cSrcweir sal_Int32 nPos = 0; 386*cdf0e10cSrcweir DECL_PROP0(CURSORNAME, OUString); 387*cdf0e10cSrcweir DECL_BOOL_PROP0(ESCAPEPROCESSING); 388*cdf0e10cSrcweir DECL_PROP0(FETCHDIRECTION,sal_Int32); 389*cdf0e10cSrcweir DECL_PROP0(FETCHSIZE, sal_Int32); 390*cdf0e10cSrcweir DECL_PROP0(MAXFIELDSIZE,sal_Int32); 391*cdf0e10cSrcweir DECL_PROP0(MAXROWS, sal_Int32); 392*cdf0e10cSrcweir DECL_PROP0(QUERYTIMEOUT,sal_Int32); 393*cdf0e10cSrcweir DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); 394*cdf0e10cSrcweir DECL_PROP0(RESULTSETTYPE,sal_Int32); 395*cdf0e10cSrcweir DECL_BOOL_PROP0(USEBOOKMARKS); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper(aProps); 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir /* }}} */ 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir /* {{{ OCommonStatement::getInfoHelper() -I- */ 403*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper() 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getInfoHelper"); 406*cdf0e10cSrcweir return(*const_cast<OCommonStatement*>(this)->getArrayHelper()); 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir /* }}} */ 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir /* {{{ OCommonStatement::convertFastPropertyValue() -I- */ 412*cdf0e10cSrcweir sal_Bool OCommonStatement::convertFastPropertyValue( 413*cdf0e10cSrcweir Any & /* rConvertedValue */, Any & /* rOldValue */, 414*cdf0e10cSrcweir sal_Int32 /* nHandle */, const Any& /* rValue */) 415*cdf0e10cSrcweir throw (IllegalArgumentException) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::convertFastPropertyValue"); 418*cdf0e10cSrcweir sal_Bool bConverted = sal_False; 419*cdf0e10cSrcweir // here we have to try to convert 420*cdf0e10cSrcweir return bConverted; 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir /* }}} */ 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir /* {{{ OCommonStatement::setFastPropertyValue_NoBroadcast() -I- */ 426*cdf0e10cSrcweir void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& /* rValue */) 427*cdf0e10cSrcweir throw (Exception) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::setFastPropertyValue_NoBroadcast"); 430*cdf0e10cSrcweir // set the value to what ever is nescessary 431*cdf0e10cSrcweir switch (nHandle) { 432*cdf0e10cSrcweir case PROPERTY_ID_QUERYTIMEOUT: 433*cdf0e10cSrcweir case PROPERTY_ID_MAXFIELDSIZE: 434*cdf0e10cSrcweir case PROPERTY_ID_MAXROWS: 435*cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 436*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 437*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 438*cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 439*cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 440*cdf0e10cSrcweir case PROPERTY_ID_ESCAPEPROCESSING: 441*cdf0e10cSrcweir case PROPERTY_ID_USEBOOKMARKS: 442*cdf0e10cSrcweir default: 443*cdf0e10cSrcweir ; 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir /* }}} */ 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir /* {{{ OCommonStatement::getFastPropertyValue() -I- */ 450*cdf0e10cSrcweir void OCommonStatement::getFastPropertyValue(Any& _rValue, sal_Int32 nHandle) const 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getFastPropertyValue"); 453*cdf0e10cSrcweir switch (nHandle) { 454*cdf0e10cSrcweir case PROPERTY_ID_QUERYTIMEOUT: 455*cdf0e10cSrcweir case PROPERTY_ID_MAXFIELDSIZE: 456*cdf0e10cSrcweir case PROPERTY_ID_MAXROWS: 457*cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 458*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 459*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 460*cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 461*cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 462*cdf0e10cSrcweir case PROPERTY_ID_ESCAPEPROCESSING: 463*cdf0e10cSrcweir break; 464*cdf0e10cSrcweir case PROPERTY_ID_USEBOOKMARKS: 465*cdf0e10cSrcweir _rValue <<= sal_False; 466*cdf0e10cSrcweir break; 467*cdf0e10cSrcweir default: 468*cdf0e10cSrcweir ; 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir /* }}} */ 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement"); 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir /* {{{ OCommonStatement::acquire() -I- */ 476*cdf0e10cSrcweir void SAL_CALL OCommonStatement::acquire() 477*cdf0e10cSrcweir throw() 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::acquire"); 480*cdf0e10cSrcweir OCommonStatement_IBase::acquire(); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir /* }}} */ 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir /* {{{ OCommonStatement::release() -I- */ 486*cdf0e10cSrcweir void SAL_CALL OCommonStatement::release() 487*cdf0e10cSrcweir throw() 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::release"); 490*cdf0e10cSrcweir relase_ChildImpl(); 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir /* }}} */ 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir /* {{{ OStatement::acquire() -I- */ 496*cdf0e10cSrcweir void SAL_CALL OStatement::acquire() 497*cdf0e10cSrcweir throw() 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir OSL_TRACE("OStatement::acquire"); 500*cdf0e10cSrcweir OCommonStatement::acquire(); 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir /* }}} */ 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir /* {{{ OStatement::release() -I- */ 506*cdf0e10cSrcweir void SAL_CALL OStatement::release() 507*cdf0e10cSrcweir throw() 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir OSL_TRACE("OStatement::release"); 510*cdf0e10cSrcweir OCommonStatement::release(); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir /* }}} */ 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir /* {{{ OCommonStatement::getPropertySetInfo() -I- */ 516*cdf0e10cSrcweir Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo() 517*cdf0e10cSrcweir throw(RuntimeException) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir OSL_TRACE("OCommonStatement::getPropertySetInfo"); 520*cdf0e10cSrcweir return(::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper())); 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir /* }}} */ 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir /* 525*cdf0e10cSrcweir * Local variables: 526*cdf0e10cSrcweir * tab-width: 4 527*cdf0e10cSrcweir * c-basic-offset: 4 528*cdf0e10cSrcweir * End: 529*cdf0e10cSrcweir * vim600: noet sw=4 ts=4 fdm=marker 530*cdf0e10cSrcweir * vim<600: noet sw=4 ts=4 531*cdf0e10cSrcweir */ 532