LibreOffice Module connectivity (master) 1
|
#include <Connection.hxx>
Public Member Functions | |
Connection () | |
virtual | ~Connection () override |
void | construct (const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) |
const OUString & | getConnectionURL () const |
bool | isEmbedded () const |
isc_db_handle & | getDBHandle () |
isc_tr_handle & | getTransaction () |
css::uno::Reference< css::sdbc::XBlob > | createBlob (ISC_QUAD const *pBlobID) |
Create a new Blob tied to this connection. More... | |
css::uno::Reference< css::sdbc::XClob > | createClob (ISC_QUAD const *pBlobID) |
css::uno::Reference< css::sdbcx::XTablesSupplier > | createCatalog () |
Create and/or connect to the sdbcx Catalog. More... | |
void | storeDatabase () |
Backup and store embedded extracted database to the .odb file. More... | |
virtual void SAL_CALL | disposing () override |
DECLARE_SERVICE_INFO () | |
virtual sal_Int64 SAL_CALL | getSomething (const css::uno::Sequence< sal_Int8 > &rId) override |
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL | createStatement () override |
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL | prepareStatement (const OUString &sql) override |
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL | prepareCall (const OUString &sql) override |
virtual OUString SAL_CALL | nativeSQL (const OUString &sql) override |
virtual void SAL_CALL | setAutoCommit (sal_Bool autoCommit) override |
virtual sal_Bool SAL_CALL | getAutoCommit () override |
virtual void SAL_CALL | commit () override |
virtual void SAL_CALL | rollback () override |
virtual sal_Bool SAL_CALL | isClosed () override |
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL | getMetaData () override |
virtual void SAL_CALL | setReadOnly (sal_Bool readOnly) override |
virtual sal_Bool SAL_CALL | isReadOnly () override |
virtual void SAL_CALL | setCatalog (const OUString &catalog) override |
virtual OUString SAL_CALL | getCatalog () override |
virtual void SAL_CALL | setTransactionIsolation (sal_Int32 level) override |
virtual sal_Int32 SAL_CALL | getTransactionIsolation () override |
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL | getTypeMap () override |
virtual void SAL_CALL | setTypeMap (const css::uno::Reference< css::container::XNameAccess > &typeMap) override |
virtual void SAL_CALL | close () override |
virtual css::uno::Any SAL_CALL | getWarnings () override |
virtual void SAL_CALL | clearWarnings () override |
virtual void SAL_CALL | documentEventOccured (const css::document::DocumentEvent &Event) override |
virtual void SAL_CALL | disposing (const css::lang::EventObject &Source) override |
Static Public Member Functions | |
static const css::uno::Sequence< sal_Int8 > & | getUnoTunnelId () |
Private Member Functions | |
void | loadDatabaseFile (const OUString &pSrcLocation, const OUString &pTmpLocation) |
void | runBackupService (const short nAction) |
Run the backup service, use nAction = isc_action_svc_backup to backup, nAction = isc_action_svc_restore to restore. More... | |
isc_svc_handle | attachServiceManager () |
void | detachServiceManager (isc_svc_handle pServiceHandle) |
void | buildTypeInfo () |
void | setupTransaction () |
Creates a new transaction with the desired parameters, if necessary discarding an existing transaction. More... | |
void | disposeStatements () |
Private Attributes | |
::osl::Mutex | m_aMutex |
TTypeInfoVector | m_aTypeInfo |
OUString | m_sConnectionURL |
The URL passed to us when opening, i.e. More... | |
OUString | m_sFirebirdURL |
The URL passed to firebird, i.e. More... | |
bool | m_bIsEmbedded |
Denotes that we have a database stored within a .odb file. More... | |
css::uno::Reference< css::util::XModifiable > | m_xParentDocument |
Handle for the parent DatabaseDocument. More... | |
css::uno::Reference< css::embed::XStorage > | m_xEmbeddedStorage |
Handle for the folder within the .odb where we store our .fbk (Only used if m_bIsEmbedded is true). More... | |
std::unique_ptr< ::utl::TempFileNamed > | m_pDatabaseFileDir |
The temporary folder where we extract the .fbk from a .odb, and also store the temporary .fdb It is only valid if m_bIsEmbedded is true. More... | |
OUString | m_sFBKPath |
Path for our extracted .fbk file. More... | |
bool | m_bIsFile |
We are using an external (local) file. More... | |
bool | m_bIsAutoCommit |
bool | m_bIsReadOnly |
sal_Int32 | m_aTransactionIsolation |
isc_db_handle | m_aDBHandle |
isc_tr_handle | m_aTransactionHandle |
css::uno::WeakReference< css::sdbcx::XTablesSupplier > | m_xCatalog |
css::uno::WeakReference< css::sdbc::XDatabaseMetaData > | m_xMetaData |
OWeakRefArray | m_aStatements |
Statements owned by this connection. More... | |
Definition at line 62 of file drivers/firebird/Connection.hxx.
|
explicit |
Definition at line 81 of file Connection.cxx.
|
overridevirtual |
Definition at line 100 of file Connection.cxx.
References close(), and isClosed().
|
private |
Definition at line 564 of file Connection.cxx.
References connectivity::firebird::evaluateStatusVector(), pq_sdbc_driver::OUStringToOString(), and u.
Referenced by runBackupService().
|
private |
css::sdbc::SQLException |
Definition at line 830 of file Connection.cxx.
References connectivity::OTypeInfo::aLocalTypeName, connectivity::OTypeInfo::aTypeName, getMetaData(), m_aMutex, m_aTypeInfo, connectivity::OTypeInfo::nMaximumScale, connectivity::OTypeInfo::nPrecision, connectivity::OTypeInfo::nType, and SAL_INFO.
Referenced by createStatement(), and prepareStatement().
|
overridevirtual |
Definition at line 800 of file Connection.cxx.
|
overridevirtual |
Definition at line 782 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), dispose(), and m_aMutex.
Referenced by ~Connection().
|
overridevirtual |
Definition at line 530 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), disposeStatements(), connectivity::firebird::evaluateStatusVector(), m_aMutex, m_aTransactionHandle, m_bIsAutoCommit, and u.
Referenced by documentEventOccured().
void Connection::construct | ( | const OUString & | url, |
const css::uno::Sequence< css::beans::PropertyValue > & | info | ||
) |
css::sdbc::SQLException | |
css::uno::RuntimeException |
Definition at line 124 of file Connection.cxx.
References connectivity::firebird::evaluateStatusVector(), Exception, comphelper::getProcessComponentContext(), connectivity::SharedResources::getResourceString(), loadDatabaseFile(), m_aDBHandle, m_bIsEmbedded, m_bIsFile, m_pDatabaseFileDir, m_refCount, m_sConnectionURL, m_sFBKPath, m_sFirebirdURL, m_xEmbeddedStorage, m_xParentDocument, our_sFBKLocation(), our_sFDBLocation(), pq_sdbc_driver::OUStringToOString(), runBackupService(), SAL_INFO, sMessage, dbtools::throwGenericSQLException(), u, and value.
css::uno::Reference< css::sdbc::XBlob > connectivity::firebird::Connection::createBlob | ( | ISC_QUAD const * | pBlobID | ) |
Create a new Blob tied to this connection.
Blobs are tied to a transaction and not to a statement, hence the connection should deal with their management.
css::sdbc::SQLException | |
css::uno::RuntimeException |
uno::Reference< XTablesSupplier > Connection::createCatalog | ( | ) |
Create and/or connect to the sdbcx Catalog.
This is completely unrelated to the SQL "Catalog".
Definition at line 967 of file Connection.cxx.
References m_aMutex, and m_xCatalog.
Reference< XClob > Connection::createClob | ( | ISC_QUAD const * | pBlobID | ) |
css::sdbc::SQLException | |
css::uno::RuntimeException |
Definition at line 360 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aDBHandle, m_aMutex, m_aStatements, and m_aTransactionHandle.
|
overridevirtual |
Definition at line 388 of file Connection.cxx.
References buildTypeInfo(), connectivity::firebird::checkDisposed(), m_aMutex, m_aStatements, and m_aTypeInfo.
connectivity::firebird::Connection::DECLARE_SERVICE_INFO | ( | ) |
|
private |
Definition at line 602 of file Connection.cxx.
References connectivity::firebird::evaluateStatusVector(), and u.
Referenced by runBackupService().
|
private |
Definition at line 955 of file Connection.cxx.
References m_aMutex, and m_aStatements.
Referenced by commit(), disposing(), and setupTransaction().
|
overridevirtual |
Definition at line 880 of file Connection.cxx.
References disposeStatements(), connectivity::firebird::evaluateStatusVector(), m_aDBHandle, m_aMutex, m_aTransactionHandle, m_pDatabaseFileDir, m_xMetaData, storeDatabase(), and u.
|
overridevirtual |
|
overridevirtual |
Definition at line 806 of file Connection.cxx.
References commit(), m_aMutex, m_bIsEmbedded, m_xEmbeddedStorage, and storeDatabase().
|
overridevirtual |
Definition at line 455 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, and m_bIsAutoCommit.
|
overridevirtual |
Definition at line 747 of file Connection.cxx.
References dbtools::throwFunctionNotSupportedSQLException().
|
inline |
Definition at line 168 of file drivers/firebird/Connection.hxx.
References m_sConnectionURL.
|
inline |
Definition at line 170 of file drivers/firebird/Connection.hxx.
References m_aDBHandle.
|
overridevirtual |
Definition at line 708 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, and m_xMetaData.
Referenced by buildTypeInfo().
|
overridevirtual |
Definition at line 375 of file Connection.cxx.
References comphelper::getSomethingImpl().
isc_tr_handle & Connection::getTransaction | ( | ) |
css::sdbc::SQLException |
Definition at line 520 of file Connection.cxx.
References m_aMutex, m_aTransactionHandle, and setupTransaction().
|
overridevirtual |
Definition at line 762 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, and m_aTransactionIsolation.
|
overridevirtual |
Definition at line 770 of file Connection.cxx.
References dbtools::throwFeatureNotImplementedSQLException().
|
static |
Definition at line 381 of file Connection.cxx.
References comphelper::UnoIdInit::getSeq().
|
overridevirtual |
Definition at line 794 of file Connection.cxx.
References Any.
|
overridevirtual |
|
inline |
Definition at line 169 of file drivers/firebird/Connection.hxx.
References m_bIsEmbedded.
|
overridevirtual |
Definition at line 734 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, and m_bIsReadOnly.
|
private |
Definition at line 547 of file Connection.cxx.
References comphelper::getProcessComponentContext(), connectivity::SharedResources::getResourceString(), m_xEmbeddedStorage, sMessage, and dbtools::throwGenericSQLException().
Referenced by construct().
|
overridevirtual |
Definition at line 436 of file Connection.cxx.
|
overridevirtual |
Definition at line 421 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, and SAL_INFO.
|
overridevirtual |
Definition at line 404 of file Connection.cxx.
References buildTypeInfo(), connectivity::firebird::checkDisposed(), m_aMutex, m_aStatements, m_aTypeInfo, and SAL_INFO.
|
overridevirtual |
Definition at line 687 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, m_aTransactionHandle, and m_bIsAutoCommit.
|
private |
Run the backup service, use nAction = isc_action_svc_backup to backup, nAction = isc_action_svc_restore to restore.
Definition at line 614 of file Connection.cxx.
References attachServiceManager(), detachServiceManager(), connectivity::firebird::evaluateStatusVector(), m_sFBKPath, m_sFirebirdURL, pq_sdbc_driver::OUStringToOString(), and u.
Referenced by construct(), and storeDatabase().
|
overridevirtual |
Definition at line 442 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, m_aTransactionHandle, m_bIsAutoCommit, and setupTransaction().
|
overridevirtual |
Definition at line 742 of file Connection.cxx.
References dbtools::throwFunctionNotSupportedSQLException().
|
overridevirtual |
Definition at line 725 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, m_bIsReadOnly, and setupTransaction().
|
overridevirtual |
Definition at line 753 of file Connection.cxx.
References connectivity::firebird::checkDisposed(), m_aMutex, m_aTransactionIsolation, and setupTransaction().
|
overridevirtual |
|
private |
Creates a new transaction with the desired parameters, if necessary discarding an existing transaction.
This has to be done anytime we change the transaction isolation, or autocommitting.
css::sdbc::SQLException |
Definition at line 463 of file Connection.cxx.
References disposeStatements(), connectivity::firebird::evaluateStatusVector(), m_aDBHandle, m_aMutex, m_aTransactionHandle, m_aTransactionIsolation, m_bIsAutoCommit, m_bIsReadOnly, and u.
Referenced by getTransaction(), setAutoCommit(), setReadOnly(), and setTransactionIsolation().
void Connection::storeDatabase | ( | ) |
Backup and store embedded extracted database to the .odb file.
Definition at line 910 of file Connection.cxx.
References a, comphelper::OStorageHelper::CopyInputToOutput(), cppu::getCaughtException(), comphelper::OStorageHelper::GetInputStreamFromURL(), comphelper::getProcessComponentContext(), m_aMutex, m_bIsEmbedded, m_pDatabaseFileDir, m_sFBKPath, m_sFirebirdURL, m_xEmbeddedStorage, our_sFBKLocation(), runBackupService(), and SAL_INFO.
Referenced by disposing(), and documentEventOccured().
|
private |
Definition at line 136 of file drivers/firebird/Connection.hxx.
Referenced by construct(), createClob(), disposing(), getDBHandle(), and setupTransaction().
|
private |
Definition at line 64 of file drivers/firebird/Connection.hxx.
Referenced by buildTypeInfo(), close(), commit(), createCatalog(), createClob(), createStatement(), disposeStatements(), disposing(), documentEventOccured(), getAutoCommit(), getMetaData(), getTransaction(), getTransactionIsolation(), isClosed(), isReadOnly(), prepareCall(), prepareStatement(), rollback(), setAutoCommit(), setReadOnly(), setTransactionIsolation(), setupTransaction(), and storeDatabase().
|
private |
Statements owned by this connection.
Definition at line 144 of file drivers/firebird/Connection.hxx.
Referenced by createClob(), createStatement(), disposeStatements(), and prepareStatement().
|
private |
Definition at line 137 of file drivers/firebird/Connection.hxx.
Referenced by commit(), createClob(), disposing(), getTransaction(), rollback(), setAutoCommit(), and setupTransaction().
|
private |
Definition at line 134 of file drivers/firebird/Connection.hxx.
Referenced by getTransactionIsolation(), setTransactionIsolation(), and setupTransaction().
|
private |
Definition at line 66 of file drivers/firebird/Connection.hxx.
Referenced by buildTypeInfo(), createStatement(), and prepareStatement().
|
private |
Definition at line 132 of file drivers/firebird/Connection.hxx.
Referenced by commit(), getAutoCommit(), rollback(), setAutoCommit(), and setupTransaction().
|
private |
Denotes that we have a database stored within a .odb file.
Definition at line 81 of file drivers/firebird/Connection.hxx.
Referenced by construct(), documentEventOccured(), isEmbedded(), and storeDatabase().
|
private |
We are using an external (local) file.
Definition at line 129 of file drivers/firebird/Connection.hxx.
Referenced by construct().
|
private |
Definition at line 133 of file drivers/firebird/Connection.hxx.
Referenced by isReadOnly(), setReadOnly(), and setupTransaction().
|
private |
The temporary folder where we extract the .fbk from a .odb, and also store the temporary .fdb It is only valid if m_bIsEmbedded is true.
The extracted .fbk is written in firebird.fbk, the temporary .fdb is stored as firebird.fdb.
Definition at line 107 of file drivers/firebird/Connection.hxx.
Referenced by construct(), disposing(), and storeDatabase().
|
private |
The URL passed to us when opening, i.e.
of the form sdbc:*
Definition at line 71 of file drivers/firebird/Connection.hxx.
Referenced by construct(), and getConnectionURL().
|
private |
Path for our extracted .fbk file.
(The temporary .fdb is our m_sFirebirdURL.)
Definition at line 113 of file drivers/firebird/Connection.hxx.
Referenced by construct(), runBackupService(), and storeDatabase().
|
private |
The URL passed to firebird, i.e.
either a local file (for a temporary .fdb extracted from a .odb or a normal local file) or a remote url.
Definition at line 77 of file drivers/firebird/Connection.hxx.
Referenced by construct(), runBackupService(), and storeDatabase().
|
private |
Definition at line 140 of file drivers/firebird/Connection.hxx.
Referenced by createCatalog().
|
private |
Handle for the folder within the .odb where we store our .fbk (Only used if m_bIsEmbedded is true).
Definition at line 98 of file drivers/firebird/Connection.hxx.
Referenced by construct(), documentEventOccured(), loadDatabaseFile(), and storeDatabase().
|
private |
Definition at line 142 of file drivers/firebird/Connection.hxx.
Referenced by disposing(), and getMetaData().
|
private |
Handle for the parent DatabaseDocument.
We need to notify this whenever any data is written to our temporary database so that the user is able to save this back to the .odb file.
Note that this is ONLY set in embedded mode.
Definition at line 91 of file drivers/firebird/Connection.hxx.
Referenced by construct().