From 16d173031a2656d7e36300a1989d77cc4d7ca8ed Mon Sep 17 00:00:00 2001 From: Javier Fernandez Date: Thu, 6 Jun 2013 08:27:34 +0000 Subject: Implementing the FStatement::execute() method. Change-Id: I661b8247a0dfaee970b4742b1114fe085cb8f4dd --- .../source/drivers/firebird/FStatement.cxx | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx index 4194e12f29e2..a966d9918c96 100644 --- a/connectivity/source/drivers/firebird/FStatement.cxx +++ b/connectivity/source/drivers/firebird/FStatement.cxx @@ -209,9 +209,34 @@ void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { + static const sal_Unicode pattern('"'); + static const sal_Unicode empty(' '); + OUString query = sql.replace(pattern, empty); + + SAL_INFO("connectivity.firebird", "=> OStatement_Base::executeQuery(). " + "Got called with sql: " << query); + ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); + ISC_STATUS_ARRAY status; // status vector + isc_db_handle db = m_pConnection->getDBHandler(); // database handle + + m_TRANSHandler = 0L; // transaction handle + if (isc_start_transaction(status, &m_TRANSHandler, 1, &db, 0, NULL)) + if (pr_error(status, "start transaction")) + return sal_False; + + char *sqlStr = strdup(OUStringToOString( query, RTL_TEXTENCODING_UTF8 ).getStr()); + if (isc_dsql_execute_immediate(status, &db, &m_TRANSHandler, 0, sqlStr, 1, NULL)) + if (pr_error(status, "create table")) + return sal_False; + free(sqlStr); + + if (isc_commit_transaction(status, &m_TRANSHandler)) + if (pr_error(status, "commit transaction")) + return NULL; + // returns true when a resultset is available return sal_False; } -- cgit v1.2.3