diff options
Diffstat (limited to 'connectivity/source/drivers/firebird/Connection.hxx')
-rw-r--r-- | connectivity/source/drivers/firebird/Connection.hxx | 107 |
1 files changed, 69 insertions, 38 deletions
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx index 21da127a01da..0d4e484ea088 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -55,7 +55,7 @@ namespace connectivity ::com::sun::star::lang::XServiceInfo, ::com::sun::star::sdbc::XConnection, ::com::sun::star::sdbc::XWarningsSupplier - > OConnection_BASE; + > Connection_BASE; class OStatementCommonBase; class FirebirdDriver; @@ -65,57 +65,80 @@ namespace connectivity typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray; - class OConnection : public OConnection_BASE, - public connectivity::OSubComponent<OConnection, OConnection_BASE> + class Connection : public Connection_BASE, + public connectivity::OSubComponent<Connection, Connection_BASE> { - friend class connectivity::OSubComponent<OConnection, OConnection_BASE>; + friend class connectivity::OSubComponent<Connection, Connection_BASE>; + /** + * Location within the .odb that an embedded .fdb will be stored. + * Only relevant for embedded dbs. + */ + static const OUString our_sDBLocation; protected: ::osl::Mutex m_aMutex; public: ::osl::Mutex& getMutex() { return m_aMutex; } protected: - ::boost::scoped_ptr< ::utl::TempFile > m_pExtractedFDBFile; - static const OUString sDBLocation; // Location within .odb container - //==================================================================== - // Data attributes - //==================================================================== + + + TTypeInfoVector m_aTypeInfo; // vector containing an entry // for each row returned by // DatabaseMetaData.getTypeInfo. - ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + /** The parent driver that created this connection. */ + FirebirdDriver* m_pDriver; - OWeakRefArray m_aStatements; // vector containing a list - // of all the Statement objects - // for this Connection + /** The URL passed to us when opening, i.e. of the form sdbc:* */ + ::rtl::OUString m_sConnectionURL; + /** + * 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. + */ + ::rtl::OUString m_sFirebirdURL; - ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by - // an operation - sal_Bool m_bIsEmbedded; - ::rtl::OUString m_sConnectionURL; - ::rtl::OUString m_sURL; // URL of connection - // or file path - ::rtl::OUString m_sUser; // the user name - FirebirdDriver* m_pDriver; // Pointer to the owning - // driver object + /* EMBEDDED MODE DATA */ + /** Denotes that we have a .fdb stored within a .odb file. */ + sal_Bool m_bIsEmbedded; + /** + * Handle for the folder within the .odb where we store our .fdb + * (Only used if m_bIsEmbedded is true). + */ + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + m_xEmbeddedStorage; + /** + * The temporary folder where we extract the .fdb from a .odb. + * It is only valid if m_bIsEmbedded is true. + */ + ::boost::scoped_ptr< ::utl::TempFile > m_pExtractedFDBFile; - sal_Bool m_bClosed; - sal_Bool m_bUseOldDateFormat; - sal_Bool m_bAutoCommit; - sal_Bool m_bReadOnly; - sal_Int32 m_aTransactionIsolation; + /* REMOTE CONNECTION DATA */ + ::rtl::OUString m_sUser; - isc_db_handle m_DBHandler; - isc_tr_handle m_transactionHandle; + /* CONNECTION PROPERTIES */ + sal_Bool m_bIsAutoCommit; + sal_Bool m_bIsReadOnly; + sal_Int32 m_aTransactionIsolation; + + isc_db_handle m_aDBHandle; + isc_tr_handle m_aTransactionHandle; - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > - m_xEmbeddedStorage; ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > + m_xMetaData; + /** Statements owned by this connection. */ + OWeakRefArray m_aStatements; + /** + * If we are embedded in a .odb we need to listen to Document events + * in order to save the .fdb back into the .odb. + */ + void attachAsDocumentListener(const ::rtl::OUString& rStorageURL); /** * Firebird stores binary collations for indexes on Character based @@ -123,19 +146,27 @@ namespace connectivity * version, hence we need to rebuild the indexes when switching icu * versions. */ - void rebuildIndexes() throw( ::com::sun::star::sdbc::SQLException); - void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + void rebuildIndexes() + throw(::com::sun::star::sdbc::SQLException); + void buildTypeInfo() + throw(::com::sun::star::sdbc::SQLException); - void setupTransaction() throw(::com::sun::star::sdbc::SQLException); - void clearStatements(); + /** + * 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 autocommiting. + */ + void setupTransaction() + throw(::com::sun::star::sdbc::SQLException); + void disposeStatements(); public: virtual void construct( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - OConnection(FirebirdDriver* _pDriver); - virtual ~OConnection(); + Connection(FirebirdDriver* _pDriver); + virtual ~Connection(); void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); @@ -176,7 +207,7 @@ namespace connectivity virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); inline ::rtl::OUString getUserName() const { return m_sUser; } - inline isc_db_handle& getDBHandle() { return m_DBHandler; } + inline isc_db_handle& getDBHandle() { return m_aDBHandle; } inline FirebirdDriver* getDriver() const { return m_pDriver;} ::rtl::OUString getConnectionURL() const { return m_sConnectionURL; } |