summaryrefslogtreecommitdiff
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-12 16:34:24 +0100
commit77c2b8ddd20235b1a3f7cf7ac9cf2d0575fa563e (patch)
tree442141b5d4a0a8ae73eea59821000abc75c162f4
parent1087a4975f1a5726914fde020f3a80147356a0ec (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;
}