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-10 14:09:30 +0100
commit2aeb035039c9ae42b8de2797b865f702eb8c02f5 (patch)
tree7c412492db12241276f483d15b8438023e9fed91
parent8c63237a5491f8e3d1c8e9df767acff3ab45adfb (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;
}