LibreOffice Module connectivity (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
connectivity::firebird::Connection Class Referencefinal

#include <Connection.hxx>

Inheritance diagram for connectivity::firebird::Connection:
[legend]
Collaboration diagram for connectivity::firebird::Connection:
[legend]

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::TempFileNamedm_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...
 

Detailed Description

Definition at line 62 of file drivers/firebird/Connection.hxx.

Constructor & Destructor Documentation

◆ Connection()

Connection::Connection ( )
explicit

Definition at line 81 of file Connection.cxx.

References if(), and m_aMutex.

◆ ~Connection()

Connection::~Connection ( )
overridevirtual

Definition at line 100 of file Connection.cxx.

References close(), and isClosed().

Member Function Documentation

◆ attachServiceManager()

isc_svc_handle Connection::attachServiceManager ( )
private

◆ buildTypeInfo()

void Connection::buildTypeInfo ( )
private

◆ clearWarnings()

void SAL_CALL Connection::clearWarnings ( )
overridevirtual

Definition at line 800 of file Connection.cxx.

◆ close()

void SAL_CALL Connection::close ( )
overridevirtual

Definition at line 782 of file Connection.cxx.

References connectivity::firebird::checkDisposed(), dispose(), and m_aMutex.

Referenced by ~Connection().

◆ commit()

void SAL_CALL Connection::commit ( )
overridevirtual

◆ construct()

void Connection::construct ( const OUString &  url,
const css::uno::Sequence< css::beans::PropertyValue > &  info 
)

◆ createBlob()

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.

Exceptions
css::sdbc::SQLException
css::uno::RuntimeException

◆ createCatalog()

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.

◆ createClob()

Reference< XClob > Connection::createClob ( ISC_QUAD const *  pBlobID)
Exceptions
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.

◆ createStatement()

Reference< XStatement > SAL_CALL Connection::createStatement ( )
overridevirtual

◆ DECLARE_SERVICE_INFO()

connectivity::firebird::Connection::DECLARE_SERVICE_INFO ( )

◆ detachServiceManager()

void Connection::detachServiceManager ( isc_svc_handle  pServiceHandle)
private

Definition at line 602 of file Connection.cxx.

References connectivity::firebird::evaluateStatusVector(), and u.

Referenced by runBackupService().

◆ disposeStatements()

void Connection::disposeStatements ( )
private

Definition at line 955 of file Connection.cxx.

References m_aMutex, and m_aStatements.

Referenced by commit(), disposing(), and setupTransaction().

◆ disposing() [1/2]

void Connection::disposing ( )
overridevirtual

◆ disposing() [2/2]

virtual void SAL_CALL connectivity::firebird::Connection::disposing ( const css::lang::EventObject &  Source)
overridevirtual

◆ documentEventOccured()

void SAL_CALL Connection::documentEventOccured ( const css::document::DocumentEvent &  Event)
overridevirtual

Definition at line 806 of file Connection.cxx.

References commit(), m_aMutex, m_bIsEmbedded, m_xEmbeddedStorage, and storeDatabase().

◆ getAutoCommit()

sal_Bool SAL_CALL Connection::getAutoCommit ( )
overridevirtual

◆ getCatalog()

OUString SAL_CALL Connection::getCatalog ( )
overridevirtual

Definition at line 747 of file Connection.cxx.

References dbtools::throwFunctionNotSupportedSQLException().

◆ getConnectionURL()

const OUString & connectivity::firebird::Connection::getConnectionURL ( ) const
inline

Definition at line 168 of file drivers/firebird/Connection.hxx.

References m_sConnectionURL.

◆ getDBHandle()

isc_db_handle & connectivity::firebird::Connection::getDBHandle ( )
inline

Definition at line 170 of file drivers/firebird/Connection.hxx.

References m_aDBHandle.

◆ getMetaData()

Reference< XDatabaseMetaData > SAL_CALL Connection::getMetaData ( )
overridevirtual

Definition at line 708 of file Connection.cxx.

References connectivity::firebird::checkDisposed(), m_aMutex, and m_xMetaData.

Referenced by buildTypeInfo().

◆ getSomething()

sal_Int64 SAL_CALL Connection::getSomething ( const css::uno::Sequence< sal_Int8 > &  rId)
overridevirtual

Definition at line 375 of file Connection.cxx.

References comphelper::getSomethingImpl().

◆ getTransaction()

isc_tr_handle & Connection::getTransaction ( )
Exceptions
css::sdbc::SQLException

Definition at line 520 of file Connection.cxx.

References m_aMutex, m_aTransactionHandle, and setupTransaction().

◆ getTransactionIsolation()

sal_Int32 SAL_CALL Connection::getTransactionIsolation ( )
overridevirtual

◆ getTypeMap()

Reference< XNameAccess > SAL_CALL Connection::getTypeMap ( )
overridevirtual

Definition at line 770 of file Connection.cxx.

References dbtools::throwFeatureNotImplementedSQLException().

◆ getUnoTunnelId()

const css::uno::Sequence< sal_Int8 > & Connection::getUnoTunnelId ( )
static

Definition at line 381 of file Connection.cxx.

References comphelper::UnoIdInit::getSeq().

◆ getWarnings()

Any SAL_CALL Connection::getWarnings ( )
overridevirtual

Definition at line 794 of file Connection.cxx.

References Any.

◆ isClosed()

sal_Bool SAL_CALL Connection::isClosed ( )
overridevirtual

Definition at line 700 of file Connection.cxx.

References m_aMutex.

Referenced by ~Connection().

◆ isEmbedded()

bool connectivity::firebird::Connection::isEmbedded ( ) const
inline

Definition at line 169 of file drivers/firebird/Connection.hxx.

References m_bIsEmbedded.

◆ isReadOnly()

sal_Bool SAL_CALL Connection::isReadOnly ( )
overridevirtual

Definition at line 734 of file Connection.cxx.

References connectivity::firebird::checkDisposed(), m_aMutex, and m_bIsReadOnly.

◆ loadDatabaseFile()

void Connection::loadDatabaseFile ( const OUString &  pSrcLocation,
const OUString &  pTmpLocation 
)
private

◆ nativeSQL()

OUString SAL_CALL Connection::nativeSQL ( const OUString &  sql)
overridevirtual

Definition at line 436 of file Connection.cxx.

◆ prepareCall()

Reference< XPreparedStatement > SAL_CALL Connection::prepareCall ( const OUString &  sql)
overridevirtual

Definition at line 421 of file Connection.cxx.

References connectivity::firebird::checkDisposed(), m_aMutex, and SAL_INFO.

◆ prepareStatement()

Reference< XPreparedStatement > SAL_CALL Connection::prepareStatement ( const OUString &  sql)
overridevirtual

◆ rollback()

void SAL_CALL Connection::rollback ( )
overridevirtual

◆ runBackupService()

void Connection::runBackupService ( const short  nAction)
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().

◆ setAutoCommit()

void SAL_CALL Connection::setAutoCommit ( sal_Bool  autoCommit)
overridevirtual

◆ setCatalog()

void SAL_CALL Connection::setCatalog ( const OUString &  catalog)
overridevirtual

Definition at line 742 of file Connection.cxx.

References dbtools::throwFunctionNotSupportedSQLException().

◆ setReadOnly()

void SAL_CALL Connection::setReadOnly ( sal_Bool  readOnly)
overridevirtual

◆ setTransactionIsolation()

void SAL_CALL Connection::setTransactionIsolation ( sal_Int32  level)
overridevirtual

◆ setTypeMap()

virtual void SAL_CALL connectivity::firebird::Connection::setTypeMap ( const css::uno::Reference< css::container::XNameAccess > &  typeMap)
overridevirtual

◆ setupTransaction()

void Connection::setupTransaction ( )
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.

Exceptions
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().

◆ storeDatabase()

void Connection::storeDatabase ( )

Member Data Documentation

◆ m_aDBHandle

isc_db_handle connectivity::firebird::Connection::m_aDBHandle
private

◆ m_aMutex

::osl::Mutex connectivity::firebird::Connection::m_aMutex
private

◆ m_aStatements

OWeakRefArray connectivity::firebird::Connection::m_aStatements
private

Statements owned by this connection.

Definition at line 144 of file drivers/firebird/Connection.hxx.

Referenced by createClob(), createStatement(), disposeStatements(), and prepareStatement().

◆ m_aTransactionHandle

isc_tr_handle connectivity::firebird::Connection::m_aTransactionHandle
private

◆ m_aTransactionIsolation

sal_Int32 connectivity::firebird::Connection::m_aTransactionIsolation
private

◆ m_aTypeInfo

TTypeInfoVector connectivity::firebird::Connection::m_aTypeInfo
private

◆ m_bIsAutoCommit

bool connectivity::firebird::Connection::m_bIsAutoCommit
private

◆ m_bIsEmbedded

bool connectivity::firebird::Connection::m_bIsEmbedded
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().

◆ m_bIsFile

bool connectivity::firebird::Connection::m_bIsFile
private

We are using an external (local) file.

Definition at line 129 of file drivers/firebird/Connection.hxx.

Referenced by construct().

◆ m_bIsReadOnly

bool connectivity::firebird::Connection::m_bIsReadOnly
private

Definition at line 133 of file drivers/firebird/Connection.hxx.

Referenced by isReadOnly(), setReadOnly(), and setupTransaction().

◆ m_pDatabaseFileDir

std::unique_ptr< ::utl::TempFileNamed > connectivity::firebird::Connection::m_pDatabaseFileDir
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().

◆ m_sConnectionURL

OUString connectivity::firebird::Connection::m_sConnectionURL
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().

◆ m_sFBKPath

OUString connectivity::firebird::Connection::m_sFBKPath
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().

◆ m_sFirebirdURL

OUString connectivity::firebird::Connection::m_sFirebirdURL
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().

◆ m_xCatalog

css::uno::WeakReference< css::sdbcx::XTablesSupplier> connectivity::firebird::Connection::m_xCatalog
private

Definition at line 140 of file drivers/firebird/Connection.hxx.

Referenced by createCatalog().

◆ m_xEmbeddedStorage

css::uno::Reference< css::embed::XStorage > connectivity::firebird::Connection::m_xEmbeddedStorage
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().

◆ m_xMetaData

css::uno::WeakReference< css::sdbc::XDatabaseMetaData > connectivity::firebird::Connection::m_xMetaData
private

Definition at line 142 of file drivers/firebird/Connection.hxx.

Referenced by disposing(), and getMetaData().

◆ m_xParentDocument

css::uno::Reference< css::util::XModifiable > connectivity::firebird::Connection::m_xParentDocument
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().


The documentation for this class was generated from the following files: