summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Fernandez <jfernandez@igalia.com>2013-06-06 08:27:34 +0000
committerJavier Fernandez <jfernandez@igalia.com>2013-06-06 09:37:46 +0000
commit16d173031a2656d7e36300a1989d77cc4d7ca8ed (patch)
tree536a7e9942e31f8a8737ed0481d1fece5d530780
parent3f7832bb55451293d460024bbbb0476a3ec3c102 (diff)
Implementing the FStatement::execute() method.
Change-Id: I661b8247a0dfaee970b4742b1114fe085cb8f4dd
-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;
}