diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-07-25 17:55:04 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-07-25 19:41:19 +0200 |
commit | 5d1245b89c18691eb80b3037cc816a422bb39316 (patch) | |
tree | 69678d302f3dcd3d5b0c03c2107b4c910a3250de /connectivity | |
parent | 79002d6f35da061d4ba8aed2f7fd57efe6aa1aa1 (diff) |
Implement the remaining execute* in PreparedStatement (firebird-sdbc)
Change-Id: I7df7e926c352f5d0ddf7acb4df9b4060a634140d
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/FPreparedStatement.cxx | 47 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/FPreparedStatement.hxx | 21 |
2 files changed, 42 insertions, 26 deletions
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx index ea23116aec81..64633a23d685 100644 --- a/connectivity/source/drivers/firebird/FPreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx @@ -211,26 +211,6 @@ void SAL_CALL OPreparedStatement::close() throw(SQLException, RuntimeException) OStatementCommonBase::close(); } -sal_Bool SAL_CALL OPreparedStatement::execute() - throw(SQLException, RuntimeException) -{ - MutexGuard aGuard( m_pConnection->getMutex() ); - checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); - - // TODO: implement - return sal_False; -} - -sal_Int32 SAL_CALL OPreparedStatement::executeUpdate() - throw(SQLException, RuntimeException) -{ - MutexGuard aGuard( m_pConnection->getMutex() ); - checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); - - // TODO: implement - return 0; -} - void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex, const OUString& x) throw(SQLException, RuntimeException) @@ -281,11 +261,11 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection() return Reference< XConnection >(m_pConnection); } -Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery() +sal_Bool SAL_CALL OPreparedStatement::execute() throw(SQLException, RuntimeException) { SAL_INFO("connectivity.firebird", "executeQuery(). " - "Got called with sql: " << m_sSqlStatement); + "Got called with sql: " << m_sSqlStatement); MutexGuard aGuard( m_pConnection->getMutex() ); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); @@ -304,6 +284,29 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery() evaluateStatusVector(m_statusVector, "isc_dsql_execute", *this); } + // TODO: check we actually got results -- ? + + return sal_True; + // TODO: implement handling of multiple ResultSets. +} + +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate() + throw(SQLException, RuntimeException) +{ + execute(); + // TODO: get the number of rows changed -- look in Statement::executeUpdate for details + return 0; +} + +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery() + throw(SQLException, RuntimeException) +{ + if (!execute()) + { + // execute succeeded but no results + throw SQLException(); // TODO: add message to exception + } + uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection, uno::Reference< XInterface >(*this), m_statementHandle, diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.hxx b/connectivity/source/drivers/firebird/FPreparedStatement.hxx index af7b0db63c50..ab0d1652a481 100644 --- a/connectivity/source/drivers/firebird/FPreparedStatement.hxx +++ b/connectivity/source/drivers/firebird/FPreparedStatement.hxx @@ -114,10 +114,23 @@ namespace connectivity virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); // XPreparedStatement - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL + executeQuery() + throw(::com::sun::star::sdbc::SQLException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL + executeUpdate() + throw(::com::sun::star::sdbc::SQLException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL + execute() + throw(::com::sun::star::sdbc::SQLException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL + getConnection() + throw(::com::sun::star::sdbc::SQLException, + ::com::sun::star::uno::RuntimeException); + // XParameters virtual void SAL_CALL setNull( sal_Int32 nParameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); |