Tag: cws_src680_qiq User: fs Date: 06/05/10 07:23:57 Modified: /dba/dbaccess/source/core/dataaccess/ connection.cxx, connection.hxx
Log: #i51143# when connecting, check for conflicts between query and table names, and warn about them File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: connection.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/connection.cxx?r1=1.46&r2=1.46.2.1 Delta lines: +69 -26 --------------------- --- connection.cxx 4 May 2006 08:37:14 -0000 1.46 +++ connection.cxx 10 May 2006 14:23:54 -0000 1.46.2.1 @@ -4,9 +4,9 @@ * * $RCSfile: connection.cxx,v $ * - * $Revision: 1.46 $ + * $Revision: 1.46.2.1 $ * - * last change: $Author: rt $ $Date: 2006/05/04 08:37:14 $ + * last change: $Author: fs $ $Date: 2006/05/10 14:23:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -32,27 +32,42 @@ * MA 02111-1307 USA * ************************************************************************/ + #ifndef _DBA_CORE_CONNECTION_HXX_ #include "connection.hxx" #endif + #ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" #endif #ifndef _DBA_COREDATAACCESS_DATASOURCE_HXX_ #include "datasource.hxx" #endif +#ifndef _DBA_CORE_RESOURCE_HRC_ +#include "core_resource.hrc" +#endif +#ifndef _DBA_CORE_RESOURCE_HXX_ +#include "core_resource.hxx" +#endif #ifndef _DBA_COREAPI_STATEMENT_HXX_ -#include <statement.hxx> +#include "statement.hxx" #endif #ifndef _DBA_COREAPI_PREPAREDSTATEMENT_HXX_ -#include <preparedstatement.hxx> +#include "preparedstatement.hxx" #endif #ifndef _DBA_COREAPI_CALLABLESTATEMENT_HXX_ -#include <callablestatement.hxx> +#include "callablestatement.hxx" #endif -#ifndef _TOOLS_DEBUG_HXX -#include <tools/debug.hxx> +#ifndef DBA_CONTAINERMEDIATOR_HXX +#include "ContainerMediator.hxx" +#endif +#ifndef DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX +#include "SingleSelectQueryComposer.hxx" +#endif +#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX +#include "querycomposer.hxx" #endif + #ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> #endif @@ -65,17 +80,19 @@ #ifndef _COM_SUN_STAR_REFLECTION_XPROXYFACTORY_HPP_ #include <com/sun/star/reflection/XProxyFactory.hpp> #endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif + #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> #endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ -#include <cppuhelper/typeprovider.hxx> +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> #endif -#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX -#include "querycomposer.hxx" + +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef TOOLS_DIAGNOSE_EX_H +#include <tools/diagnose_ex.h> #endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> @@ -83,14 +100,11 @@ #ifndef _COMPHELPER_UNO3_HXX_ #include <comphelper/uno3.hxx> #endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include <connectivity/dbexception.hxx> -#endif -#ifndef DBA_CONTAINERMEDIATOR_HXX -#include "ContainerMediator.hxx" +#ifndef _COMPHELPER_SEQUENCE_HXX_ +#include <comphelper/sequence.hxx> #endif -#ifndef DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX -#include "SingleSelectQueryComposer.hxx" +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> #endif using namespace ::com::sun::star::uno; @@ -343,9 +357,6 @@ try { - Reference< XTypeProvider > xTest( _rxMaster, UNO_QUERY ); - xTest->getTypes(); - Reference< XProxyFactory > xProxyFactory( _rxORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory"))),UNO_QUERY); Reference<XAggregation> xAgg = xProxyFactory->createProxy(_rxMaster.get()); @@ -391,7 +402,7 @@ } } } - // some dbs doesn't support this type so we should ask if a XViewsSupplier is supported + // some dbs don't support this type so we should ask if a XViewsSupplier is supported if(!m_bSupportsViews) { Reference< XViewsSupplier > xMaster(getMasterTables(),UNO_QUERY); @@ -408,6 +419,7 @@ m_bSupportsUsers = Reference< XUsersSupplier> (getMasterTables(),UNO_QUERY).is(); m_bSupportsGroups = Reference< XGroupsSupplier> (getMasterTables(),UNO_QUERY).is(); + impl_checkTableQueryNames_nothrow(); } } catch(Exception&) @@ -749,6 +761,37 @@ Reference<XGroupsSupplier> xGrp(getMasterTables(),UNO_QUERY); return xGrp.is() ? xGrp->getGroups() : Reference< XNameAccess >(); } + +// ----------------------------------------------------------------------------- +void OConnection::impl_checkTableQueryNames_nothrow() +{ + try + { + Reference< XNameAccess > xTables( getTables() ); + Sequence< ::rtl::OUString > aTableNames( xTables->getElementNames() ); + ::std::set< ::rtl::OUString > aSortedTableNames( aTableNames.getConstArray(), aTableNames.getConstArray() + aTableNames.getLength() ); + + Reference< XNameAccess > xQueries( getQueries() ); + Sequence< ::rtl::OUString > aQueryNames( xQueries->getElementNames() ); + + for ( const ::rtl::OUString* pQueryName = aQueryNames.getConstArray(); + pQueryName != aQueryNames.getConstArray() + aQueryNames.getLength(); + ++pQueryName + ) + { + if ( aSortedTableNames.find( *pQueryName ) != aSortedTableNames.end() ) + { + ::rtl::OUString sConflictWarning( DBACORE_RESSTRING( RID_STR_CONFLICTING_NAMES ) ); + m_aWarnings.appendWarning( sConflictWarning, "01SB0", *this ); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + //........................................................................ } // namespace dbaccess //........................................................................ File [changed]: connection.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/connection.hxx?r1=1.23&r2=1.23.4.1 Delta lines: +8 -3 ------------------- --- connection.hxx 4 May 2006 08:37:32 -0000 1.23 +++ connection.hxx 10 May 2006 14:23:54 -0000 1.23.4.1 @@ -4,9 +4,9 @@ * * $RCSfile: connection.hxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.23.4.1 $ * - * last change: $Author: rt $ $Date: 2006/05/04 08:37:32 $ + * last change: $Author: fs $ $Date: 2006/05/10 14:23:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -231,6 +231,11 @@ } ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > getMasterTables(); + +private: + /** checks whether or not there are naming conflicts between tables and queries + */ + void impl_checkTableQueryNames_nothrow(); }; //........................................................................ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
