Tag: cws_src680_hsqlcsv User: fs Date: 2006/10/19 03:11:48 Modified: dba/connectivity/source/drivers/hsqldb/HTable.cxx
Log: small refactoring during #i69526# File Changes: Directory: /dba/connectivity/source/drivers/hsqldb/ =================================================== File [changed]: HTable.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HTable.cxx?r1=1.10&r2=1.10.12.1 Delta lines: +52 -22 --------------------- --- HTable.cxx 17 Sep 2006 02:41:11 -0000 1.10 +++ HTable.cxx 19 Oct 2006 10:11:45 -0000 1.10.12.1 @@ -4,9 +4,9 @@ * * $RCSfile: HTable.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.10.12.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 02:41:11 $ + * last change: $Author: fs $ $Date: 2006/10/19 10:11:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -94,10 +94,19 @@ #include "hsqldb/HCatalog.hxx" #endif #include "hsqldb/HColumns.hxx" +#ifndef HSQLCSV_HTEXTTABLE_HXX +#include "hsqldb/HTextTable.hxx" +#endif #ifndef CONNECTIVITY_CONNECTION_HXX #include "TConnection.hxx" #endif +#ifndef COMPHELPER_TYPEBAG_HXX +#include <comphelper/typebag.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif using namespace ::comphelper; using namespace connectivity::hsqldb; @@ -113,6 +122,7 @@ OHSQLTable::OHSQLTable( sdbcx::OCollection* _pTables, const Reference< XConnection >& _xConnection) :OTableHelper(_pTables,_xConnection,sal_True) + ,m_nPrivileges( 0 ) { // we create a new table here, so we should have all the rights or ;-) m_nPrivileges = Privilege::DROP | @@ -143,7 +153,7 @@ _Description, _SchemaName, _CatalogName) - , m_nPrivileges(_nPrivileges) + ,m_nPrivileges(_nPrivileges) { construct(); } @@ -154,6 +164,7 @@ if ( !isNew() ) registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES), PROPERTY_ID_PRIVILEGES,PropertyAttribute::READONLY,&m_nPrivileges, ::getCppuType(&m_nPrivileges)); } + // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OHSQLTable::createArrayHelper( sal_Int32 /*_nId*/ ) const { @@ -383,25 +394,29 @@ // ----------------------------------------------------------------------------- Sequence< Type > SAL_CALL OHSQLTable::getTypes( ) throw(RuntimeException) { - if ( ! m_Type.compareToAscii("VIEW") ) - { - Sequence< Type > aTypes = OTableHelper::getTypes(); - ::std::vector<Type> aOwnTypes; - aOwnTypes.reserve(aTypes.getLength()); - const Type* pIter = aTypes.getConstArray(); - const Type* pEnd = pIter + aTypes.getLength(); - for(;pIter != pEnd;++pIter) + TypeBag aTypes( OTableHelper::getTypes() ); + + if ( !m_Type.compareToAscii("VIEW") ) + aTypes.erase( ::cppu::UnoType< XRename >::get() ); + + return aTypes.getAsSequence(); +} +// ----------------------------------------------------------------------------- +Sequence< sal_Int8 > SAL_CALL OHSQLTable::getImplementationId() throw (RuntimeException) +{ + static ::cppu::OImplementationId* pId = NULL; + if ( !pId ) { - if( *pIter != ::getCppuType((const Reference<XRename>*)0) ) + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pId ) { - aOwnTypes.push_back(*pIter); - } + static ::cppu::OImplementationId aId; + pId = &aId; } - Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; - return Sequence< Type >(pTypes, aOwnTypes.size()); } - return OTableHelper::getTypes(); + return pId->getImplementationId(); } + // ------------------------------------------------------------------------- // XRename void SAL_CALL OHSQLTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException) @@ -443,12 +458,27 @@ } // ------------------------------------------------------------------------- -Any SAL_CALL OHSQLTable::queryInterface( const Type & rType ) throw(RuntimeException) +void SAL_CALL OHSQLTable::acquire() throw() { - if( !m_Type.compareToAscii("VIEW") && rType == ::getCppuType((const Reference<XRename>*)0) ) - return Any(); + OTableHelper::acquire(); +} - return OTableHelper::queryInterface(rType); +// ------------------------------------------------------------------------- +void SAL_CALL OHSQLTable::release() throw() +{ + OTableHelper::acquire(); } + // ------------------------------------------------------------------------- +Any SAL_CALL OHSQLTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aInterface; + bool bIsRenameForView = ( 0 == m_Type.compareToAscii( "VIEW" ) ) && rType.equals( ::cppu::UnoType< XRename >::get() ); + if( !bIsRenameForView ) + // renaming of VIEWs not supported + aInterface = OTableHelper::queryInterface( rType ); + return aInterface; +} + +// ------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
