diff options
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/core/api/TableDeco.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/api/query.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/api/querycontainer.cxx | 15 | ||||
-rw-r--r-- | dbaccess/source/core/api/table.cxx | 15 | ||||
-rw-r--r-- | dbaccess/source/core/api/tablecontainer.cxx | 38 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/connection.cxx | 54 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/connection.hxx | 23 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 40 | ||||
-rw-r--r-- | dbaccess/source/core/inc/TableDeco.hxx | 16 | ||||
-rw-r--r-- | dbaccess/source/core/inc/querycontainer.hxx | 7 | ||||
-rw-r--r-- | dbaccess/source/core/inc/tablecontainer.hxx | 7 |
11 files changed, 179 insertions, 48 deletions
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index b1691dc84728..2349fbf76206 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableDeco.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: fs $ $Date: 2001-06-22 15:32:41 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -542,6 +542,8 @@ sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& Reference<XUnoTunnel> xTunnel(m_xTable,UNO_QUERY); if(xTunnel.is()) nRet = xTunnel->getSomething(rId); + if(!nRet) + nRet = OConfigurationFlushable::getSomething(rId); return nRet; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index b5a7544946e4..37de3d67c18d 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -2,9 +2,9 @@ * * $RCSfile: query.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: oj $ $Date: 2001-07-16 07:38:40 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,7 +65,9 @@ #ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" #endif +#ifndef _DBA_CORE_REGISTRYHELPER_HXX_ #include "registryhelper.hxx" +#endif #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_ #include <cppuhelper/queryinterface.hxx> diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx index fedf90d5bbea..ca9568cd822c 100644 --- a/dbaccess/source/core/api/querycontainer.cxx +++ b/dbaccess/source/core/api/querycontainer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: querycontainer.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-07-16 07:38:40 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -686,6 +686,17 @@ sal_Int32 OQueryContainer::implGetIndex(const ::rtl::OUString& _rName) return -1; } +// ----------------------------------------------------------------------------- +void OQueryContainer::setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode) +{ + m_aConfigurationNode = _aConfigTreeNode; + Queries::iterator aIter = m_aQueries.begin(); + for(;aIter != m_aQueries.end();++aIter) + { + if(aIter->second) + aIter->second->setConfigurationNode(implGetObjectKey(aIter->first,sal_True).cloneAsRoot()); + } +} //........................................................................ } // namespace dbaccess diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 7469f647ab63..ac6305f5511f 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -2,9 +2,9 @@ * * $RCSfile: table.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: oj $ $Date: 2001-07-05 11:58:53 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -690,9 +690,16 @@ void ODBTable::refreshIndexes() // ----------------------------------------------------------------------------- sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { + sal_Int64 nRet(0); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - return (sal_Int64)this; - return OTable_Base::getSomething(rId); + nRet = (sal_Int64)this; + else + { + nRet = OTable_Base::getSomething(rId); + if(!nRet) + nRet = OConfigurationFlushable::getSomething(rId); + } + return nRet; } // ----------------------------------------------------------------------------- Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 4a83ab319909..2eec7ae5fe31 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tablecontainer.cxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: oj $ $Date: 2001-07-04 10:55:14 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -881,4 +881,38 @@ void SAL_CALL OTableContainer::disposing( const ::com::sun::star::lang::EventObj { } // ----------------------------------------------------------------------------- +void OTableContainer::setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode) +{ + m_aCommitLocation = _aConfigTreeNode; + m_aTablesConfig = _aConfigTreeNode.openNode(CONFIGKEY_DBLINK_TABLES); + m_aTablesConfig.setEscape(m_aTablesConfig.isSetNode()); + // now set the new config node at our children + ::std::vector< ObjectIter >::iterator aIter = m_aElements.begin(); + for(;aIter != m_aElements.end();++aIter) + { + if((*aIter)->second.is()) + { + Reference< XUnoTunnel > xTunnel((*aIter)->second, UNO_QUERY); + OConfigurationFlushable* pObjectImpl = NULL; + if (xTunnel.is()) + { + static Sequence<sal_Int8> aTunnelId = OConfigurationFlushable::getUnoTunnelImplementationId(); + pObjectImpl = reinterpret_cast<OConfigurationFlushable*> (xTunnel->getSomething(aTunnelId)); + } + if(pObjectImpl) + { + OConfigurationNode aTableConfig; + if(m_aTablesConfig.hasByName((*aIter)->first)) + aTableConfig = m_aTablesConfig.openNode((*aIter)->first); + else + { + aTableConfig = m_aTablesConfig.createNode((*aIter)->first); + m_aCommitLocation.commit(); + } + pObjectImpl->setConfigurationNode(aTableConfig.cloneAsRoot()); + } + } + } +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 7016fe1ec0fb..53651d0e44ea 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: connection.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: fs $ $Date: 2001-06-18 11:49:05 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -543,17 +543,7 @@ Sequence< Type > OConnection::getTypes() throw (RuntimeException) //-------------------------------------------------------------------------- Sequence< sal_Int8 > OConnection::getImplementationId() throw (RuntimeException) { - static OImplementationId * pId = 0; - if (! pId) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (! pId) - { - static OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + return getUnoTunnelImplementationId(); } // com::sun::star::uno::XInterface @@ -733,7 +723,45 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCommand( const ::r // TODO EscapeProcessing return prepareStatement(aStatement); } +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} +// ----------------------------------------------------------------------------- +// com::sun::star::XUnoTunnel +sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + return 0; +} +// ----------------------------------------------------------------------------- +void OConnection::flushMembers() +{ + if(m_pTables) + m_pTables->flush(); + m_aQueries.flush(); +} +// ----------------------------------------------------------------------------- +void OConnection::setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode) +{ + if(m_pTables) + m_pTables->setNewConfigNode(_aConfigTreeNode); + + m_aQueries.setNewConfigNode(_aConfigTreeNode.openNode(CONFIGKEY_DBLINK_QUERYDOCUMENTS).cloneAsRoot()); +} //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx index f9e6e196da5d..b6f5ba6ef0e7 100644 --- a/dbaccess/source/core/dataaccess/connection.hxx +++ b/dbaccess/source/core/dataaccess/connection.hxx @@ -2,9 +2,9 @@ * * $RCSfile: connection.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: fs $ $Date: 2001-06-18 11:49:05 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,11 +91,14 @@ #ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueriesSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif #ifndef _CPPUHELPER_IMPLBASE3_HXX_ #include <cppuhelper/implbase3.hxx> #endif -#ifndef _CPPUHELPER_IMPLBASE6_HXX_ -#include <cppuhelper/implbase6.hxx> +#ifndef _CPPUHELPER_IMPLBASE7_HXX_ +#include <cppuhelper/implbase7.hxx> #endif #ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" @@ -184,12 +187,13 @@ inline void OConnectionRerouter::checkDisposed() throw (::com::sun::star::lang:: throw ::com::sun::star::lang::DisposedException(); } //========================================================================== -typedef ::cppu::ImplHelper6< ::com::sun::star::container::XChild +typedef ::cppu::ImplHelper7< ::com::sun::star::container::XChild ,::com::sun::star::sdbcx::XTablesSupplier ,::com::sun::star::sdbcx::XViewsSupplier ,::com::sun::star::sdb::XQueriesSupplier ,::com::sun::star::sdb::XSQLQueryComposerFactory ,::com::sun::star::sdb::XCommandPreparation + ,::com::sun::star::lang::XUnoTunnel > OConnection_Base; class ODatabaseSource; @@ -257,7 +261,14 @@ public: // ::com::sun::star::sdbc::XWarningsSupplier virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + // flush the tables and queries + void flushMembers(); + // set the confignode this happens when the datasource was reinserted + void setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode); protected: // IWarningsContainer virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning); diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 13f87bb97a26..cacb5e2c280e 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -2,9 +2,9 @@ * * $RCSfile: datasource.cxx,v $ * - * $Revision: 1.33 $ + * $Revision: 1.34 $ * - * last change: $Author: fs $ $Date: 2001-06-18 11:49:37 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -886,8 +886,37 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) throw( { return static_cast< XNameContainer* >(&m_aCommandDefinitions); } +// ----------------------------------------------------------------------------- +class OConnectionNotifier //: public ::std::unary_function<OWeakConnection,void> +{ + ::utl::OConfigurationTreeRoot m_aConfigTreeNode; +public: + OConnectionNotifier() + { + } + OConnectionNotifier(const ::utl::OConfigurationTreeRoot& _rConfigTreeNode) : m_aConfigTreeNode(_rConfigTreeNode) + { + } -//------------------------------------------------------------------------------ + void operator()(OWeakConnection& _xConnection) + { + Reference< XUnoTunnel > xTunnel(Reference<XConnection>(_xConnection), UNO_QUERY); + OConnection* pObjectImpl = NULL; + if (xTunnel.is()) + { + static Sequence<sal_Int8> aTunnelId = OConnection::getUnoTunnelImplementationId(); + pObjectImpl = reinterpret_cast<OConnection*> (xTunnel->getSomething(aTunnelId)); + } + if(pObjectImpl) + { + if (m_aConfigTreeNode.isValid()) + pObjectImpl->setNewConfigNode(m_aConfigTreeNode); + else + pObjectImpl->flushMembers(); + } + } +}; +// ----------------------------------------------------------------------------- void ODatabaseSource::inserted(const Reference< XInterface >& _rxContainer, const ::rtl::OUString& _rRegistrationName, const OConfigurationTreeRoot& _rConfigRoot) { MutexGuard aGuard(m_aMutex); @@ -907,6 +936,9 @@ void ODatabaseSource::inserted(const Reference< XInterface >& _rxContainer, cons // (Usually, we do this from within the ctor which gets a config node, but if we're here, we have been // instantiated as service, so we didn't have any config location before, so the documents haven't any, too.) initializeDocuments(sal_False); + // we now have to set the new confignode at our connections + ::std::for_each(m_aConnections.begin(),m_aConnections.end(),OConnectionNotifier(m_aConfigurationNode)); + // and now flush flushToConfiguration(); } @@ -988,6 +1020,8 @@ void ODatabaseSource::flushDocuments() // ----------------------------------------------------------------------------- void ODatabaseSource::flushTables() { + // flush all tables and queries + ::std::for_each(m_aConnections.begin(),m_aConnections.end(),OConnectionNotifier()); } //------------------------------------------------------------------------------ void ODatabaseSource::flushToConfiguration() diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx index 0bb2c85ae975..5418423e2483 100644 --- a/dbaccess/source/core/inc/TableDeco.hxx +++ b/dbaccess/source/core/inc/TableDeco.hxx @@ -2,9 +2,9 @@ * * $RCSfile: TableDeco.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2001-06-18 11:37:38 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,11 +89,8 @@ #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> #endif -#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ -#include <com/sun/star/lang/XUnoTunnel.hpp> -#endif -#ifndef _CPPUHELPER_COMPBASE9_HXX_ -#include <cppuhelper/compbase9.hxx> +#ifndef _CPPUHELPER_COMPBASE8_HXX_ +#include <cppuhelper/compbase8.hxx> #endif #ifndef _CPPUHELPER_IMPLBASE5_HXX_ #include <cppuhelper/implbase5.hxx> @@ -122,15 +119,14 @@ namespace dbaccess { - typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::sdbcx::XColumnsSupplier, + typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::sdbcx::XColumnsSupplier, ::com::sun::star::sdbcx::XKeysSupplier, ::com::sun::star::container::XNamed, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::sdbcx::XDataDescriptorFactory, ::com::sun::star::sdbcx::XIndexesSupplier, ::com::sun::star::sdbcx::XRename, - ::com::sun::star::sdbcx::XAlterTable, - ::com::sun::star::lang::XUnoTunnel> OTableDescriptor_BASE; + ::com::sun::star::sdbcx::XAlterTable> OTableDescriptor_BASE; //========================================================================== //= OTables //========================================================================== diff --git a/dbaccess/source/core/inc/querycontainer.hxx b/dbaccess/source/core/inc/querycontainer.hxx index 2211391365a5..60e7d8124562 100644 --- a/dbaccess/source/core/inc/querycontainer.hxx +++ b/dbaccess/source/core/inc/querycontainer.hxx @@ -2,9 +2,9 @@ * * $RCSfile: querycontainer.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: fs $ $Date: 2001-06-18 11:37:38 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -257,6 +257,9 @@ namespace dbaccess virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // sets the new confignode at his children + void setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode); + protected: // OConfigurationFlushable virtual void flush_NoBroadcast_NoCommit(); diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx index 4f093d0988e9..779a5643c526 100644 --- a/dbaccess/source/core/inc/tablecontainer.hxx +++ b/dbaccess/source/core/inc/tablecontainer.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tablecontainer.hxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: fs $ $Date: 2001-06-18 11:37:38 $ + * last change: $Author: oj $ $Date: 2001-07-18 08:45:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -227,6 +227,9 @@ namespace dbaccess virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // sets the new confignodes + void setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode); }; } #endif // _DBA_CORE_TABLECONTAINER_HXX_ |