summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-12 08:17:20 +0100
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-12 16:34:28 +0100
commit4e0a1205fb2bdd214f991e60b0945e9dad8d1107 (patch)
tree53fdcf3403e475e5c052f99caf7e417ef4b343d1
parent1d342ab2ebb443a806d0f036e321d708d8b605fa (diff)
Implement readonly support in firebird-sdbc.
Change-Id: Ifdb235a3772b92b7064d059700084f75d468d146
-rw-r--r--connectivity/source/drivers/firebird/FConnection.cxx25
-rw-r--r--connectivity/source/drivers/firebird/FConnection.hxx1
2 files changed, 14 insertions, 12 deletions
diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx
index aa4bf725e93a..3f0f070b3be3 100644
--- a/connectivity/source/drivers/firebird/FConnection.cxx
+++ b/connectivity/source/drivers/firebird/FConnection.cxx
@@ -93,6 +93,7 @@ OConnection::OConnection(FirebirdDriver* _pDriver)
m_bUseCatalog(sal_False),
m_bUseOldDateFormat(sal_False),
m_bAutoCommit(sal_True),
+ m_bReadOnly(sal_False),
m_DBHandler(0),
m_transactionHandle(0)
{
@@ -383,11 +384,10 @@ void OConnection::setupTransaction()
static char isc_tpb[] = {
isc_tpb_version3,
- (m_bAutoCommit ? isc_tpb_autocommit : 0),
- isc_tpb_write,
- isc_tpb_read_committed,
- isc_tpb_wait,
- isc_tpb_no_rec_version
+ (char) (m_bAutoCommit ? isc_tpb_autocommit : 0),
+ (char) (!m_bReadOnly ? isc_tpb_write : isc_tpb_read),
+ isc_tpb_read_committed, // TODO: set isolation level here
+ isc_tpb_wait
};
isc_start_transaction(status_vector, &m_transactionHandle, 1, &m_DBHandler,
@@ -449,22 +449,23 @@ Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLEx
return xMetaData;
}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
+
+void SAL_CALL OConnection::setReadOnly(sal_Bool readOnly)
+ throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- // set you connection to readonly
+ m_bReadOnly = readOnly;
+ setupTransaction();
}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL OConnection::isReadOnly() throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- // return if your connection to readonly
- return sal_False;
+ return m_bReadOnly;
}
// --------------------------------------------------------------------------------
void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/drivers/firebird/FConnection.hxx b/connectivity/source/drivers/firebird/FConnection.hxx
index fb9b0a843d8e..d8338b3992a9 100644
--- a/connectivity/source/drivers/firebird/FConnection.hxx
+++ b/connectivity/source/drivers/firebird/FConnection.hxx
@@ -109,6 +109,7 @@ namespace connectivity
sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases
sal_Bool m_bUseOldDateFormat;
sal_Bool m_bAutoCommit;
+ sal_Bool m_bReadOnly;
isc_db_handle m_DBHandler;
isc_tr_handle m_transactionHandle;