summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorJavier Fernandez <jfernandez@igalia.com>2013-06-06 08:27:34 +0000
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-16 16:40:09 +0200
commit14352be9fc90f8853360fcf9825329a0d1c9e5b0 (patch)
treeb0c4e77b336047e2b72da36d580062d6c36e0a27 /connectivity
parent4e0a1ba7c14e66211ce96efae595ac61897fa3a9 (diff)
Implementing the FStatement::execute() method.
Change-Id: I661b8247a0dfaee970b4742b1114fe085cb8f4dd
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/FStatement.cxx25
1 files changed, 25 insertions, 0 deletions
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;
}