Tag: cws_src680_dba24c User: fs Date: 2007-09-20 18:35:36+0000 Modified: dba/dbaccess/source/sdbtools/connection/connectiondependent.hxx dba/dbaccess/source/sdbtools/connection/connectiontools.cxx dba/dbaccess/source/sdbtools/connection/connectiontools.hxx dba/dbaccess/source/sdbtools/connection/datasourcemetadata.cxx dba/dbaccess/source/sdbtools/connection/datasourcemetadata.hxx dba/dbaccess/source/sdbtools/connection/objectnames.cxx dba/dbaccess/source/sdbtools/connection/objectnames.hxx dba/dbaccess/source/sdbtools/connection/tablename.cxx dba/dbaccess/source/sdbtools/connection/tablename.hxx
Log: #i80856# some error strings now taken from ::connectivity::SQLError, using the new css.sdb.ErrorCondition File Changes: Directory: /dba/dbaccess/source/sdbtools/connection/ ==================================================== File [changed]: connectiondependent.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/connectiondependent.hxx?r1=1.2&r2=1.2.184.1 Delta lines: +13 -13 --------------------- --- connectiondependent.hxx 2006-07-10 15:18:38+0000 1.2 +++ connectiondependent.hxx 2007-09-20 18:35:33+0000 1.2.184.1 @@ -4,9 +4,9 @@ * * $RCSfile: connectiondependent.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.184.1 $ * - * last change: $Author: obo $ $Date: 2006/07/10 15:18:38 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,21 +37,13 @@ #define DBACCESS_CONNECTION_DEPENDENT_HXX /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif /** === end UNO includes === **/ -#ifndef _OSL_MUTEX_HXX_ -#include <osl/mutex.hxx> -#endif - -#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <comphelper/componentcontext.hxx> #include <cppuhelper/weakref.hxx> -#endif +#include <osl/mutex.hxx> //........................................................................ namespace sdbtools @@ -67,6 +59,8 @@ mutable ::osl::Mutex m_aMutex; ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > m_aConnection; + ::comphelper::ComponentContext + m_aContext; /** a hard reference to the connection we're working for @@ -80,11 +74,17 @@ protected: ::osl::Mutex& getMutex() const { return m_aMutex; } + const ::comphelper::ComponentContext& + getContext() const { return m_aContext; } + protected: class EntryGuard; protected: - ConnectionDependentComponent() { } + ConnectionDependentComponent( const ::comphelper::ComponentContext& _rContext ) + :m_aContext( _rContext ) + { + } /** sets the connection we depend on. File [changed]: connectiontools.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/connectiontools.cxx?r1=1.3&r2=1.3.142.1 Delta lines: +9 -9 ------------------- --- connectiontools.cxx 2006-09-17 06:49:31+0000 1.3 +++ connectiontools.cxx 2007-09-20 18:35:33+0000 1.3.142.1 @@ -4,9 +4,9 @@ * * $RCSfile: connectiontools.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.142.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 06:49:31 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -88,8 +88,8 @@ //= ConnectionTools //==================================================================== //-------------------------------------------------------------------- - ConnectionTools::ConnectionTools( const Reference< XComponentContext >& _rxContext ) - :m_aContext( _rxContext ) + ConnectionTools::ConnectionTools( const ::comphelper::ComponentContext& _rContext ) + :ConnectionDependentComponent( _rContext ) { } @@ -102,21 +102,21 @@ Reference< XTableName > SAL_CALL ConnectionTools::createTableName() throw (RuntimeException) { EntryGuard aGuard( *this ); - return new TableName( getConnection() ); + return new TableName( getContext(), getConnection() ); } //-------------------------------------------------------------------- Reference< XObjectNames > SAL_CALL ConnectionTools::getObjectNames() throw (RuntimeException) { EntryGuard aGuard( *this ); - return new ObjectNames( getConnection() ); + return new ObjectNames( getContext(), getConnection() ); } //-------------------------------------------------------------------- Reference< XDataSourceMetaData > SAL_CALL ConnectionTools::getDataSourceMetaData() throw (RuntimeException) { EntryGuard aGuard( *this ); - return new DataSourceMetaData( getConnection() ); + return new DataSourceMetaData( getContext(), getConnection() ); } //-------------------------------------------------------------------- @@ -157,7 +157,7 @@ //-------------------------------------------------------------------- Reference< XInterface > SAL_CALL ConnectionTools::Create(const Reference< XComponentContext >& _rxContext ) { - return *( new ConnectionTools( _rxContext ) ); + return *( new ConnectionTools( ::comphelper::ComponentContext( _rxContext ) ) ); } //-------------------------------------------------------------------- File [changed]: connectiontools.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/connectiontools.hxx?r1=1.2&r2=1.2.184.1 Delta lines: +5 -7 ------------------- --- connectiontools.hxx 2006-07-10 15:19:06+0000 1.2 +++ connectiontools.hxx 2007-09-20 18:35:33+0000 1.2.184.1 @@ -4,9 +4,9 @@ * * $RCSfile: connectiontools.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.184.1 $ * - * last change: $Author: obo $ $Date: 2006/07/10 15:19:06 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -85,17 +85,15 @@ ,public ConnectionDependentComponent { private: - ::comphelper::ComponentContext m_aContext; SdbtClient m_aModuleClient; public: /** constructs a ConnectionTools instance - @param _rxConnection - the connection on which the instance should operate. Must not be <NULL/>. - The connection will be held weak. + @param _rxContext + the context of the component */ - ConnectionTools( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); + ConnectionTools( const ::comphelper::ComponentContext& _rContext ); // XConnectionTools virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableName > SAL_CALL createTableName() throw (::com::sun::star::uno::RuntimeException); File [changed]: datasourcemetadata.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/datasourcemetadata.cxx?r1=1.3&r2=1.3.142.1 Delta lines: +6 -5 ------------------- --- datasourcemetadata.cxx 2006-09-17 06:49:46+0000 1.3 +++ datasourcemetadata.cxx 2007-09-20 18:35:33+0000 1.3.142.1 @@ -4,9 +4,9 @@ * * $RCSfile: datasourcemetadata.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.142.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 06:49:46 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -73,8 +73,9 @@ //= DataSourceMetaData //==================================================================== //-------------------------------------------------------------------- - DataSourceMetaData::DataSourceMetaData( const Reference< XConnection >& _rxConnection ) - :m_pImpl( new DataSourceMetaData_Impl ) + DataSourceMetaData::DataSourceMetaData( const ::comphelper::ComponentContext& _rContext, const Reference< XConnection >& _rxConnection ) + :ConnectionDependentComponent( _rContext ) + ,m_pImpl( new DataSourceMetaData_Impl ) { if ( !_rxConnection.is() ) throw NullPointerException(); File [changed]: datasourcemetadata.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/datasourcemetadata.hxx?r1=1.2&r2=1.2.184.1 Delta lines: +8 -3 ------------------- --- datasourcemetadata.hxx 2006-07-10 15:19:34+0000 1.2 +++ datasourcemetadata.hxx 2007-09-20 18:35:33+0000 1.2.184.1 @@ -4,9 +4,9 @@ * * $RCSfile: datasourcemetadata.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.184.1 $ * - * last change: $Author: obo $ $Date: 2006/07/10 15:19:34 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -73,12 +73,17 @@ public: /** constructs the instance + @param _rContext + the component's context @param _rxConnection the connection to work with. Will be held weak. Must not be <NULL/>. @throws ::com::sun::star::lang::NullPointerException if _rxConnection is <NULL/> */ - DataSourceMetaData( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection ); + DataSourceMetaData( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + ); // XDataSourceMetaData virtual ::sal_Bool SAL_CALL supportsQueriesInFrom( ) throw (::com::sun::star::uno::RuntimeException); File [changed]: objectnames.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/objectnames.cxx?r1=1.5&r2=1.5.58.1 Delta lines: +84 -93 --------------------- --- objectnames.cxx 2007-05-10 10:15:44+0000 1.5 +++ objectnames.cxx 2007-09-20 18:35:33+0000 1.5.58.1 @@ -4,9 +4,9 @@ * * $RCSfile: objectnames.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.5.58.1 $ * - * last change: $Author: kz $ $Date: 2007/05/10 10:15:44 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,34 +48,19 @@ #endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_LANG_NULLPOINTEREXCEPTION_HPP_ #include <com/sun/star/lang/NullPointerException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueriesSupplier.hpp> -#endif +#include <com/sun/star/sdb/ErrorCondition.hpp> /** === end UNO includes === **/ -#ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX #include <connectivity/dbmetadata.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif - -#ifndef _STRING_HXX -#include <tools/string.hxx> -#endif - -#ifndef _RTL_USTRBUF_HXX_ +#include <connectivity/sqlerror.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <rtl/ustrbuf.hxx> -#endif +#include <tools/string.hxx> #include <boost/shared_ptr.hpp> @@ -104,34 +89,7 @@ /** === end UNO using === **/ namespace CommandType = ::com::sun::star::sdb::CommandType; - - namespace - { - //---------------------------------------------------------------- - void lcl_throwNameIsUsedError( const ::rtl::OUString& _Name, const Reference< XConnection >& _Connection ) - { - String sNameIsUsed( SdbtRes( STR_NAME_ALREADY_USED_IN_DB ) ); - sNameIsUsed.SearchAndReplaceAllAscii( "$name$", _Name ); - - Any aDetails; - ::dbtools::DatabaseMetaData aMeta( _Connection ); - if ( aMeta.supportsSubqueriesInFrom() ) - { - String sNeedDistinctNames( SdbtRes( STR_QUERY_AND_TABLE_DISTINCT_NAMES ) ); - aDetails <<= SQLException( sNeedDistinctNames, _Connection, ::rtl::OUString(), 0, Any() ); - } - - ::dbtools::throwGenericSQLException( sNameIsUsed, _Connection, aDetails ); - } - - //---------------------------------------------------------------- - void lcl_throwNoSQLIdentifierError( const ::rtl::OUString& _Name, const Reference< XConnection >& _Connection ) - { - String sNoSQLIdentifier( SdbtRes( STR_NO_VALID_SQL_NAME ) ); - sNoSQLIdentifier.SearchAndReplaceAllAscii( "$name$", _Name ); - ::dbtools::throwGenericSQLException( sNoSQLIdentifier, _Connection, Any() ); - } - } + namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition; //==================================================================== //= INameValidation @@ -152,12 +110,14 @@ class PlainExistenceCheck : public INameValidation { private: + const ::comphelper::ComponentContext m_aContext; Reference< XConnection > m_xConnection; Reference< XNameAccess > m_xContainer; public: - PlainExistenceCheck( const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxContainer ) - :m_xConnection( _rxConnection ) + PlainExistenceCheck( const ::comphelper::ComponentContext& _rContext, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxContainer ) + :m_aContext( _rContext ) + ,m_xConnection( _rxConnection ) ,m_xContainer( _rxContainer ) { OSL_ENSURE( m_xContainer.is(), "PlainExistenceCheck::PlainExistenceCheck: this will crash!" ); @@ -171,8 +131,20 @@ virtual void validateName_throw( const ::rtl::OUString& _rName ) { - if ( !validateName( _rName ) ) - lcl_throwNameIsUsedError( _rName, m_xConnection ); + if ( validateName( _rName ) ) + return; + + ::connectivity::SQLError aErrors( m_aContext ); + SQLException aError( aErrors.getSQLException( ErrorCondition::DB_OBJECT_NAME_IS_USED, m_xConnection, _rName ) ); + + ::dbtools::DatabaseMetaData aMeta( m_xConnection ); + if ( aMeta.supportsSubqueriesInFrom() ) + { + String sNeedDistinctNames( SdbtRes( STR_QUERY_AND_TABLE_DISTINCT_NAMES ) ); + aError.NextException <<= SQLException( sNeedDistinctNames, m_xConnection, ::rtl::OUString(), 0, Any() ); + } + + throw aError; } }; @@ -181,11 +153,13 @@ //==================================================================== class TableValidityCheck : public INameValidation { - Reference< XConnection > m_xConnection; + const ::comphelper::ComponentContext m_aContext; + const Reference< XConnection > m_xConnection; public: - TableValidityCheck( const Reference< XConnection >& _rxConnection ) - :m_xConnection( _rxConnection ) + TableValidityCheck( const ::comphelper::ComponentContext& _rContext, const Reference< XConnection >& _rxConnection ) + :m_aContext( _rContext ) + ,m_xConnection( _rxConnection ) { } @@ -211,8 +185,11 @@ virtual void validateName_throw( const ::rtl::OUString& _rName ) { - if ( !validateName( _rName ) ) - lcl_throwNoSQLIdentifierError( _rName, m_xConnection ); + if ( validateName( _rName ) ) + return; + + ::connectivity::SQLError aErrors( m_aContext ); + aErrors.raiseException( ErrorCondition::DB_INVALID_SQL_NAME, m_xConnection, _rName ); } }; @@ -221,15 +198,17 @@ //==================================================================== class QueryValidityCheck : public INameValidation { - Reference< XConnection > m_xConnection; + const ::comphelper::ComponentContext m_aContext; + const Reference< XConnection > m_xConnection; public: - QueryValidityCheck( const Reference< XConnection >& _rxConnection ) - :m_xConnection( _rxConnection ) + QueryValidityCheck( const ::comphelper::ComponentContext& _rContext, const Reference< XConnection >& _rxConnection ) + :m_aContext( _rContext ) + ,m_xConnection( _rxConnection ) { } - inline USHORT validateName_getErrorResource( const ::rtl::OUString& _rName ) + inline ::connectivity::ErrorCondition validateName_getErrorCondition( const ::rtl::OUString& _rName ) { if ( ( _rName.indexOf( (sal_Unicode)34 ) >= 0 ) // " || ( _rName.indexOf( (sal_Unicode)39 ) >= 0 ) // ' @@ -238,28 +217,28 @@ || ( _rName.indexOf( (sal_Unicode)146 ) >= 0 ) // || ( _rName.indexOf( (sal_Unicode)180 ) >= 0 ) // ´ ) - return STR_NO_QUOTES_IN_QUERY_NAMES; + return ErrorCondition::DB_QUERY_NAME_WITH_QUOTES; if ( _rName.indexOf( '/') >= 0 ) - return STR_NO_SLASHES_IN_QUERY_NAMES; + return ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES; return 0; } virtual bool validateName( const ::rtl::OUString& _rName ) { - if ( validateName_getErrorResource( _rName ) != 0 ) + if ( validateName_getErrorCondition( _rName ) != 0 ) return false; return true; } virtual void validateName_throw( const ::rtl::OUString& _rName ) { - USHORT nErrorResource = validateName_getErrorResource( _rName ); - if ( nErrorResource != 0 ) + ::connectivity::ErrorCondition nErrorCondition = validateName_getErrorCondition( _rName ); + if ( nErrorCondition != 0 ) { - String sError = String( SdbtRes( nErrorResource ) ); - ::dbtools::throwGenericSQLException( sError, m_xConnection ); + ::connectivity::SQLError aErrors( m_aContext ); + aErrors.raiseException( nErrorCondition, m_xConnection ); } } }; @@ -302,6 +281,9 @@ public: /** creates an INameValidation instance which can be used to check the existence of query or table names + @param _rContext + the component's context + @param _nCommandType the type of objects (CommandType::TABLE or CommandType::QUERY) of which names shall be checked for existence @@ -314,10 +296,17 @@ @throws IllegalArgumentException if the given command type is neither CommandType::TABLE or CommandType::QUERY */ - static PNameValidation createExistenceCheck( sal_Int32 _nCommandType, const Reference< XConnection >& _rxConnection ); + static PNameValidation createExistenceCheck( + const ::comphelper::ComponentContext& _rContext, + sal_Int32 _nCommandType, + const Reference< XConnection >& _rxConnection + ); /** creates an INameValidation instance which can be used to check the validity of a query or table name + @param _rContext + the component's context + @param _nCommandType the type of objects (CommandType::TABLE or CommandType::QUERY) of which names shall be validated @@ -330,7 +319,11 @@ @throws IllegalArgumentException if the given command type is neither CommandType::TABLE or CommandType::QUERY */ - static PNameValidation createValidityCheck( sal_Int32 _nCommandType, const Reference< XConnection >& _rxConnection ); + static PNameValidation createValidityCheck( + const ::comphelper::ComponentContext& _rContext, + const sal_Int32 _nCommandType, + const Reference< XConnection >& _rxConnection + ); private: NameCheckFactory(); // never implemented @@ -346,15 +339,14 @@ && ( _nCommandType != CommandType::QUERY ) ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Only com.sun.star.sdb.CommandType.TABLE and com.sun.star.sdb.CommandType.QUERY are allowed." ) ), + String( SdbtRes( STR_INVALID_COMMAND_TYPE ) ), NULL, 0 ); - // TODO: resource } //-------------------------------------------------------------------- - PNameValidation NameCheckFactory::createExistenceCheck( sal_Int32 _nCommandType, const Reference< XConnection >& _rxConnection ) + PNameValidation NameCheckFactory::createExistenceCheck( const ::comphelper::ComponentContext& _rContext, sal_Int32 _nCommandType, const Reference< XConnection >& _rxConnection ) { verifyCommandType( _nCommandType ); @@ -371,15 +363,14 @@ catch( const Exception& ) { throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given connection is no valid query and/or tables supplier." ) ), + String( SdbtRes( STR_CONN_WITHOUT_QUERIES_OR_TABLES ) ), NULL, 0 ); - // TODO: resource } - PNameValidation pTableCheck( new PlainExistenceCheck( _rxConnection, xTables ) ); - PNameValidation pQueryCheck( new PlainExistenceCheck( _rxConnection, xQueries ) ); + PNameValidation pTableCheck( new PlainExistenceCheck( _rContext, _rxConnection, xTables ) ); + PNameValidation pQueryCheck( new PlainExistenceCheck( _rContext, _rxConnection, xQueries ) ); PNameValidation pReturn; if ( aMeta.supportsSubqueriesInFrom() ) @@ -392,7 +383,7 @@ } //-------------------------------------------------------------------- - PNameValidation NameCheckFactory::createValidityCheck( sal_Int32 _nCommandType, const Reference< XConnection >& _rxConnection ) + PNameValidation NameCheckFactory::createValidityCheck( const ::comphelper::ComponentContext& _rContext, sal_Int32 _nCommandType, const Reference< XConnection >& _rxConnection ) { verifyCommandType( _nCommandType ); @@ -408,12 +399,11 @@ NULL, 0 ); - // TODO: resource } if ( _nCommandType == CommandType::TABLE ) - return PNameValidation( new TableValidityCheck( _rxConnection ) ); - return PNameValidation( new QueryValidityCheck( _rxConnection ) ); + return PNameValidation( new TableValidityCheck( _rContext, _rxConnection ) ); + return PNameValidation( new QueryValidityCheck( _rContext, _rxConnection ) ); } //==================================================================== @@ -428,8 +418,9 @@ //= ObjectNames //==================================================================== //-------------------------------------------------------------------- - ObjectNames::ObjectNames( const Reference< XConnection >& _rxConnection ) - :m_pImpl( new ObjectNames_Impl ) + ObjectNames::ObjectNames( const ::comphelper::ComponentContext& _rContext, const Reference< XConnection >& _rxConnection ) + :ConnectionDependentComponent( _rContext ) + ,m_pImpl( new ObjectNames_Impl ) { if ( !_rxConnection.is() ) throw NullPointerException(); @@ -446,7 +437,7 @@ { EntryGuard aGuard( *this ); - PNameValidation pNameCheck( NameCheckFactory::createExistenceCheck( _CommandType, getConnection() ) ); + PNameValidation pNameCheck( NameCheckFactory::createExistenceCheck( getContext(), _CommandType, getConnection() ) ); String sBaseName( _BaseName ); if ( sBaseName.Len() == 0 ) @@ -482,7 +473,7 @@ { EntryGuard aGuard( *this ); - PNameValidation pNameCheck( NameCheckFactory::createExistenceCheck( _CommandType, getConnection()) ); + PNameValidation pNameCheck( NameCheckFactory::createExistenceCheck( getContext(), _CommandType, getConnection()) ); return !pNameCheck->validateName( _Name ); } @@ -491,7 +482,7 @@ { EntryGuard aGuard( *this ); - PNameValidation pNameCheck( NameCheckFactory::createValidityCheck( _CommandType, getConnection()) ); + PNameValidation pNameCheck( NameCheckFactory::createValidityCheck( getContext(), _CommandType, getConnection()) ); return pNameCheck->validateName( _Name ); } @@ -500,10 +491,10 @@ { EntryGuard aGuard( *this ); - PNameValidation pNameCheck( NameCheckFactory::createExistenceCheck( _CommandType, getConnection() ) ); + PNameValidation pNameCheck( NameCheckFactory::createExistenceCheck( getContext(), _CommandType, getConnection() ) ); pNameCheck->validateName_throw( _Name ); - pNameCheck = NameCheckFactory::createValidityCheck( _CommandType, getConnection() ); + pNameCheck = NameCheckFactory::createValidityCheck( getContext(), _CommandType, getConnection() ); pNameCheck->validateName_throw( _Name ); } File [changed]: objectnames.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/objectnames.hxx?r1=1.2&r2=1.2.184.1 Delta lines: +11 -9 -------------------- --- objectnames.hxx 2006-07-10 15:20:06+0000 1.2 +++ objectnames.hxx 2007-09-20 18:35:33+0000 1.2.184.1 @@ -4,9 +4,9 @@ * * $RCSfile: objectnames.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.184.1 $ * - * last change: $Author: obo $ $Date: 2006/07/10 15:20:06 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,19 +36,14 @@ #ifndef DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX #define DBACCESS_SOURCE_SDBTOOLS_INC_OBJECTNAMES_HXX -#ifndef DBACCESS_CONNECTION_DEPENDENT_HXX #include "connectiondependent.hxx" -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_SDB_TOOLS_XOBJECTNAMES_HPP_ #include <com/sun/star/sdb/tools/XObjectNames.hpp> -#endif /** === end UNO includes === **/ -#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <comphelper/componentcontext.hxx> #include <cppuhelper/implbase1.hxx> -#endif #include <memory> @@ -73,12 +68,19 @@ public: /** constructs the instance + + @param _rContext + the component's context @param _rxConnection the connection to work with. Will be held weak. Must not be <NULL/>. + @throws ::com::sun::star::lang::NullPointerException if _rxConnection is <NULL/> */ - ObjectNames( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection ); + ObjectNames( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + ); // XObjectNames virtual ::rtl::OUString SAL_CALL suggestName( ::sal_Int32 CommandType, const ::rtl::OUString& BaseName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); File [changed]: tablename.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/tablename.cxx?r1=1.3&r2=1.3.142.1 Delta lines: +12 -33 --------------------- --- tablename.cxx 2006-09-17 06:50:13+0000 1.3 +++ tablename.cxx 2007-09-20 18:35:33+0000 1.3.142.1 @@ -4,9 +4,9 @@ * * $RCSfile: tablename.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.142.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 06:50:13 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,35 +36,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_SOURCE_SDBTOOLS_CONNECTION_TABLENAME_HXX #include "tablename.hxx" -#endif - -#ifndef DBACCESS_MODULE_SDBT_HXX +#include "sdbt_resource.hrc" #include "module_sdbt.hxx" -#endif -#ifndef DBACCESS_SHARED_SDBTSTRINGS_HRC #include "sdbtstrings.hrc" -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_LANG_NULLPOINTEREXCEPTION_HPP_ #include <com/sun/star/lang/NullPointerException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_TOOLS_COMPOSITIONTYPE_HPP_ #include <com/sun/star/sdb/tools/CompositionType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif /** === end UNO includes === **/ -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif +#include <tools/string.hxx> //........................................................................ namespace sdbtools @@ -108,8 +93,9 @@ //= TableName //==================================================================== //-------------------------------------------------------------------- - TableName::TableName( const Reference< XConnection >& _rxConnection ) - :m_pImpl( new TableName_Impl ) + TableName::TableName( const ::comphelper::ComponentContext& _rContext, const Reference< XConnection >& _rxConnection ) + :ConnectionDependentComponent( _rContext ) + ,m_pImpl( new TableName_Impl ) { if ( !_rxConnection.is() ) throw NullPointerException(); @@ -211,11 +197,10 @@ || !xPSI->hasPropertyByName( PROPERTY_NAME ) ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given object is no table object." ) ), + String( SdbtRes( STR_NO_TABLE_OBJECT ) ), *this, 0 ); - // TODO: resource try { @@ -224,14 +209,9 @@ OSL_VERIFY( _table->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->sName ); } catch( const RuntimeException& ) { throw; } - catch( const Exception& ) + catch( const Exception& e ) { - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An unknown error occured while examining the given table object." ) ), - *this, - 0 - ); - // TODO: resource + throw IllegalArgumentException( e.Message, e.Context, 0 ); } } @@ -265,11 +245,10 @@ found = true; if ( !found ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid composition type (not from com.sun.star.sdb.tools.CompositionType)" ) ), + String( SdbtRes( STR_INVALID_COMPOSITION_TYPE ) ), NULL, 0 ); - // TODO: resource return TypeTable[i].eComposeRule; } File [changed]: tablename.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/sdbtools/connection/tablename.hxx?r1=1.2&r2=1.2.184.1 Delta lines: +10 -3 -------------------- --- tablename.hxx 2006-07-10 15:20:25+0000 1.2 +++ tablename.hxx 2007-09-20 18:35:33+0000 1.2.184.1 @@ -4,9 +4,9 @@ * * $RCSfile: tablename.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.184.1 $ * - * last change: $Author: obo $ $Date: 2006/07/10 15:20:25 $ + * last change: $Author: fs $ $Date: 2007/09/20 18:35:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -73,12 +73,19 @@ public: /** constructs the instance + + @param _rContext + the component's context @param _rxConnection the connection to work with. Will be held weak. Must not be <NULL/>. + @throws ::com::sun::star::lang::NullPointerException if _rxConnection is <NULL/> */ - TableName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection ); + TableName( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + ); // XTableName virtual ::rtl::OUString SAL_CALL getCatalogName() throw (::com::sun::star::uno::RuntimeException); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
