diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-10-12 11:02:56 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-10-12 11:02:56 +0000 |
commit | 0ed8d1bf8a7850378eb9dbfbc433a30ca2967096 (patch) | |
tree | 66c7b65626b9f8e35a6e47b2f9962da45cb4ea65 /connectivity/source | |
parent | 8348f7a798205e5ad0e5078619ff519d3cf02621 (diff) |
#92883# fix the descriptor handling
Diffstat (limited to 'connectivity/source')
70 files changed, 767 insertions, 1475 deletions
diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx index d50b7dd748ce..931f969d3711 100644 --- a/connectivity/source/drivers/adabas/BColumns.cxx +++ b/connectivity/source/drivers/adabas/BColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BColumns.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,6 +95,9 @@ #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include "connectivity/dbtools.hxx" #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif using namespace ::comphelper; @@ -156,9 +159,19 @@ Reference< XPropertySet > OColumns::createEmptyObject() { return new OColumn(sal_True); } +// ----------------------------------------------------------------------------- +Reference< XNamed > OColumns::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + OColumn* pColumn = new OColumn(sal_True); + Reference<XPropertySet> xProp = pColumn; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference< XNamed > xName(xProp,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName; +} // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OColumns::appendObject( const Reference< XPropertySet >& descriptor ) { ::osl::MutexGuard aGuard(m_rMutex); OSL_ENSURE(m_pTable,"OColumns::appendByDescriptor: Table is null!"); @@ -195,13 +208,11 @@ void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& des } m_pTable->endTransAction(); } - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); OSL_ENSURE(m_pTable,"OColumns::dropByName: Table is null!"); if(!m_pTable->isNew()) { @@ -211,38 +222,12 @@ void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(S aSql += ::dbtools::quoteName(sQuote,m_pTable->getSchema()) + sDot + ::dbtools::quoteName(sQuote,m_pTable->getTableName()); aSql += ::rtl::OUString::createFromAscii(" DROP "); - aSql += ::dbtools::quoteName(sQuote,elementName); - - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } - - OCollection_TYPE::dropByName(elementName); -} -// ------------------------------------------------------------------------- -void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - OSL_ENSURE(m_pTable,"OColumns::dropByIndex: Table is null!"); - if(!m_pTable->isNew()) - { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); - ::rtl::OUString sQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - aSql += ::dbtools::quoteName(sQuote,m_pTable->getSchema()) + sDot + ::dbtools::quoteName(sQuote,m_pTable->getTableName()); - aSql += ::rtl::OUString::createFromAscii(" DROP "); - aSql += ::dbtools::quoteName(sQuote,getElementName(index)); + aSql += ::dbtools::quoteName(sQuote,_sElementName); Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } - OCollection_TYPE::dropByIndex(index); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx index dc2c3f212d6a..6c08a78949ae 100644 --- a/connectivity/source/drivers/adabas/BConnection.cxx +++ b/connectivity/source/drivers/adabas/BConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BConnection.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-10-08 07:20:00 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -204,6 +204,7 @@ SQLRETURN OAdabasConnection::OpenConnection(const ::rtl::OUString& aConnectStr,s if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) return nSQLRETURN; + m_bClosed = sal_False; #ifndef MAC // autocoomit ist immer default diff --git a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx index f372fe0d3f41..1a7709d25680 100644 --- a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx +++ b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BDatabaseMetaData.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-08-29 12:21:07 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,7 @@ using namespace ::com::sun::star::lang; ::rtl::OUString SAL_CALL OAdabasDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { + ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:adabas:"); aValue += OAdabasDatabaseMetaData_BASE::getURLImpl(); return aValue; @@ -88,7 +89,6 @@ sal_Bool SAL_CALL OAdabasDatabaseMetaData::supportsIntegrityEnhancementFacility( // ----------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL OAdabasDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) { - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(); Reference< XResultSet > xNewRes = pResult; pResult->setTypeInfoMap(); diff --git a/connectivity/source/drivers/adabas/BGroups.cxx b/connectivity/source/drivers/adabas/BGroups.cxx index c4541effadb5..69c4e81545b0 100644 --- a/connectivity/source/drivers/adabas/BGroups.cxx +++ b/connectivity/source/drivers/adabas/BGroups.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BGroups.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -94,10 +94,7 @@ typedef connectivity::sdbcx::OCollection OCollection_TYPE; // ------------------------------------------------------------------------- Reference< XNamed > OGroups::createObject(const ::rtl::OUString& _rName) { - Reference< XNamed > xRet = NULL; - OAdabasGroup* pRet = new OAdabasGroup(m_pConnection,_rName); - xRet = pRet; - return xRet; + return new OAdabasGroup(m_pConnection,_rName); } // ------------------------------------------------------------------------- void OGroups::impl_refresh() throw(RuntimeException) @@ -107,20 +104,20 @@ void OGroups::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OGroups::createEmptyObject() { - OAdabasGroup* pNew = new OAdabasGroup(m_pConnection); - return pNew; + // OAdabasGroup* pNew = + return new OAdabasGroup(m_pConnection); +} +// ----------------------------------------------------------------------------- +Reference< XNamed > OGroups::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OGroups::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USERGROUP "); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); @@ -129,37 +126,20 @@ void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& desc Reference< XStatement > xStmt = m_pConnection->createStatement( ); xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OGroups::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OGroups::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USERGROUP "); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - aSql = aSql + aQuote + elementName + aQuote; + aSql = aSql + aQuote + _sElementName + aQuote; Reference< XStatement > xStmt = m_pConnection->createStatement( ); xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); - - OCollection_TYPE::dropByName(elementName); } // ------------------------------------------------------------------------- -void SAL_CALL OGroups::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); -} diff --git a/connectivity/source/drivers/adabas/BIndex.cxx b/connectivity/source/drivers/adabas/BIndex.cxx index 02431ed4727d..041dc653ab66 100644 --- a/connectivity/source/drivers/adabas/BIndex.cxx +++ b/connectivity/source/drivers/adabas/BIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BIndex.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -143,4 +143,6 @@ void OAdabasIndex::refreshColumns() else m_pColumns = new OIndexColumns(this,m_aMutex,aVector); } +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/adabas/BIndexColumns.cxx b/connectivity/source/drivers/adabas/BIndexColumns.cxx index eb88e32841b8..e84c8b4e59fc 100644 --- a/connectivity/source/drivers/adabas/BIndexColumns.cxx +++ b/connectivity/source/drivers/adabas/BIndexColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BIndexColumns.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,9 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif using namespace connectivity::adabas; using namespace connectivity::sdbcx; @@ -152,8 +155,29 @@ Reference< XNamed > OIndexColumns::createObject(const ::rtl::OUString& _rName) // ------------------------------------------------------------------------- Reference< XPropertySet > OIndexColumns::createEmptyObject() { - OIndexColumn* pNew = new OIndexColumn(sal_True); - return pNew; + return new OIndexColumn(sal_True); } // ------------------------------------------------------------------------- +Reference< XNamed > OIndexColumns::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + OIndexColumn* pColumn = new OIndexColumn(sal_True); + Reference<XPropertySet> xProp = pColumn; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference< XNamed > xName(xProp,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName; +} +// ----------------------------------------------------------------------------- +void OIndexColumns::impl_refresh() throw(::com::sun::star::uno::RuntimeException) +{ + m_pIndex->refreshColumns(); +} +// ----------------------------------------------------------------------------- +void OIndexColumns::appendObject( const Reference< XPropertySet >& descriptor ) +{ + // nothing to do here +} +// ----------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/adabas/BIndexes.cxx b/connectivity/source/drivers/adabas/BIndexes.cxx index f51bd0672349..ad158dbad041 100644 --- a/connectivity/source/drivers/adabas/BIndexes.cxx +++ b/connectivity/source/drivers/adabas/BIndexes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BIndexes.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,6 +88,9 @@ #ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ #include "adabas/BCatalog.hxx" #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif using namespace ::comphelper; @@ -148,16 +151,25 @@ Reference< XPropertySet > OIndexes::createEmptyObject() return new OAdabasIndex(m_pTable); } // ------------------------------------------------------------------------- +Reference< XNamed > OIndexes::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + Reference< XNamed > xName; + if(!m_pTable->isNew()) + { + xName = Reference< XNamed >(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + xName = xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); + } + else + { + } + return xName; +} +// ------------------------------------------------------------------------- // XAppend -void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OIndexes::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - if(!m_pTable->isNew()) { ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE "); @@ -213,23 +225,20 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } - OCollection_TYPE::appendByDescriptor(descriptor); + else + ::dbtools::throwFunctionSequenceException(*this); + } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OIndexes::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - if(!m_pTable->isNew()) { ::rtl::OUString aName,aSchema; - sal_Int32 nLen = elementName.indexOf('.'); - aSchema = elementName.copy(0,nLen); - aName = elementName.copy(nLen+1); + sal_Int32 nLen = _sElementName.indexOf('.'); + aSchema = _sElementName.copy(0,nLen); + aName = _sElementName.copy(nLen+1); ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); @@ -247,16 +256,6 @@ void SAL_CALL OIndexes::dropByName( const ::rtl::OUString& elementName ) throw(S xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } - OCollection_TYPE::dropByName(elementName); -} -// ------------------------------------------------------------------------- -void SAL_CALL OIndexes::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BKeys.cxx b/connectivity/source/drivers/adabas/BKeys.cxx index 25a2bff99490..c38c07303896 100644 --- a/connectivity/source/drivers/adabas/BKeys.cxx +++ b/connectivity/source/drivers/adabas/BKeys.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BKeys.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,9 @@ #ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ #include "adabas/BCatalog.hxx" #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif using namespace ::comphelper; @@ -179,21 +182,12 @@ void OKeys::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OKeys::createEmptyObject() { - OAdabasKey* pNew = new OAdabasKey(m_pTable); - return pNew; + return new OAdabasKey(m_pTable); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OKeys::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - { - if(aName.getLength() || getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == KeyType::PRIMARY) // check if this isn't a primary key - throw ElementExistException(aName,*this); - } if(!m_pTable->isNew()) { sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); @@ -290,23 +284,20 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri } } } - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OKeys::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OKeys::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - if(!m_pTable->isNew()) { ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); + ObjectIter aIter = m_aElements[_nPos]; + if(!aIter->second.is()) // we want to drop a object which isn't loaded yet so we must load it + aIter->second = createObject(_sElementName); Reference<XPropertySet> xKey(aIter->second,UNO_QUERY); sal_Int32 nKeyType = getINT32(xKey->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); @@ -316,22 +307,42 @@ void SAL_CALL OKeys::dropByName( const ::rtl::OUString& elementName ) throw(SQLE else { aSql += ::rtl::OUString::createFromAscii(" DROP FOREIGN KEY "); - aSql += aQuote + elementName + aQuote; + aSql += aQuote + _sElementName + aQuote; } Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } - OCollection_TYPE::dropByName(elementName); } -// ------------------------------------------------------------------------- -void SAL_CALL OKeys::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +// ----------------------------------------------------------------------------- +Reference< XNamed > OKeys::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); + Reference< XNamed > xName; + if(!m_pTable->isNew()) + { + xName = Reference< XNamed >(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + xName = xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); + } + else + { + OAdabasKey* pKey = new OAdabasKey(m_pTable); + xName = pKey; + Reference<XPropertySet> xProp = pKey; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference<XColumnsSupplier> xSup(_xDescriptor,UNO_QUERY); + Reference<XIndexAccess> xIndex(xSup->getColumns(),UNO_QUERY); + Reference<XAppend> xAppend(pKey->getColumns(),UNO_QUERY); + sal_Int32 nCount = xIndex->getCount(); + for(sal_Int32 i=0;i< nCount;++i) + { + Reference<XPropertySet> xProp; + xIndex->getByIndex(i) >>= xProp; + xAppend->appendByDescriptor(xProp); + } + } + return xName; } +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx index 71adf0585a10..2a164550cb45 100644 --- a/connectivity/source/drivers/adabas/BTables.cxx +++ b/connectivity/source/drivers/adabas/BTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BTables.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: oj $ $Date: 2001-10-05 06:15:40 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -161,24 +161,24 @@ void OTables::disposing(void) // ------------------------------------------------------------------------- Reference< XPropertySet > OTables::createEmptyObject() { - OAdabasTable* pNew = new OAdabasTable(this,static_cast<OAdabasCatalog&>(m_rParent).getConnection()); - return pNew; + return new OAdabasTable(this,static_cast<OAdabasCatalog&>(m_rParent).getConnection()); +} +// ----------------------------------------------------------------------------- +Reference< XNamed > OTables::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OTables::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); if(!aName.getLength()) ::dbtools::throwFunctionSequenceException(*this); createTable(descriptor); - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException) @@ -228,16 +228,12 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); + ObjectIter aIter = m_aElements[_nPos]; if(!aIter->second.is()) // we want to drop a object which isn't loaded yet so we must load it - aIter->second = createObject(elementName); + aIter->second = createObject(_sElementName); Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); sal_Bool bIsNew = sal_False; if(xTunnel.is()) @@ -252,9 +248,9 @@ void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQ Reference< XStatement > xStmt = pConnection->createStatement( ); ::rtl::OUString aName,aSchema; - sal_Int32 nLen = elementName.indexOf('.'); - aSchema = elementName.copy(0,nLen); - aName = elementName.copy(nLen+1); + sal_Int32 nLen = _sElementName.indexOf('.'); + aSchema = _sElementName.copy(0,nLen); + aName = _sElementName.copy(nLen+1); ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP "); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); @@ -274,21 +270,10 @@ void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQ if(bIsView) { OViews* pViews = static_cast<OViews*>(static_cast<OAdabasCatalog&>(m_rParent).getPrivateViews()); - if(pViews && pViews->hasByName(elementName)) - pViews->dropByNameImpl(elementName); + if(pViews && pViews->hasByName(_sElementName)) + pViews->dropByNameImpl(_sElementName); } } - - OCollection_TYPE::dropByName(elementName); -} -// ------------------------------------------------------------------------- -void SAL_CALL OTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); } // ------------------------------------------------------------------------- void OTables::createTable( const Reference< XPropertySet >& descriptor ) diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx index 783fcfa5623e..ee36ff0bfbe7 100644 --- a/connectivity/source/drivers/adabas/BUsers.cxx +++ b/connectivity/source/drivers/adabas/BUsers.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BUsers.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,15 +114,16 @@ Reference< XPropertySet > OUsers::createEmptyObject() return pNew; } // ------------------------------------------------------------------------- +Reference< XNamed > OUsers::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); +} +// ------------------------------------------------------------------------- // XAppend -void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OUsers::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USER "); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); @@ -139,23 +140,16 @@ void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descr if(xStmt.is()) xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OUsers::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OUsers::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - { // first we have to check if this user is live relevaant for the database // which means with out these users the database will miss more than one important system table ::rtl::OUString sUsers = ::rtl::OUString::createFromAscii("SELECT USERMODE,USERNAME FROM DOMAIN.USERS WHERE USERNAME = '"); - sUsers += elementName + ::rtl::OUString::createFromAscii("'"); + sUsers += _sElementName + ::rtl::OUString::createFromAscii("'"); Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) { @@ -170,7 +164,6 @@ void SAL_CALL OUsers::dropByName( const ::rtl::OUString& elementName ) throw(SQL ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("This user couldn't be deleted. Otherwise the database stays in a inconsistent state."),*this); } } - ::comphelper::disposeComponent(xRes); ::comphelper::disposeComponent(xStmt); } } @@ -178,26 +171,13 @@ void SAL_CALL OUsers::dropByName( const ::rtl::OUString& elementName ) throw(SQL { ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USER "); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - aSql += ::dbtools::quoteName(aQuote,elementName); + aSql += ::dbtools::quoteName(aQuote,_sElementName); Reference< XStatement > xStmt = m_pConnection->createStatement( ); if(xStmt.is()) xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } - - OCollection_TYPE::dropByName(elementName); } // ------------------------------------------------------------------------- -void SAL_CALL OUsers::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - ::dbtools::throwInvalidIndexException(*this); - - dropByName(getElementName(index)); -} -// ----------------------------------------------------------------------------- - - diff --git a/connectivity/source/drivers/adabas/BViews.cxx b/connectivity/source/drivers/adabas/BViews.cxx index 0d855910c8c9..798b90628b4b 100644 --- a/connectivity/source/drivers/adabas/BViews.cxx +++ b/connectivity/source/drivers/adabas/BViews.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BViews.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -182,31 +182,22 @@ Reference< XPropertySet > OViews::createEmptyObject() } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OViews::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); if(!aName.getLength()) ::dbtools::throwFunctionSequenceException(*this); createView(descriptor); - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OViews::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); + ObjectIter aIter = m_aElements[_nPos]; if(!aIter->second.is()) // we want to drop a object which isn't loaded yet so we must load it - aIter->second = createObject(elementName); + aIter->second = createObject(_sElementName); Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); sal_Bool bIsNew = sal_False; if(xTunnel.is()) @@ -221,9 +212,9 @@ void SAL_CALL OViews::dropByName( const ::rtl::OUString& elementName ) throw(SQL Reference< XStatement > xStmt = pConnection->createStatement( ); ::rtl::OUString aName,aSchema; - sal_Int32 nLen = elementName.indexOf('.'); - aSchema = elementName.copy(0,nLen); - aName = elementName.copy(nLen+1); + sal_Int32 nLen = _sElementName.indexOf('.'); + aSchema = _sElementName.copy(0,nLen); + aName = _sElementName.copy(nLen+1); ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP VIEW"); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); @@ -233,23 +224,12 @@ void SAL_CALL OViews::dropByName( const ::rtl::OUString& elementName ) throw(SQL xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } - - OCollection_TYPE::dropByName(elementName); } // ----------------------------------------------------------------------------- void OViews::dropByNameImpl(const ::rtl::OUString& elementName) { OCollection_TYPE::dropByName(elementName); } -// ------------------------------------------------------------------------- -void SAL_CALL OViews::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); -} // ----------------------------------------------------------------------------- void OViews::createView( const Reference< XPropertySet >& descriptor ) { @@ -295,5 +275,13 @@ void OViews::appendNew(const ::rtl::OUString& _rsNewTable) static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); } // ----------------------------------------------------------------------------- +Reference< XNamed > OViews::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); +} +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx index 5038e1ad7413..862cd52ce291 100644 --- a/connectivity/source/drivers/ado/AColumns.cxx +++ b/connectivity/source/drivers/ado/AColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AColumns.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:41:55 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,10 @@ #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif + using namespace connectivity::ado; using namespace connectivity; using namespace com::sun::star::uno; @@ -98,9 +102,7 @@ Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName) ADOColumn* pColumn = NULL; m_pCollection->get_Item(OLEVariant(_rName),&pColumn); - Reference< XNamed > xRet = new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn); - - return xRet; + return new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn); } // ------------------------------------------------------------------------- @@ -111,15 +113,12 @@ void OColumns::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OColumns::createEmptyObject() { - OAdoColumn* pNew = new OAdoColumn(isCaseSensitive(),m_pConnection); - return pNew; + return new OAdoColumn(isCaseSensitive(),m_pConnection); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OColumns::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { @@ -133,29 +132,25 @@ void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& des else throw SQLException(::rtl::OUString::createFromAscii("Could not append column!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); - - OCollection_TYPE::dropByName(elementName); + m_pCollection->Delete(OLEVariant(_sElementName)); + ADOS::ThrowException(*m_pConnection->getConnection(),*this); } -// ------------------------------------------------------------------------- -void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +// ----------------------------------------------------------------------------- +Reference< XNamed > OColumns::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - m_pCollection->Delete(OLEVariant(index)); - OCollection_TYPE::dropByIndex(index); + OAdoColumn* pColumn = new OAdoColumn(isCaseSensitive(),m_pConnection); + Reference<XPropertySet> xProp = pColumn; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference< XNamed > xName(xProp,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName; } // ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx index d999d6dc1494..47db6741f82b 100644 --- a/connectivity/source/drivers/ado/AGroups.cxx +++ b/connectivity/source/drivers/ado/AGroups.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AGroups.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-06-20 07:16:56 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,10 +93,7 @@ typedef connectivity::sdbcx::OCollection OCollection_TYPE; // ------------------------------------------------------------------------- Reference< XNamed > OGroups::createObject(const ::rtl::OUString& _rName) { - Reference< XNamed > xRet = NULL; - OAdoGroup* pRet = new OAdoGroup(m_pCatalog,isCaseSensitive(),_rName); - xRet = pRet; - return xRet; + return new OAdoGroup(m_pCatalog,isCaseSensitive(),_rName); } // ------------------------------------------------------------------------- void OGroups::impl_refresh() throw(RuntimeException) @@ -106,44 +103,34 @@ void OGroups::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OGroups::createEmptyObject() { - OAdoGroup* pNew = new OAdoGroup(m_pCatalog,isCaseSensitive()); - return pNew; + return new OAdoGroup(m_pCatalog,isCaseSensitive()); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OGroups::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { OAdoGroup* pGroup = (OAdoGroup*)xTunnel->getSomething(OAdoGroup::getUnoTunnelImplementationId()); m_pCollection->Append(OLEVariant(pGroup->getImpl())); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OGroups::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OGroups::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); - - OCollection_TYPE::dropByName(elementName); + m_pCollection->Delete(OLEVariant(_sElementName)); } -// ------------------------------------------------------------------------- -void SAL_CALL OGroups::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +// ----------------------------------------------------------------------------- +Reference< XNamed > OGroups::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); +} +// ----------------------------------------------------------------------------- - m_pCollection->Delete(OLEVariant(index)); - OCollection_TYPE::dropByIndex(index); -} diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx index 1679d3c9d2df..af040ba934fa 100644 --- a/connectivity/source/drivers/ado/AIndexes.cxx +++ b/connectivity/source/drivers/ado/AIndexes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AIndexes.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-05-18 08:48:07 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,9 +98,7 @@ Reference< XNamed > OIndexes::createObject(const ::rtl::OUString& _rName) ADOIndex* pIndex = NULL; m_pCollection->get_Item(OLEVariant(_rName),&pIndex); - Reference< XNamed > xRet = new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex); - - return xRet; + return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex); } // ------------------------------------------------------------------------- void OIndexes::impl_refresh() throw(RuntimeException) @@ -110,15 +108,12 @@ void OIndexes::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OIndexes::createEmptyObject() { - OAdoIndex* pNew = new OAdoIndex(isCaseSensitive(),m_pConnection); - return pNew; + return new OAdoIndex(isCaseSensitive(),m_pConnection); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OIndexes::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { @@ -129,30 +124,20 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des else throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OIndexes::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); - - OCollection_TYPE::dropByName(elementName); + m_pCollection->Delete(OLEVariant(_sElementName)); } // ------------------------------------------------------------------------- -void SAL_CALL OIndexes::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +Reference< XNamed > OIndexes::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - m_pCollection->Delete(OLEVariant(index)); - - OCollection_TYPE::dropByIndex(index); + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/AKeyColumns.cxx b/connectivity/source/drivers/ado/AKeyColumns.cxx index 48063198b3ae..dfd02cc35489 100644 --- a/connectivity/source/drivers/ado/AKeyColumns.cxx +++ b/connectivity/source/drivers/ado/AKeyColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AKeyColumns.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-08-02 10:41:52 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,17 +83,17 @@ using namespace connectivity::adabas; // ------------------------------------------------------------------------- -staruno::Reference< starcontainer::XNamed > OKeyColumns::createObject(const ::rtl::OUString& _rName) +Reference< XNamed > OKeyColumns::createObject(const ::rtl::OUString& _rName) { - staruno::Reference< starsdbc::XResultSet > - xResult = m_pTable->getConnection()->getMetaData()->getImportedKeys(staruno::Any(), + Reference< starsdbc::XResultSet > + xResult = m_pTable->getConnection()->getMetaData()->getImportedKeys(Any(), m_pTable->getSchema(),m_pTable->getName()); ::rtl::OUString aRefColumnName; if(xResult.is()) { - staruno::Reference< starsdbc::XRow > xRow(xResult,staruno::UNO_QUERY); + Reference< starsdbc::XRow > xRow(xResult,UNO_QUERY); while(xResult->next()) { if(xRow->getString(8) == _rName) @@ -104,13 +104,13 @@ staruno::Reference< starcontainer::XNamed > OKeyColumns::createObject(const ::rt } } - xResult = m_pTable->getConnection()->getMetaData()->getColumns(staruno::Any(), + xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), m_pTable->getSchema(),m_pTable->getName(),_rName); - staruno::Reference< starcontainer::XNamed > xRet = NULL; + Reference< XNamed > xRet = NULL; if(xResult.is()) { - staruno::Reference< starsdbc::XRow > xRow(xResult,staruno::UNO_QUERY); + Reference< starsdbc::XRow > xRow(xResult,UNO_QUERY); if(xResult->next()) { if(xRow->getString(4) == _rName) @@ -132,7 +132,7 @@ staruno::Reference< starcontainer::XNamed > OKeyColumns::createObject(const ::rt return xRet; } // ------------------------------------------------------------------------- -staruno::Reference< starbeans::XPropertySet > OKeyColumns::createEmptyObject() +Reference< XPropertySet > OKeyColumns::createEmptyObject() { OKeyColumn* pNew = new OKeyColumn(); return pNew; diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx index a9f2a1b71ff7..32e21b0a1166 100644 --- a/connectivity/source/drivers/ado/AKeys.cxx +++ b/connectivity/source/drivers/ado/AKeys.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AKeys.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-09-17 14:09:15 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,12 @@ #ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ #include "ado/Awrapado.hxx" #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HDL_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hdl> +#endif using namespace ::comphelper; using namespace connectivity; @@ -94,6 +100,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; typedef connectivity::sdbcx::OCollection OCollection_TYPE; @@ -102,10 +109,7 @@ Reference< XNamed > OKeys::createObject(const ::rtl::OUString& _rName) { ADOKey* pKey = NULL; m_pCollection->get_Item(OLEVariant(_rName),&pKey); - - Reference< XNamed > xRet = new OAdoKey(isCaseSensitive(),m_pConnection,pKey); - - return xRet; + return new OAdoKey(isCaseSensitive(),m_pConnection,pKey); } // ------------------------------------------------------------------------- void OKeys::impl_refresh() throw(RuntimeException) @@ -115,15 +119,12 @@ void OKeys::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OKeys::createEmptyObject() { - OAdoKey* pNew = new OAdoKey(isCaseSensitive(),m_pConnection); - return pNew; + return new OAdoKey(isCaseSensitive(),m_pConnection); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OKeys::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { @@ -141,31 +142,34 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri else throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OKeys::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OKeys::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); + m_pCollection->Delete(OLEVariant(_sElementName)); ADOS::ThrowException(*m_pConnection->getConnection(),*this); - - OCollection_TYPE::dropByName(elementName); } -// ------------------------------------------------------------------------- -void SAL_CALL OKeys::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +// ----------------------------------------------------------------------------- +Reference< XNamed > OKeys::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - m_pCollection->Delete(OLEVariant(index)); - ADOS::ThrowException(*m_pConnection->getConnection(),*this); + OAdoKey* pKey = new OAdoKey(isCaseSensitive(),m_pConnection); + Reference<XPropertySet> xProp = pKey; + Reference< XNamed > xName = pKey; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference<XColumnsSupplier> xSup(_xDescriptor,UNO_QUERY); + Reference<XIndexAccess> xIndex(xSup->getColumns(),UNO_QUERY); + Reference<XAppend> xAppend(pKey->getColumns(),UNO_QUERY); + sal_Int32 nCount = xIndex->getCount(); + for(sal_Int32 i=0;i< nCount;++i) + { + Reference<XPropertySet> xProp; + xIndex->getByIndex(i) >>= xProp; + xAppend->appendByDescriptor(xProp); + } - OCollection_TYPE::dropByIndex(index); + return xName; } // ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx index 0fa9c5ef3793..f896a5ba48aa 100644 --- a/connectivity/source/drivers/ado/ATables.cxx +++ b/connectivity/source/drivers/ado/ATables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ATables.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:49 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,10 +108,7 @@ Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName) { ADOTable* pTable = NULL; m_pCollection->get_Item(OLEVariant(_rName),&pTable); - - Reference< XNamed > xRet = new OAdoTable(this,isCaseSensitive(),m_pCatalog,pTable); - - return xRet; + return new OAdoTable(this,isCaseSensitive(),m_pCatalog,pTable); } // ------------------------------------------------------------------------- void OTables::impl_refresh( ) throw(RuntimeException) @@ -121,15 +118,12 @@ void OTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OTables::createEmptyObject() { - OAdoTable* pNew = new OAdoTable(this,isCaseSensitive(),m_pCatalog); - return pNew; + return new OAdoTable(this,isCaseSensitive(),m_pCatalog); } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OTables::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { @@ -142,32 +136,21 @@ void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& desc else throw SQLException(::rtl::OUString::createFromAscii("Could not append table!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); + m_pCollection->Delete(OLEVariant(_sElementName)); ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this); - - OCollection_TYPE::dropByName(elementName); } // ------------------------------------------------------------------------- -void SAL_CALL OTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +Reference< XNamed > OTables::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - m_pCollection->Delete(OLEVariant(index)); - ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this); - - OCollection_TYPE::dropByIndex(index); + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx index 484550afd3f0..85eb74f964ee 100644 --- a/connectivity/source/drivers/ado/AUsers.cxx +++ b/connectivity/source/drivers/ado/AUsers.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AUsers.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-06-20 07:16:56 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,40 +107,28 @@ Reference< XPropertySet > OUsers::createEmptyObject() } // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OUsers::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { OUserExtend* pUser = (OUserExtend*)xTunnel->getSomething(OUserExtend::getUnoTunnelImplementationId()); if(pUser) m_pCollection->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword())); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OUsers::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OUsers::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); - - OCollection_TYPE::dropByName(elementName); + m_pCollection->Delete(OLEVariant(_sElementName)); } // ------------------------------------------------------------------------- -void SAL_CALL OUsers::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +Reference< XNamed > OUsers::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - m_pCollection->Delete(OLEVariant(index)); - - OCollection_TYPE::dropByIndex(index); + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx index ba0ba76fcb3a..38ba7e13aab1 100644 --- a/connectivity/source/drivers/ado/AViews.cxx +++ b/connectivity/source/drivers/ado/AViews.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AViews.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-18 08:48:07 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,10 +130,8 @@ Reference< XPropertySet > OViews::createEmptyObject() // ------------------------------------------------------------------------- // XAppend -void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void OViews::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { @@ -146,32 +144,22 @@ void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descr else throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } - - OCollection_TYPE::appendByDescriptor(descriptor); } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL OViews::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - m_pCollection->Delete(OLEVariant(elementName)); + m_pCollection->Delete(OLEVariant(_sElementName)); ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this); - - OCollection_TYPE::dropByName(elementName); } // ------------------------------------------------------------------------- -void SAL_CALL OViews::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +Reference< XNamed > OViews::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - m_pCollection->Delete(OLEVariant(index)); - ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this); - - OCollection_TYPE::dropByIndex(index); + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/calc/CColumns.cxx b/connectivity/source/drivers/calc/CColumns.cxx index 867b66abecad..1881d2c8fb0c 100644 --- a/connectivity/source/drivers/calc/CColumns.cxx +++ b/connectivity/source/drivers/calc/CColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CColumns.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: nn $ $Date: 2001-01-26 19:05:48 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:45:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,26 +80,14 @@ using namespace ::com::sun::star::container; Reference< XNamed > OCalcColumns::createObject(const ::rtl::OUString& _rName) { - OCalcTable* pTable = (OCalcTable*)m_pTable; - - // Reference< XFastPropertySet> xCol(pTable->getColumns()[_rName],UNO_QUERY); ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns(); - Reference< XNamed > xRet(*find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())),UNO_QUERY); + OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); + Reference< XNamed > xRet; + if(aIter != aCols->end()) + xRet = Reference< XNamed >(*aIter,UNO_QUERY); return xRet; } - // ------------------------------------------------------------------------- -void OCalcColumns::impl_refresh() throw(RuntimeException) -{ - m_pTable->refreshColumns(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OCalcColumns::createEmptyObject() -{ - sdbcx::OColumn* pRet = new sdbcx::OColumn(isCaseSensitive()); - Reference< XPropertySet > xRet = pRet; - return xRet; -} diff --git a/connectivity/source/drivers/calc/CTables.cxx b/connectivity/source/drivers/calc/CTables.cxx index 1ffa5cb0058a..4fa02051adad 100644 --- a/connectivity/source/drivers/calc/CTables.cxx +++ b/connectivity/source/drivers/calc/CTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CTables.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:49 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:45:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,30 +65,12 @@ #ifndef _CONNECTIVITY_CALC_TABLE_HXX_ #include "calc/CTable.hxx" #endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ -#include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ -#include <com/sun/star/sdbc/XResultSet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ -#include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ -#include <com/sun/star/sdbc/KeyRule.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ -#include <com/sun/star/sdbcx/KeyType.hpp> -#endif #ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ #include "file/FCatalog.hxx" #endif #ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ #include "file/FConnection.hxx" #endif -#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ -#include <com/sun/star/lang/XUnoTunnel.hpp> -#endif #ifndef _CONNECTIVITY_CALC_CATALOG_HXX_ #include "calc/CCatalog.hxx" #endif @@ -110,86 +92,8 @@ namespace starutil = ::com::sun::star::util; Reference< XNamed > OCalcTables::createObject(const ::rtl::OUString& _rName) { - ::rtl::OUString aName,aSchema; - OCalcTable* pRet = new OCalcTable(this,(OCalcConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), + return new OCalcTable(this,(OCalcConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), _rName,::rtl::OUString::createFromAscii("TABLE")); - - Reference< XNamed > xRet = pRet; -// if(!pRet->isValid()) -// { -// ::comphelper::disposeComponent(xRet); -// throw SQLException(::rtl::OUString::createFromAscii("Invalid DBase file found!"),m_rParent,_rName,1000,Any()); -// } - - return xRet; } // ------------------------------------------------------------------------- -void OCalcTables::impl_refresh( ) throw(RuntimeException) -{ - static_cast<OCalcCatalog*>(&m_rParent)->refreshTables(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OCalcTables::createEmptyObject() -{ - OCalcTable* pRet = new OCalcTable(this,(OCalcConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection()); - Reference< XPropertySet > xRet = pRet; - return xRet; -} -typedef connectivity::sdbcx::OCollection OCalcTables_BASE_BASE; -// ------------------------------------------------------------------------- -// XAppend -void SAL_CALL OCalcTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - - Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); - if(xTunnel.is()) - { - OCalcTable* pTable = (OCalcTable*)xTunnel->getSomething(OCalcTable::getUnoTunnelImplementationId()); - if(pTable && pTable->CreateImpl()) - { - OCalcTables_BASE_BASE::appendByDescriptor(Reference< XPropertySet >(createObject(aName),UNO_QUERY)); - } - } -} -// ------------------------------------------------------------------------- -// XDrop -void SAL_CALL OCalcTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - - Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); - if(xTunnel.is()) - { - OCalcTable* pTable = (OCalcTable*)xTunnel->getSomething(OCalcTable::getUnoTunnelImplementationId()); - if(pTable && pTable->DropImpl()) - OCalcTables_BASE_BASE::dropByName(elementName); - } - -} -// ------------------------------------------------------------------------- -void SAL_CALL OCalcTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); -} -// ------------------------------------------------------------------------- -//------------------------------------------------------------------ -Any SAL_CALL OCalcTables::queryInterface( const Type & rType ) throw(RuntimeException) -{ - typedef sdbcx::OCollection OTables_BASE; - return OTables_BASE::queryInterface(rType); -} diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx index 387c15aa7d88..230147cabde4 100644 --- a/connectivity/source/drivers/dbase/DColumns.cxx +++ b/connectivity/source/drivers/dbase/DColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DColumns.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:19:41 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,9 @@ #ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif using namespace connectivity::dbase; using namespace connectivity; @@ -110,38 +113,28 @@ Reference< XPropertySet > ODbaseColumns::createEmptyObject() // ----------------------------------------------------------------------------- // ------------------------------------------------------------------------- // XAppend -void SAL_CALL ODbaseColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void ODbaseColumns::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); if(!m_pTable->isNew()) m_pTable->addColumn(descriptor); - else - ODbaseColumns_BASE::appendByDescriptor(descriptor); } // ----------------------------------------------------------------------------- // ------------------------------------------------------------------------- // XDrop -void SAL_CALL ODbaseColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void ODbaseColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - if(!m_pTable->isNew()) - m_pTable->dropColumn(findColumn(elementName)-1); - else - ODbaseColumns_BASE::dropByName(elementName); + m_pTable->dropColumn(_nPos); } // ----------------------------------------------------------------------------- -// ------------------------------------------------------------------------- -void SAL_CALL ODbaseColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +Reference< XNamed > ODbaseColumns::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - if(!m_pTable->isNew()) - m_pTable->dropColumn(index); - else - ODbaseColumns_BASE::dropByIndex(index); + sdbcx::OColumn* pColumn = new sdbcx::OColumn(isCaseSensitive()); + Reference<XPropertySet> xProp = pColumn; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference< XNamed > xName(xProp,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx index aa8028ee359f..09589d23a06e 100644 --- a/connectivity/source/drivers/dbase/DIndexColumns.cxx +++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndexColumns.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-05-18 08:48:08 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,9 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif using namespace ::comphelper; @@ -120,9 +123,22 @@ void ODbaseIndexColumns::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > ODbaseIndexColumns::createEmptyObject() { - sdbcx::OIndexColumn* pRet = new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); - Reference< XPropertySet > xRet = pRet; - return xRet; + return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); +} +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +Reference< XNamed > ODbaseIndexColumns::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + sdbcx::OIndexColumn* pColumn = new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + Reference<XPropertySet> xProp = pColumn; + ::comphelper::copyProperties(_xDescriptor,xProp); + Reference< XNamed > xName(xProp,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName; +} +// ------------------------------------------------------------------------- +void ODbaseIndexColumns::appendObject( const Reference< XPropertySet >& descriptor ) +{ } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index 2d44bda6a2fd..04fdfdb4f7e9 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndexes.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-08-13 13:58:56 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,61 +128,45 @@ void ODbaseIndexes::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > ODbaseIndexes::createEmptyObject() { - ODbaseIndex* pRet = new ODbaseIndex(m_pTable); - Reference< XPropertySet > xRet = pRet; - return xRet; + return new ODbaseIndex(m_pTable); } typedef connectivity::sdbcx::OCollection ODbaseTables_BASE_BASE; // ------------------------------------------------------------------------- // XAppend -void SAL_CALL ODbaseIndexes::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void ODbaseIndexes::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); - if(pIndex && pIndex->CreateImpl()) - ODbaseIndexes_BASE::appendByDescriptor(Reference< XPropertySet >(createObject(aName),UNO_QUERY)); + if(!pIndex || !pIndex->CreateImpl()) + throw SQLException(); } } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL ODbaseIndexes::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void ODbaseIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - + ObjectIter aIter = m_aElements[_nPos]; if(!aIter->second.is()) - aIter->second = createObject(elementName); + aIter->second = createObject(_sElementName); Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); if(xTunnel.is()) { ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); - if(pIndex && pIndex->DropImpl()) - ODbaseIndexes_BASE::dropByName(elementName); + if(pIndex) + pIndex->DropImpl(); } } // ------------------------------------------------------------------------- -void SAL_CALL ODbaseIndexes::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +Reference< XNamed > ODbaseIndexes::cloneObject(const Reference< XPropertySet >& _xDescriptor) { - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); } -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index e2067931483f..32435d178d46 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.64 $ + * $Revision: 1.65 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:49 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1721,13 +1721,16 @@ void ODbaseTable::alterColumn(sal_Int32 index, if(DropImpl()) { // rename the new one to the old one - pNewTable->rename(m_Name); + pNewTable->renameImpl(m_Name); // release the temp file pNewTable = NULL; ::comphelper::disposeComponent(xHoldTable); } else + { delete pNewTable; + pNewTable = NULL; + } FileClose(); construct(); if(m_pColumns) @@ -1755,6 +1758,13 @@ void SAL_CALL ODbaseTable::rename( const ::rtl::OUString& newName ) throw(::com: throw ElementExistException(newName,*this); + renameImpl(newName); +} +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseTable::renameImpl( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + FileClose(); String aName = getEntry(m_pConnection,m_Name); if(!aName.Len()) @@ -1851,7 +1861,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) if(DropImpl()) { bAlreadyDroped = TRUE; - pNewTable->rename(m_Name); + pNewTable->renameImpl(m_Name); // release the temp file pNewTable->release(); } @@ -1916,7 +1926,7 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) // drop the old table if(DropImpl()) { - pNewTable->rename(m_Name); + pNewTable->renameImpl(m_Name); // release the temp file pNewTable->release(); } diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 556676ed6fbe..2c722fa8f704 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTables.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:49 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -125,22 +125,13 @@ void ODbaseTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > ODbaseTables::createEmptyObject() { - ODbaseTable* pRet = new ODbaseTable(this,(ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection()); - Reference< XPropertySet > xRet = pRet; - return xRet; + return new ODbaseTable(this,(ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection()); } typedef connectivity::sdbcx::OCollection ODbaseTables_BASE_BASE; // ------------------------------------------------------------------------- // XAppend -void SAL_CALL ODbaseTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +void ODbaseTables::appendObject( const Reference< XPropertySet >& descriptor ) { - ::osl::MutexGuard aGuard(m_rMutex); - - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { @@ -150,12 +141,8 @@ void SAL_CALL ODbaseTables::appendByDescriptor( const Reference< XPropertySet >& pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); try { - if(pTable->CreateImpl()) - { - pTable->setNew(sal_False); - pTable->construct(); - ODbaseTables_BASE_BASE::appendByDescriptor(Reference< XPropertySet >(*pTable,UNO_QUERY)); - } + if(!pTable->CreateImpl()) + throw SQLException(); } catch(SQLException&) { @@ -170,27 +157,19 @@ void SAL_CALL ODbaseTables::appendByDescriptor( const Reference< XPropertySet >& } // ------------------------------------------------------------------------- // XDrop -void SAL_CALL ODbaseTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +void ODbaseTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - ::osl::MutexGuard aGuard(m_rMutex); - - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - + ObjectIter aIter = m_aElements[_nPos]; if(!aIter->second.is()) {// we want to drop a object which isn't loaded yet so we must load it try { - aIter->second = createObject(elementName); + aIter->second = createObject(_sElementName); } catch(const Exception&) { - if(ODbaseTable::Drop_Static(ODbaseTable::getEntry(static_cast<OFileCatalog&>(m_rParent).getConnection(),elementName),sal_False,NULL)) - { - ODbaseTables_BASE_BASE::dropByName(elementName); + if(ODbaseTable::Drop_Static(ODbaseTable::getEntry(static_cast<OFileCatalog&>(m_rParent).getConnection(),_sElementName),sal_False,NULL)) return; - } } } @@ -198,27 +177,26 @@ void SAL_CALL ODbaseTables::dropByName( const ::rtl::OUString& elementName ) thr if(xTunnel.is()) { ODbaseTable* pTable = (ODbaseTable*)xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()); - if(pTable && pTable->DropImpl()) - ODbaseTables_BASE_BASE::dropByName(elementName); + if(pTable) + pTable->DropImpl(); } else - throw SQLException(::rtl::OUString::createFromAscii("Can't drop table ") + elementName,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Can't drop table ") + _sElementName,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); } // ------------------------------------------------------------------------- -void SAL_CALL ODbaseTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); -} -// ------------------------------------------------------------------------- -//------------------------------------------------------------------ Any SAL_CALL ODbaseTables::queryInterface( const Type & rType ) throw(RuntimeException) { typedef sdbcx::OCollection OTables_BASE; return OTables_BASE::queryInterface(rType); } +// ----------------------------------------------------------------------------- +Reference< XNamed > ODbaseTables::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + Reference< XNamed > xName(_xDescriptor,UNO_QUERY); + OSL_ENSURE(xName.is(),"Must be a XName interface here !"); + return xName.is() ? createObject(xName->getName()) : Reference< XNamed >(); +} +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx index a63bcaead571..6618cd978bd2 100644 --- a/connectivity/source/drivers/file/FColumns.cxx +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FColumns.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ #ifndef _CONNECTIVITY_FILE_TABLE_HXX_ #include "file/FTable.hxx" #endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif using namespace connectivity::file; using namespace connectivity; @@ -125,16 +128,14 @@ Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName) return xRet; } - -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void OColumns::impl_refresh() throw(RuntimeException) { m_pTable->refreshColumns(); } -// ------------------------------------------------------------------------- -Reference< XPropertySet > OColumns::createEmptyObject() -{ - return new sdbcx::OColumn(m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); -} +// ----------------------------------------------------------------------------- + + + diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index 637dd4a2233b..3cb735644223 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FTable.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:50 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -276,3 +276,4 @@ void OFileTable::refreshHeader() { } // ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx index 6150ed228b39..5740cdfb7d32 100644 --- a/connectivity/source/drivers/file/FTables.cxx +++ b/connectivity/source/drivers/file/FTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FTables.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:46:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,33 +102,7 @@ typedef connectivity::sdbcx::OCollection OCollection_TYPE; Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName) { -// ::rtl::OUString aName,aSchema; -// sal_Int32 nLen = _rName.indexOf('.'); -// aSchema = _rName.copy(0,nLen); -// aName = _rName.copy(nLen+1); -// -// Sequence< ::rtl::OUString > aTypes(1); -// aTypes[0] = ::rtl::OUString::createFromAscii("%"); -// // aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); -// // aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE"); -// -// Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), -// aSchema,aName,aTypes); - - Reference< XNamed > xRet = NULL; -// if(xResult.is()) -// { -// Reference< XRow > xRow(xResult,UNO_QUERY); -// if(xResult->next()) // there can be only one table with this name -// { -// OFileTable* pRet = new OFileTable(static_cast<OFileCatalog&>(m_rParent).getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(), -// static_cast<OFileCatalog&>(m_rParent).getConnection(), -// aName,xRow->getString(4),xRow->getString(5),aSchema); -// xRet = pRet; -// } -// } -// - return xRet; + return Reference< XNamed >(); } // ------------------------------------------------------------------------- void OTables::impl_refresh( ) throw(RuntimeException) @@ -141,11 +115,6 @@ void OTables::disposing(void) m_xMetaData = NULL; OCollection::disposing(); } -// ------------------------------------------------------------------------- -Reference< XPropertySet > OTables::createEmptyObject() -{ - return Reference< XPropertySet >(); -} //------------------------------------------------------------------ Any SAL_CALL OTables::queryInterface( const Type & rType ) throw(RuntimeException) { @@ -158,4 +127,4 @@ Any SAL_CALL OTables::queryInterface( const Type & rType ) throw(RuntimeExceptio typedef sdbcx::OCollection OTables_BASE; return OTables_BASE::queryInterface(rType); } - +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/flat/EColumns.cxx b/connectivity/source/drivers/flat/EColumns.cxx index 8cb163a7ad24..8c03479d20b5 100644 --- a/connectivity/source/drivers/flat/EColumns.cxx +++ b/connectivity/source/drivers/flat/EColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EColumns.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-11 10:46:43 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:47:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,21 +83,12 @@ Reference< XNamed > OFlatColumns::createObject(const ::rtl::OUString& _rName) OFlatTable* pTable = (OFlatTable*)m_pTable; ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns(); - - Reference< XNamed > xRet(*find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())),UNO_QUERY); + OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); + Reference< XNamed > xRet; + if(aIter != aCols->end()) + xRet = Reference< XNamed >(*aIter,UNO_QUERY); return xRet; } - -// ------------------------------------------------------------------------- -void OFlatColumns::impl_refresh() throw(RuntimeException) -{ - m_pTable->refreshColumns(); -} // ------------------------------------------------------------------------- -Reference< XPropertySet > OFlatColumns::createEmptyObject() -{ - // sdbcx::OColumn* pRet = new sdbcx::OColumn(isCaseSensitive()); - Reference< XPropertySet > xRet; - return xRet; -} + diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx index f536ca6ededf..af567bc4e2f5 100644 --- a/connectivity/source/drivers/flat/ETables.cxx +++ b/connectivity/source/drivers/flat/ETables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ETables.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:50 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:47:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,72 +103,8 @@ namespace starutil = ::com::sun::star::util; Reference< XNamed > OFlatTables::createObject(const ::rtl::OUString& _rName) { - ::rtl::OUString aName,aSchema; - OFlatTable* pRet = new OFlatTable(this,(OFlatConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), + return new OFlatTable(this,(OFlatConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), _rName,::rtl::OUString::createFromAscii("TABLE")); - - Reference< XNamed > xRet = pRet; - - return xRet; -} -// ------------------------------------------------------------------------- -void OFlatTables::impl_refresh( ) throw(RuntimeException) -{ - // static_cast<OFileCatalog&>(m_rParent).refreshTables(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OFlatTables::createEmptyObject() -{ - Reference< XPropertySet > xRet; - return xRet; -} -typedef connectivity::sdbcx::OCollection OFlatTables_BASE_BASE; -// ------------------------------------------------------------------------- -// XAppend -void SAL_CALL OFlatTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - - Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); - if(xTunnel.is()) - { - OFlatTable* pTable = (OFlatTable*)xTunnel->getSomething(OFlatTable::getUnoTunnelImplementationId()); - if(pTable && pTable->CreateImpl()) - OFlatTables_BASE_BASE::appendByDescriptor(descriptor); - } -} -// ------------------------------------------------------------------------- -// XDrop -void SAL_CALL OFlatTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - - ObjectMap::iterator aIter = m_aNameMap.find(elementName); - if( aIter == m_aNameMap.end()) - throw NoSuchElementException(elementName,*this); - - Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); - if(xTunnel.is()) - { - OFlatTable* pTable = (OFlatTable*)xTunnel->getSomething(OFlatTable::getUnoTunnelImplementationId()); - if(pTable && pTable->DropImpl()) - OFlatTables_BASE_BASE::dropByName(elementName); - } - -} -// ------------------------------------------------------------------------- -void SAL_CALL OFlatTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if (index < 0 || index >= getCount()) - throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - - dropByName(getElementName(index)); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx index 52d185e72207..1d00f28c3012 100644 --- a/connectivity/source/drivers/mozab/MColumns.cxx +++ b/connectivity/source/drivers/mozab/MColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MColumns.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -149,26 +149,6 @@ void OColumns::impl_refresh() throw(RuntimeException) { m_pTable->refreshColumns(); } -// ------------------------------------------------------------------------- -Reference< XPropertySet > OColumns::createEmptyObject() -{ - return new OColumn(sal_True); -} -// ------------------------------------------------------------------------- -// XAppend -void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) -{ -} - -// ------------------------------------------------------------------------- -// XDrop -void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ -} // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MColumns.hxx b/connectivity/source/drivers/mozab/MColumns.hxx index d633f2023559..a69edf2fe3ea 100644 --- a/connectivity/source/drivers/mozab/MColumns.hxx +++ b/connectivity/source/drivers/mozab/MColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MColumns.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,7 +86,6 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OColumns( OTable* _pTable, ::osl::Mutex& _rMutex, @@ -94,12 +93,6 @@ namespace connectivity ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) ,m_pTable(_pTable) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/drivers/mozab/MTable.cxx b/connectivity/source/drivers/mozab/MTable.cxx index 24f0de9a6693..390a8188bcd6 100644 --- a/connectivity/source/drivers/mozab/MTable.cxx +++ b/connectivity/source/drivers/mozab/MTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MTable.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,7 +117,8 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection) - : OTable_TYPEDEF(_pTables, sal_True),m_pConnection(_pConnection) + : OTable_TYPEDEF(_pTables, sal_True) + ,m_pConnection(_pConnection) { construct(); } @@ -161,41 +162,6 @@ void OTable::refreshColumns() else m_pColumns = new OColumns(this,m_aMutex,aVector); } -// ------------------------------------------------------------------------- -void OTable::refreshPrimaryKeys(std::vector< ::rtl::OUString>& _rKeys) -{ - Reference< XResultSet > xResult = m_pConnection->getMetaData()->getPrimaryKeys(Any(),m_SchemaName,m_Name); - - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - if(xResult->next()) // there can be only one primary key - { - ::rtl::OUString aPkName = xRow->getString(6); - _rKeys.push_back(aPkName); - } - } -} -// ------------------------------------------------------------------------- -void OTable::refreshForgeinKeys(std::vector< ::rtl::OUString>& _rKeys) -{ - Reference< XResultSet > xResult = m_pConnection->getMetaData()->getImportedKeys(Any(),m_SchemaName,m_Name); - - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - _rKeys.push_back(xRow->getString(12)); - } -} -// ------------------------------------------------------------------------- -void OTable::refreshKeys() -{ -} -// ------------------------------------------------------------------------- -void OTable::refreshIndexes() -{ -} //-------------------------------------------------------------------------- Sequence< sal_Int8 > OTable::getUnoTunnelImplementationId() { @@ -222,26 +188,6 @@ sal_Int64 OTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Runtim : OTable_TYPEDEF::getSomething(rId); } -// ------------------------------------------------------------------------- -// XRename -void SAL_CALL OTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -// XAlterTable -void SAL_CALL OTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -void SAL_CALL OTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) -{ -} - -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OTable::getName() throw(::com::sun::star::uno::RuntimeException) -{ - return m_Name; -} #ifdef DARREN_WORK // ----------------------------------------------------------------------------- void SAL_CALL OTable::acquire() throw(::com::sun::star::uno::RuntimeException) @@ -255,44 +201,6 @@ void SAL_CALL OTable::release() throw(::com::sun::star::uno::RuntimeException) } #endif /* DARREN_WORK */ // ----------------------------------------------------------------------------- -void OTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor) -{ -} -// ----------------------------------------------------------------------------- -void OTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName) -{ -} -// ----------------------------------------------------------------------------- -void OTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName) -{ -} -// ----------------------------------------------------------------------------- -void OTable::dropDefaultValue(const ::rtl::OUString& _rColName) -{ -} -// ----------------------------------------------------------------------------- -void OTable::addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName) -{ -} -// ----------------------------------------------------------------------------- -void OTable::beginTransAction() -{ -} -// ----------------------------------------------------------------------------- -void OTable::endTransAction() -{ -} -// ----------------------------------------------------------------------------- -void OTable::rollbackTransAction() -{ -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTable::getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName ) -{ - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii(""); - return sSql; -} -// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MTable.hxx b/connectivity/source/drivers/mozab/MTable.hxx index 20a7e027bc12..75fe3c1eeda5 100644 --- a/connectivity/source/drivers/mozab/MTable.hxx +++ b/connectivity/source/drivers/mozab/MTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MTable.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,16 +85,6 @@ namespace connectivity ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; OConnection* m_pConnection; - void refreshPrimaryKeys(std::vector< ::rtl::OUString>& _rKeys); - void refreshForgeinKeys(std::vector< ::rtl::OUString>& _rKeys); - - - - public: - virtual void refreshColumns(); - virtual void refreshKeys(); - virtual void refreshIndexes(); - public: OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection); OTable( sdbcx::OCollection* _pTables, @@ -109,41 +99,14 @@ namespace connectivity OConnection* getConnection() { return m_pConnection;} sal_Bool isReadOnly() const { return sal_True; } + virtual void refreshColumns(); ::rtl::OUString getTableName() const { return m_Name; } ::rtl::OUString getSchema() const { return m_SchemaName; } - // virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException); - // virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); // com::sun::star::lang::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(); - - // XRename - virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - - // XAlterTable - virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - // XNamed - virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - /** - returns the ALTER TABLE XXX COLUMN statement - */ - ::rtl::OUString getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName ); - - // starts a sql transaaction - void beginTransAction(); - // rolls back a sql transaaction - void rollbackTransAction(); - // ends a sql transaaction - void endTransAction(); - // some methods to alter table structures - void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); - void alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName); - void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); - void dropDefaultValue(const ::rtl::OUString& _sNewDefault); - void addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); }; } } diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx index d126d07839fa..401843557264 100644 --- a/connectivity/source/drivers/mozab/MTables.cxx +++ b/connectivity/source/drivers/mozab/MTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MTables.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -142,6 +142,7 @@ Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName) xRet = pRet; } } + ::comphelper::disposeComponent(xResult); return xRet; } @@ -156,189 +157,5 @@ void OTables::disposing(void) m_xMetaData = NULL; OCollection::disposing(); } -// ------------------------------------------------------------------------- -Reference< XPropertySet > OTables::createEmptyObject() -{ - OTable* pNew = new OTable(this, static_cast<OCatalog&>(m_rParent).getConnection()); - return pNew; -} -// ------------------------------------------------------------------------- -// XAppend -void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - ObjectMap::iterator aIter = m_aNameMap.find(aName); - if( aIter != m_aNameMap.end()) - throw ElementExistException(aName,*this); - if(!aName.getLength()) - ::dbtools::throwFunctionSequenceException(*this); - - createTable(descriptor); - - OCollection_TYPE::appendByDescriptor(descriptor); -} -// ------------------------------------------------------------------------- -void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -// XDrop -void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -void SAL_CALL OTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) -{ -} -// ------------------------------------------------------------------------- -void OTables::createTable( const Reference< XPropertySet >& descriptor ) -{ -} -// ----------------------------------------------------------------------------- -void OTables::appendNew(const ::rtl::OUString& _rsNewTable) -{ - insertElement(_rsNewTable,NULL); - - // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any()); - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); - while (aListenerLoop.hasMoreElements()) - static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getColumnSqlType(const Reference<XPropertySet>& _rxColProp) -{ - ::rtl::OUString sSql; - sal_Int32 nDataType = 0; - _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nDataType; - switch(nDataType) - { - case DataType::VARBINARY: - sSql += ::rtl::OUString::createFromAscii("VAR"); - /* run through*/ - case DataType::BINARY: - sSql += ::rtl::OUString::createFromAscii("CHAR"); - break; - default: - { - Any aTypeName = _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); - if(aTypeName.hasValue() && getString(aTypeName).getLength()) - sSql += getString(aTypeName); - else - sSql += OTables::getTypeString(_rxColProp) + ::rtl::OUString::createFromAscii(" "); - } - } - - switch(nDataType) - { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::FLOAT: - case DataType::REAL: - sSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString::createFromAscii(")"); - break; - - case DataType::DECIMAL: - case DataType::NUMERIC: - sSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString::createFromAscii(",") - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) - + ::rtl::OUString::createFromAscii(")"); - break; - case DataType::BINARY: - case DataType::VARBINARY: - sSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString::createFromAscii(") BYTE"); - break; - } - return sSql; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getColumnSqlNotNullDefault(const Reference<XPropertySet>& _rxColProp) -{ - OSL_ENSURE(_rxColProp.is(),"OTables::getColumnSqlNotNullDefault: Column is null!"); - ::rtl::OUString sSql; - ::rtl::OUString aDefault = getString(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); - if(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS) - { - sSql += ::rtl::OUString::createFromAscii(" NOT NULL"); - if(aDefault.getLength()) - sSql += ::rtl::OUString::createFromAscii(" WITH DEFAULT"); - } - else if(aDefault.getLength()) - { - sSql +=::rtl::OUString::createFromAscii(" DEFAULT '") + aDefault; - sSql += ::rtl::OUString::createFromAscii("'"); - } - return sSql; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getTypeString(const Reference< XPropertySet >& _rxColProp) -{ - ::rtl::OUString aValue; - switch(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) - { - case DataType::BIT: - aValue = ::rtl::OUString::createFromAscii("BOOLEAN"); - break; - case DataType::TINYINT: - aValue = ::rtl::OUString::createFromAscii("SMALLINT"); - break; - case DataType::SMALLINT: - aValue = ::rtl::OUString::createFromAscii("SMALLINT"); - break; - case DataType::INTEGER: - aValue = ::rtl::OUString::createFromAscii("INT"); - break; - case DataType::FLOAT: - aValue = ::rtl::OUString::createFromAscii("FLOAT"); - break; - case DataType::REAL: - aValue = ::rtl::OUString::createFromAscii("REAL"); - break; - case DataType::DOUBLE: - aValue = ::rtl::OUString::createFromAscii("DOUBLE"); - break; - case DataType::NUMERIC: - aValue = ::rtl::OUString::createFromAscii("DECIMAL"); - break; - case DataType::DECIMAL: - aValue = ::rtl::OUString::createFromAscii("DECIMAL"); - break; - case DataType::CHAR: - aValue = ::rtl::OUString::createFromAscii("CHAR"); - break; - case DataType::VARCHAR: - aValue = ::rtl::OUString::createFromAscii("VARCHAR"); - break; - case DataType::LONGVARCHAR: - aValue = ::rtl::OUString::createFromAscii("LONG VARCHAR"); - break; - case DataType::DATE: - aValue = ::rtl::OUString::createFromAscii("DATE"); - break; - case DataType::TIME: - aValue = ::rtl::OUString::createFromAscii("TIME"); - break; - case DataType::TIMESTAMP: - aValue = ::rtl::OUString::createFromAscii("TIMESTAMP"); - break; - case DataType::BINARY: - aValue = ::rtl::OUString::createFromAscii("CHAR () BYTE"); - break; - case DataType::VARBINARY: - aValue = ::rtl::OUString::createFromAscii("VARCHAR () BYTE"); - break; - case DataType::LONGVARBINARY: - aValue = ::rtl::OUString::createFromAscii("LONG BYTE"); - break; - } - return aValue; -} // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MTables.hxx b/connectivity/source/drivers/mozab/MTables.hxx index b9f7ad15b613..d5e3dab10101 100644 --- a/connectivity/source/drivers/mozab/MTables.hxx +++ b/connectivity/source/drivers/mozab/MTables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MTables.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,9 +78,6 @@ namespace connectivity protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); - void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); public: OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) @@ -89,27 +86,6 @@ namespace connectivity // only the name is identical to ::cppu::OComponentHelper virtual void SAL_CALL disposing(void); - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); - void appendNew(const ::rtl::OUString& _rsNewTable); - // some helper functions - /** - returns a sql string which contains the column definition part for create or alter statements - */ - static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); - /** - returns the "not null" part or the default part of the table statement - */ - static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); - /** - returns the corresponding typename - can contain () which have to filled with values - */ - static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); }; } } diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 74fa1f30d6af..24ead1dca021 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OConnection.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: oj $ $Date: 2001-10-08 07:17:46 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,7 +115,7 @@ OConnection::OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver) : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this), m_pDriverHandleCopy(_pDriverHandle), m_pDriver(_pDriver), - m_bClosed(sal_False), + m_bClosed(sal_True), m_xMetaData(NULL), m_bUseCatalog(sal_False), m_bUseOldDateFormat(sal_False), @@ -192,6 +192,8 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) return nSQLRETURN; + m_bClosed = sal_False; + #endif //LINUX try @@ -217,7 +219,6 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int //----------------------------------------------------------------------------- SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) { - osl_incrementInterlockedCount( &m_refCount ); m_aConnectionHandle = SQL_NULL_HANDLE; m_aURL = url; m_aInfo = info; @@ -296,7 +297,6 @@ SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< Prop else if(SQL_SUCCESS_WITH_INFO == nSQLRETURN) // this driver does not support odbc3 { } - osl_decrementInterlockedCount( &m_refCount ); return nSQLRETURN; } // XServiceInfo @@ -588,7 +588,8 @@ void OConnection::disposing() ::std::map< SQLHANDLE,OConnection*>().swap(m_aConnections); - OTools::ThrowException(this,N3SQLDisconnect(m_aConnectionHandle),m_aConnectionHandle,SQL_HANDLE_DBC,*this); + if(!m_bClosed) + N3SQLDisconnect(m_aConnectionHandle); m_bClosed = sal_True; m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>(); @@ -634,9 +635,14 @@ SQLHANDLE OConnection::createStatementHandle() void OConnection::freeStatementHandle(SQLHANDLE& _pHandle) { ::std::map< SQLHANDLE,OConnection*>::iterator aFind = m_aConnections.find(_pHandle); + + N3SQLFreeStmt(_pHandle,SQL_RESET_PARAMS); + N3SQLFreeStmt(_pHandle,SQL_UNBIND); N3SQLFreeStmt(_pHandle,SQL_CLOSE); N3SQLFreeHandle(SQL_HANDLE_STMT,_pHandle); + _pHandle = SQL_NULL_HANDLE; + if(aFind != m_aConnections.end()) { aFind->second->dispose(); diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx index 2dc24483cf92..f7692f4ed003 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ODatabaseMetaData.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: oj $ $Date: 2001-10-08 07:17:46 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,7 @@ #ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ #include "odbc/OFunctiondefs.hxx" #endif +#include "stdio.h" using namespace connectivity::odbc; @@ -90,6 +91,25 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; +#define BEGIN_TRANS \ + try \ + { \ + m_pConnection->createStatement()->execute(::rtl::OUString::createFromAscii("SUBTRANS BEGIN")); \ + } \ + catch(Exception&) \ + { \ + printf("Exception occurced begin trans!\n");\ + } + +#define END_TRANS \ + try \ + { \ + m_pConnection->createStatement()->execute(::rtl::OUString::createFromAscii("SUBTRANS END"));\ + } \ + catch(Exception&) \ + { \ + printf("Exception occurced end trans!\n");\ + } ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon) : ::connectivity::ODatabaseMetaDataBase(_pCon) @@ -121,14 +141,17 @@ ODatabaseMetaData::~ODatabaseMetaData() // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openTypeInfo(); + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) { + BEGIN_TRANS Reference< XResultSet > xRef; if(!m_bUseCatalog) { @@ -142,6 +165,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLExc xRef = pResult; pResult->openCatalogs(); } + END_TRANS return xRef; } // ------------------------------------------------------------------------- @@ -157,69 +181,76 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLExc // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openSchemas(); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) @@ -309,57 +340,63 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLExceptio Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( @@ -367,11 +404,12 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( const ::rtl::OUString& primaryTable, const Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) { + BEGIN_TRANS ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection); Reference< XResultSet > xRef = pResult; pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable, m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) @@ -640,6 +678,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) { + BEGIN_TRANS // there exists no possibility to get table types so we have to check static ::rtl::OUString sTableTypes[] = { @@ -670,7 +709,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE aRows.push_back(aRow); } pResult->setRows(aRows); - return xRef; + END_TRANS return xRef; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index d09ad4ef6a72..a216eab78dcf 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OStatement.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: oj $ $Date: 2001-10-02 13:12:31 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:48:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,6 +158,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) // ----------------------------------------------------------------------------- OStatement_Base::~OStatement_Base() { + OSL_ENSURE(!m_aStatementHandle,"Sohould ne null here!"); } //------------------------------------------------------------------------------ void OStatement_Base::disposeResultSet() @@ -168,23 +169,30 @@ void OStatement_Base::disposeResultSet() xComp->dispose(); m_xResultSet = Reference< XResultSet>(); } -//------------------------------------------------------------------------------ -void OStatement_BASE2::disposing() +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::disposing(void) { ::osl::MutexGuard aGuard(m_aMutex); disposeResultSet(); OSL_ENSURE(m_aStatementHandle,"OStatement_BASE2::disposing: StatementHandle is null!"); - N3SQLFreeStmt(m_aStatementHandle,SQL_RESET_PARAMS); - N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND); - if (m_pConnection) { m_pConnection->freeStatementHandle(m_aStatementHandle); m_pConnection->release(); m_pConnection = NULL; } + OSL_ENSURE(!m_aStatementHandle,"Sohould ne null here!"); + + OStatement_BASE::disposing(); +} +//------------------------------------------------------------------------------ +void OStatement_BASE2::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + dispose_ChildImpl(); OStatement_Base::disposing(); diff --git a/connectivity/source/inc/adabas/BColumns.hxx b/connectivity/source/inc/adabas/BColumns.hxx index d92f05ee1a72..f17e5a0c99a4 100644 --- a/connectivity/source/inc/adabas/BColumns.hxx +++ b/connectivity/source/inc/adabas/BColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BColumns.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,6 +87,9 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OColumns( OAdabasTable* _pTable, ::osl::Mutex& _rMutex, @@ -94,12 +97,6 @@ namespace connectivity ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) ,m_pTable(_pTable) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/adabas/BGroups.hxx b/connectivity/source/inc/adabas/BGroups.hxx index c400906ff75f..af42801c273a 100644 --- a/connectivity/source/inc/adabas/BGroups.hxx +++ b/connectivity/source/inc/adabas/BGroups.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BGroups.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,9 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OGroups(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -92,12 +95,6 @@ namespace connectivity ,m_pConnection(_pConnection) ,m_pParent(_pParent) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/adabas/BIndexColumns.hxx b/connectivity/source/inc/adabas/BIndexColumns.hxx index 801860bbfb10..9b6314633f53 100644 --- a/connectivity/source/inc/adabas/BIndexColumns.hxx +++ b/connectivity/source/inc/adabas/BIndexColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BIndexColumns.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,10 +79,9 @@ namespace connectivity protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) - { - m_pIndex->refreshColumns(); - } + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); public: OIndexColumns( OAdabasIndex* _pIndex, ::osl::Mutex& _rMutex, diff --git a/connectivity/source/inc/adabas/BIndexes.hxx b/connectivity/source/inc/adabas/BIndexes.hxx index 75637cc4c701..f798faa6d243 100644 --- a/connectivity/source/inc/adabas/BIndexes.hxx +++ b/connectivity/source/inc/adabas/BIndexes.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BIndexes.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,9 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OIndexes(OAdabasTable* _pTable, ::osl::Mutex& _rMutex, @@ -88,12 +91,6 @@ namespace connectivity ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) ,m_pTable(_pTable) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/adabas/BKeys.hxx b/connectivity/source/inc/adabas/BKeys.hxx index f3fe58638963..0572ae190b52 100644 --- a/connectivity/source/inc/adabas/BKeys.hxx +++ b/connectivity/source/inc/adabas/BKeys.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BKeys.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,6 +82,9 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OKeys(OAdabasTable* _pTable, ::osl::Mutex& _rMutex, @@ -93,12 +96,6 @@ namespace connectivity virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); //XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/adabas/BTables.hxx b/connectivity/source/inc/adabas/BTables.hxx index e20f9e052e2d..773c7ac87a0e 100644 --- a/connectivity/source/inc/adabas/BTables.hxx +++ b/connectivity/source/inc/adabas/BTables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BTables.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-07-06 08:12:35 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,11 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); public: @@ -90,11 +95,7 @@ namespace connectivity // only the name is identical to ::cppu::OComponentHelper virtual void SAL_CALL disposing(void); - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); // XDrop - 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); void appendNew(const ::rtl::OUString& _rsNewTable); // some helper functions /** diff --git a/connectivity/source/inc/adabas/BUsers.hxx b/connectivity/source/inc/adabas/BUsers.hxx index 153518e3d4b2..2f178d112ee5 100644 --- a/connectivity/source/inc/adabas/BUsers.hxx +++ b/connectivity/source/inc/adabas/BUsers.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BUsers.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:54 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,6 +82,9 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OUsers( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -92,11 +95,6 @@ namespace connectivity ,m_pParent(_pParent) {} - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/adabas/BViews.hxx b/connectivity/source/inc/adabas/BViews.hxx index 98bc9a438763..f608c9ea0848 100644 --- a/connectivity/source/inc/adabas/BViews.hxx +++ b/connectivity/source/inc/adabas/BViews.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BViews.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-06-01 09:51:57 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:59:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,10 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + void createView( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); public: OViews(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -89,11 +93,6 @@ namespace connectivity // only the name is identical to ::cppu::OComponentHelper virtual void SAL_CALL disposing(void); - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); void appendNew(const ::rtl::OUString& _rsNewTable); void dropByNameImpl(const ::rtl::OUString& elementName); }; diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx index 9d9346d5a395..215a98b3765e 100644 --- a/connectivity/source/inc/ado/AColumns.hxx +++ b/connectivity/source/inc/ado/AColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AColumns.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:53 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,10 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OColumns( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -109,11 +113,6 @@ namespace connectivity m_pCollection->Release(); } - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/ado/AGroups.hxx b/connectivity/source/inc/ado/AGroups.hxx index b7c0b0b833e0..491d42faa2cb 100644 --- a/connectivity/source/inc/ado/AGroups.hxx +++ b/connectivity/source/inc/ado/AGroups.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AGroups.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-06-20 07:14:12 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,9 +87,13 @@ namespace connectivity OCatalog* m_pCatalog; protected: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OGroups(OCatalog* _pParent, ::osl::Mutex& _rMutex, @@ -107,11 +111,6 @@ namespace connectivity if(m_pCollection) m_pCollection->Release(); } - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx index 4f202646f1d7..3df15225422e 100644 --- a/connectivity/source/inc/ado/AIndexes.hxx +++ b/connectivity/source/inc/ado/AIndexes.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AIndexes.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,6 +84,10 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OIndexes(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -104,12 +108,6 @@ namespace connectivity if(m_pCollection) m_pCollection->Release(); } - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx index df3aafb01e07..d61af72745be 100644 --- a/connectivity/source/inc/ado/AKeys.hxx +++ b/connectivity/source/inc/ado/AKeys.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AKeys.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,10 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OKeys(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -102,12 +106,6 @@ namespace connectivity if(m_pCollection) m_pCollection->Release(); } - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx index cace72bff505..fe657853bc68 100644 --- a/connectivity/source/inc/ado/ATables.hxx +++ b/connectivity/source/inc/ado/ATables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ATables.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,10 @@ namespace connectivity virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OTables(OCatalog* _pParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector, @@ -102,12 +106,6 @@ namespace connectivity if(m_pCollection) m_pCollection->Release(); } - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/ado/AUsers.hxx b/connectivity/source/inc/ado/AUsers.hxx index 239b788ef8be..3bada30f4ad3 100644 --- a/connectivity/source/inc/ado/AUsers.hxx +++ b/connectivity/source/inc/ado/AUsers.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AUsers.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-06-20 07:14:12 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,9 +86,13 @@ namespace connectivity ADOUsers* m_pCollection; OCatalog* m_pCatalog; public: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OUsers( OCatalog* _pParent, ::osl::Mutex& _rMutex, @@ -106,12 +110,6 @@ namespace connectivity if(m_pCollection) m_pCollection->Release(); } - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/ado/AViews.hxx b/connectivity/source/inc/ado/AViews.hxx index 9ff3e49a37aa..297efa355499 100644 --- a/connectivity/source/inc/ado/AViews.hxx +++ b/connectivity/source/inc/ado/AViews.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AViews.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:32 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:57:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,10 +83,14 @@ namespace connectivity ADOViews* m_pCollection; OCatalog* m_pCatalog; protected: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); - void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + // return a object which is the copy of the descriptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: OViews(OCatalog* _pParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector, @@ -103,12 +107,6 @@ namespace connectivity if(m_pCollection) m_pCollection->Release(); } - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/calc/CColumns.hxx b/connectivity/source/inc/calc/CColumns.hxx index eb9063a12fb7..7596151eaab3 100644 --- a/connectivity/source/inc/calc/CColumns.hxx +++ b/connectivity/source/inc/calc/CColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CColumns.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:31 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,8 +74,6 @@ namespace connectivity { protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OCalcColumns(file::OFileTable* _pTable, ::osl::Mutex& _rMutex, diff --git a/connectivity/source/inc/calc/CTables.hxx b/connectivity/source/inc/calc/CTables.hxx index 71360832a76b..057e0f5db676 100644 --- a/connectivity/source/inc/calc/CTables.hxx +++ b/connectivity/source/inc/calc/CTables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CTables.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:31 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,20 +76,10 @@ namespace connectivity { protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OCalcTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector) : OCalcTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) {} - - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/dbase/DColumns.hxx b/connectivity/source/inc/dbase/DColumns.hxx index e4f322440953..f5c886ccc3d7 100644 --- a/connectivity/source/inc/dbase/DColumns.hxx +++ b/connectivity/source/inc/dbase/DColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DColumns.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:30 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,18 +76,15 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: ODbaseColumns(file::OFileTable* _pTable, ::osl::Mutex& _rMutex, const TStringVector &_rVector ) : file::OColumns(_pTable,_rMutex,_rVector) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/dbase/DIndexColumns.hxx b/connectivity/source/inc/dbase/DIndexColumns.hxx index edec051f2cca..44b41e436f35 100644 --- a/connectivity/source/inc/dbase/DIndexColumns.hxx +++ b/connectivity/source/inc/dbase/DIndexColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndexColumns.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:30 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,8 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); public: ODbaseIndexColumns( ODbaseIndex* _pIndex, ::osl::Mutex& _rMutex, diff --git a/connectivity/source/inc/dbase/DIndexes.hxx b/connectivity/source/inc/dbase/DIndexes.hxx index efdbf659bc79..f4c4fc5f2c0e 100644 --- a/connectivity/source/inc/dbase/DIndexes.hxx +++ b/connectivity/source/inc/dbase/DIndexes.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndexes.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:30 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,18 +84,14 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: ODbaseIndexes(ODbaseTable* _pTable, ::osl::Mutex& _rMutex, const TStringVector &_rVector) : ODbaseIndexes_BASE(*_pTable,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) , m_pTable(_pTable) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); - }; } } diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index 4ee6d1c26b9d..409d1b30e13b 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.hxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:50 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,6 +158,7 @@ namespace connectivity void AllocBuffer(); void throwInvalidDbaseFormat(); + void SAL_CALL renameImpl( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); protected: virtual void FileClose(); diff --git a/connectivity/source/inc/dbase/DTables.hxx b/connectivity/source/inc/dbase/DTables.hxx index 91fee1c22d0c..77925ad6693f 100644 --- a/connectivity/source/inc/dbase/DTables.hxx +++ b/connectivity/source/inc/dbase/DTables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DTables.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:30 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:54:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,18 +79,15 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > cloneObject(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); public: ODbaseTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector) : ODbaseTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) {} virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/file/FColumns.hxx b/connectivity/source/inc/file/FColumns.hxx index 66e1d8322083..c2e378ee3ed9 100644 --- a/connectivity/source/inc/file/FColumns.hxx +++ b/connectivity/source/inc/file/FColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FColumns.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-05-25 07:45:31 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,7 +86,6 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OColumns( OFileTable* _pTable, ::osl::Mutex& _rMutex, diff --git a/connectivity/source/inc/file/FTables.hxx b/connectivity/source/inc/file/FTables.hxx index c3594ac57ca1..483e3a55100f 100644 --- a/connectivity/source/inc/file/FTables.hxx +++ b/connectivity/source/inc/file/FTables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FTables.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-18 08:31:17 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,7 +80,6 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector) : sdbcx::OCollection(_rParent,_rMetaData->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) diff --git a/connectivity/source/inc/flat/EColumns.hxx b/connectivity/source/inc/flat/EColumns.hxx index 5a4178496f34..9880a0adb42d 100644 --- a/connectivity/source/inc/flat/EColumns.hxx +++ b/connectivity/source/inc/flat/EColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: EColumns.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:28 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,8 +74,6 @@ namespace connectivity { protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OFlatColumns(file::OFileTable* _pTable, ::osl::Mutex& _rMutex, diff --git a/connectivity/source/inc/flat/ETables.hxx b/connectivity/source/inc/flat/ETables.hxx index e2de535c4f44..6e7e4485b623 100644 --- a/connectivity/source/inc/flat/ETables.hxx +++ b/connectivity/source/inc/flat/ETables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ETables.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:27 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,18 +77,10 @@ namespace connectivity { protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OFlatTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector) : OFlatTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) {} - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/mozaddressbook/MABColumns.hxx b/connectivity/source/inc/mozaddressbook/MABColumns.hxx index 82954f8468d4..b89214f821de 100644 --- a/connectivity/source/inc/mozaddressbook/MABColumns.hxx +++ b/connectivity/source/inc/mozaddressbook/MABColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MABColumns.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dkenny $ $Date: 2001-05-28 22:02:59 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,8 +74,6 @@ namespace connectivity { protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OMozabColumns(file::OFileTable* _pTable, ::osl::Mutex& _rMutex, diff --git a/connectivity/source/inc/mozaddressbook/MABTables.hxx b/connectivity/source/inc/mozaddressbook/MABTables.hxx index 7ffc651ca0c3..47b4cad7c313 100644 --- a/connectivity/source/inc/mozaddressbook/MABTables.hxx +++ b/connectivity/source/inc/mozaddressbook/MABTables.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MABTables.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dkenny $ $Date: 2001-05-28 22:02:59 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,20 +76,10 @@ namespace connectivity { protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); - virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); public: OMozabTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< ::rtl::OUString> &_rVector) : OMozabTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) {} - - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - - // XAppend - virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - // XDrop - 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); }; } } diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx index 510ba3b1705d..bbd8d1d2afb4 100644 --- a/connectivity/source/inc/odbc/OStatement.hxx +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -2,9 +2,9 @@ * * $RCSfile: OStatement.hxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: oj $ $Date: 2001-09-18 11:22:27 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -222,7 +222,7 @@ namespace connectivity return m_pConnection->getOdbcFunction(_nIndex); } // OComponentHelper - virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();} + virtual void SAL_CALL disposing(void); // XInterface virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException); diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx index 23f3b8db3f53..37d836c52c23 100644 --- a/connectivity/source/sdbcx/VCollection.cxx +++ b/connectivity/source/sdbcx/VCollection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VCollection.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: oj $ $Date: 2001-09-25 13:12:51 $ + * last change: $Author: oj $ $Date: 2001-10-12 11:53:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,7 +101,7 @@ OCollection::OCollection(::cppu::OWeakObject& _rParent,sal_Bool _bCase, ::osl::M { m_aElements.reserve(_rVector.size()); for(TStringVector::const_iterator i=_rVector.begin(); i != _rVector.end();++i) - m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(*i,WeakReference< ::com::sun::star::container::XNamed >()))); + m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(*i,WeakReference< XNamed >()))); } // ------------------------------------------------------------------------- OCollection::~OCollection() @@ -127,17 +127,10 @@ void OCollection::disposing(void) m_aRefreshListeners.disposeAndClear(EventObject(static_cast<XWeak*>(this))); ::osl::MutexGuard aGuard(m_rMutex); - for( ObjectIter aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) - { - if(aIter->second.is()) - { - ::comphelper::disposeComponent(aIter->second); - (*aIter).second = NULL; - } - } -// m_aElements.clear(); -// m_aNameMap.clear(); -// + + + disposeElements(); + ::std::vector< ObjectIter >().swap(m_aElements); ObjectMap().swap(m_aNameMap); } @@ -145,25 +138,11 @@ void OCollection::disposing(void) Any SAL_CALL OCollection::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - if (Index < 0 || Index >= m_aNameMap.size()) + if (Index < 0 || Index >= static_cast<sal_Int32>(m_aNameMap.size())) throw IndexOutOfBoundsException(::rtl::OUString::valueOf(Index),*this); ObjectIter aIter = m_aElements[Index]; - Reference< XNamed > xName = (*aIter).second; - if(!(*aIter).second.is()) - { - try - { - xName = createObject((*aIter).first); - } - catch(const SQLException& e) - { - throw WrappedTargetException(e.Message,*this,makeAny(e)); - } - (*aIter).second = xName; - } - - return makeAny(xName); + return makeAny(getObject(aIter)); } // ------------------------------------------------------------------------- Any SAL_CALL OCollection::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) @@ -173,21 +152,7 @@ Any SAL_CALL OCollection::getByName( const ::rtl::OUString& aName ) throw(NoSuch ObjectIter aIter = m_aNameMap.find(aName); if(aIter == m_aNameMap.end()) throw NoSuchElementException(aName,*this); - Reference< XNamed > xName = (*aIter).second; - if(!(*aIter).second.is()) - { - try - { - xName = createObject(aIter->first); - } - catch(const SQLException& e) - { - throw WrappedTargetException(e.Message,*this,makeAny(e)); - } - (*aIter).second = xName; - } - - return makeAny(xName); + return makeAny(getObject(aIter)); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OCollection::getElementNames( ) throw(RuntimeException) @@ -196,11 +161,9 @@ Sequence< ::rtl::OUString > SAL_CALL OCollection::getElementNames( ) throw(Runt sal_Int32 nLen = m_aElements.size(); Sequence< ::rtl::OUString > aNameList(nLen); - sal_Int32 i=0; ::rtl::OUString* pStringArray = aNameList.getArray(); - // for( ::std::map< ::rtl::OUString, Object_BASE, ::comphelper::UStringLess> ::const_iterator aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) - for(::std::vector< ObjectIter >::const_iterator aIter = m_aElements.begin(); aIter != m_aElements.end();++aIter) - pStringArray[i++] = (*aIter)->first; + for(::std::vector< ObjectIter >::const_iterator aIter = m_aElements.begin(); aIter != m_aElements.end();++aIter,++pStringArray) + *pStringArray = (*aIter)->first; return aNameList; } @@ -208,16 +171,8 @@ Sequence< ::rtl::OUString > SAL_CALL OCollection::getElementNames( ) throw(Runt void SAL_CALL OCollection::refresh( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - for( ::std::map< ::rtl::OUString, Object_BASE, ::comphelper::UStringLess>::iterator aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) - { - if((*aIter).second.is()) - { - ::comphelper::disposeComponent(aIter->second); - (*aIter).second = Reference< XNamed >(); - } - } - m_aNameMap.clear(); - m_aElements.clear(); + + disposeElements(); impl_refresh(); EventObject aEvt(static_cast<XWeak*>(this)); @@ -230,7 +185,7 @@ void OCollection::reFill(const TStringVector &_rVector) m_aElements.reserve(_rVector.size()); for(TStringVector::const_iterator i=_rVector.begin(); i != _rVector.end();++i) - m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(*i,WeakReference< ::com::sun::star::container::XNamed >()))); + m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(*i,WeakReference< XNamed >()))); } // ------------------------------------------------------------------------- // XDataDescriptorFactory @@ -249,19 +204,23 @@ void SAL_CALL OCollection::appendByDescriptor( const Reference< XPropertySet >& Reference< XNamed > xName(descriptor,UNO_QUERY); if(xName.is()) { - if(m_aNameMap.find(xName->getName()) != m_aNameMap.end()) - throw ElementExistException(xName->getName(),*this); + ::rtl::OUString sName = xName->getName(); + if(m_aNameMap.find(sName) != m_aNameMap.end()) + throw ElementExistException(sName,*this); - Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + appendObject(descriptor); + Reference< XNamed > xNewName = cloneObject(descriptor); + Reference<XUnoTunnel> xTunnel(xNewName,UNO_QUERY); if(xTunnel.is()) { ODescriptor* pDescriptor = (ODescriptor*)xTunnel->getSomething(ODescriptor::getUnoTunnelImplementationId()); if(pDescriptor) pDescriptor->setNew(sal_False); } - m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(xName->getName(),WeakReference< XNamed >(xName)))); + + m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(sName,WeakReference< XNamed >(xNewName)))); // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(xName->getName()), makeAny(xName), Any()); + ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(sName), makeAny(xNewName), Any()); OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); while (aListenerLoop.hasMoreElements()) static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); @@ -281,19 +240,10 @@ void SAL_CALL OCollection::dropByName( const ::rtl::OUString& elementName ) thro { if(m_aElements[i] == aIter) { - ::comphelper::disposeComponent(aIter->second); - - m_aElements.erase(m_aElements.begin()+i); - m_aNameMap.erase(aIter); + dropImpl(i); break; // no duplicates possible } } - // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(elementName), Any(), Any()); - // note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); - while (aListenerLoop.hasMoreElements()) - static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent); } // ------------------------------------------------------------------------- void SAL_CALL OCollection::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) @@ -302,13 +252,27 @@ void SAL_CALL OCollection::dropByIndex( sal_Int32 index ) throw(SQLException, In if(index <0 || index >= getCount()) throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this); - ::comphelper::disposeComponent(m_aElements[index]->second); - ::rtl::OUString elementName = m_aElements[index]->first; - m_aNameMap.erase(m_aElements[index]); - m_aElements.erase(m_aElements.begin()+index); + dropImpl(index); +} +// ----------------------------------------------------------------------------- +void OCollection::dropImpl(sal_Int32 _nIndex) +{ + ::rtl::OUString elementName = m_aElements[_nIndex]->first; + + dropObject(_nIndex,elementName); + + ::comphelper::disposeComponent(m_aElements[_nIndex]->second); + + m_aNameMap.erase(m_aElements[_nIndex]); + m_aElements.erase(m_aElements.begin()+_nIndex); // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(elementName), Any(), Any()); + notifyElementRemoved(elementName); +} +// ----------------------------------------------------------------------------- +void OCollection::notifyElementRemoved(const ::rtl::OUString& _sName) +{ + ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_sName), Any(), Any()); // note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); while (aListenerLoop.hasMoreElements()) @@ -417,3 +381,55 @@ void OCollection::renameObject(const ::rtl::OUString _sOldName,const ::rtl::OUSt } } // ----------------------------------------------------------------------------- +Reference< XNamed > OCollection::getObject(ObjectIter& _rCurrentObject) +{ + Reference< XNamed > xName = (*_rCurrentObject).second; + if(!(*_rCurrentObject).second.is()) + { + try + { + xName = createObject((*_rCurrentObject).first); + } + catch(const SQLException& e) + { + throw WrappedTargetException(e.Message,*this,makeAny(e)); + } + (*_rCurrentObject).second = xName; + } + return xName; +} +// ----------------------------------------------------------------------------- +void OCollection::disposeElements() +{ + for( ObjectIter aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) + { + if(aIter->second.is()) + { + ::comphelper::disposeComponent(aIter->second); + (*aIter).second = NULL; + } + } + m_aNameMap.clear(); + m_aElements.clear(); +} +// ----------------------------------------------------------------------------- +Reference< XPropertySet > OCollection::createEmptyObject() +{ + OSL_ASSERT(!"Need to be overloaded when used!"); + throw SQLException(); +} +// ----------------------------------------------------------------------------- +void OCollection::appendObject( const Reference< XPropertySet >& descriptor ) +{ +} +// ----------------------------------------------------------------------------- +Reference< XNamed > OCollection::cloneObject(const Reference< XPropertySet >& _xDescriptor) +{ + OSL_ASSERT(!"Need to be overloaded when used!"); + throw SQLException(); +} +// ----------------------------------------------------------------------------- +void OCollection::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) +{ +} +// ----------------------------------------------------------------------------- |