User: hr Date: 2006/08/15 03:42:53 Modified: dba/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
Log: INTEGRATION: CWS dba30 (1.10.2); FILE MERGED 2006/07/19 12:10:18 fs 1.10.2.7: RESYNC: (1.13-1.15); FILE MERGED 2006/04/20 06:44:37 oj 1.10.2.6: RESYNC: (1.12-1.13); FILE MERGED 2006/03/21 18:21:57 fs 1.10.2.5: RESYNC: (1.11-1.12); FILE MERGED 2006/01/02 09:17:07 oj 1.10.2.4: #i44200# use supportsMixedCaseQuotedIdentifiers where storesMixedCaseQuotedIdentifiers was used 2005/09/30 06:02:14 fs 1.10.2.3: RESYNC: (1.10-1.11); FILE MERGED 2005/08/22 14:54:38 fs 1.10.2.2: some minor speedups in the query composer, and some RTL_LOGs for #i48403# 2005/04/06 07:15:34 fs 1.10.2.1: #i46768# some assertions on the type of connection properties File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: SingleSelectQueryComposer.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/SingleSelectQueryComposer.cxx?r1=1.15&r2=1.16 Delta lines: +22 -21 --------------------- --- SingleSelectQueryComposer.cxx 10 Jul 2006 15:04:12 -0000 1.15 +++ SingleSelectQueryComposer.cxx 15 Aug 2006 10:42:50 -0000 1.16 @@ -113,6 +113,9 @@ #ifndef DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX #include "composertools.hxx" #endif +#ifndef _RTL_LOGFILE_HXX_ +#include <rtl/logfile.hxx> +#endif #include <memory> using namespace dbaccess; @@ -158,6 +161,7 @@ */ const OSQLParseNode* parseStatement_throwError( OSQLParser& _rParser, const ::rtl::OUString& _rStatement, const Reference< XInterface >& _rxContext ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[EMAIL PROTECTED]", "SingleSelectQueryComposer.cxx::parseStatement_throwError" ); ::rtl::OUString aErrorMsg; const OSQLParseNode* pNewSqlParseNode = _rParser.parseTree( aErrorMsg, _rStatement ); if ( !pNewSqlParseNode ) @@ -204,6 +208,7 @@ void parseAndCheck_throwError( OSQLParser& _rParser, const ::rtl::OUString& _rStatement, OSQLParseTreeIterator& _rIterator, const Reference< XInterface >& _rxContext ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[EMAIL PROTECTED]", "SingleSelectQueryComposer.cxx::parseAndCheck_throwError" ); const OSQLParseNode* pNode = parseStatement_throwError( _rParser, _rStatement, _rxContext ); checkForSingleSelect_throwError( pNode, _rIterator, _rxContext, _rStatement ); } @@ -283,7 +288,7 @@ { if ( pBegin->Name == static_cast <rtl::OUString> (PROPERTY_BOOLEANCOMPARISONMODE) ) { - pBegin->Value >>= m_nBoolCompareMode; + OSL_VERIFY( pBegin->Value >>= m_nBoolCompareMode ); } } } @@ -352,6 +357,7 @@ // ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setQuery( const ::rtl::OUString& command ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[EMAIL PROTECTED]", "OSingleSelectQueryComposer::setQuery" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); @@ -371,6 +377,7 @@ // ----------------------------------------------------------------------------- void OSingleSelectQueryComposer::setQuery_Impl( const ::rtl::OUString& command ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[EMAIL PROTECTED]", "OSingleSelectQueryComposer::setQuery_Impl" ); // parse this parseAndCheck_throwError( m_aSqlParser, command, m_aSqlIterator, *this ); @@ -574,24 +581,25 @@ // ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setElementaryQuery( const ::rtl::OUString& _rElementary ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[EMAIL PROTECTED]", "OSingleSelectQueryComposer::setElementaryQuery" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - // parse and verify the statement, building a temporary iterator - OSQLParseTreeIterator aElementaryIterator( m_xConnection, m_xConnectionTables, m_aSqlParser, NULL ); - parseAndCheck_throwError( m_aSqlParser, _rElementary, aElementaryIterator, *this ); - // remember the 4 current "additive" clauses ::std::vector< ::rtl::OUString > aAdditiveClauses( SQLPartCount ); for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) aAdditiveClauses[ eLoopParts ] = getSQLPart( eLoopParts, m_aAdditiveIterator, sal_False ); - // strip every filter/order/groupby/having clause, and set the pure select statement - // as query - setQuery( _rElementary ); + // clear the tables and columns + clearCurrentCollections(); + // set and parse the new query + setQuery_Impl( _rElementary ); + + // get the 4 elementary parts of the statement + for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) + m_aElementaryParts[ eLoopParts ] = getSQLPart( eLoopParts, m_aSqlIterator, sal_False ); - // reset the the AdditiveIterator: m_aPureSelectSQL may have changed, and even if not, - // setQuery touched the m_aAdditiveIterator + // reset the the AdditiveIterator: m_aPureSelectSQL may have changed try { parseAndCheck_throwError( m_aSqlParser, composeStatementFromParts( aAdditiveClauses ), m_aAdditiveIterator, *this ); @@ -603,13 +611,6 @@ // every part of the additive statement should have passed other tests already, and should not // be able to cause any errors ... me thinks } - - // get the four parts of the statement - for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) - m_aElementaryParts[ eLoopParts ] = getSQLPart( eLoopParts, aElementaryIterator, sal_False ); - - // temporary iterator not needed anymore - resetIterator( aElementaryIterator, true ); } // ------------------------------------------------------------------------- @@ -718,7 +719,7 @@ for(OSQLTables::const_iterator aIter = aTables.begin(); aIter != aTables.end();++aIter) aNames.push_back(aIter->first); - m_pTables = new OPrivateTables(aTables,m_xMetaData->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); + m_pTables = new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames); } return m_pTables; @@ -743,7 +744,7 @@ SharedUNOComponent< XStatement, DisposableComponent > xStatement; SharedUNOComponent< XPreparedStatement, DisposableComponent > xPreparedStatement; - bCase = m_xMetaData->storesMixedCaseQuotedIdentifiers(); + bCase = m_xMetaData->supportsMixedCaseQuotedIdentifiers(); aSelectColumns = m_aSqlIterator.getSelectColumns(); ::rtl::OUString sSql = m_aPureSelectSQL; @@ -1285,7 +1286,7 @@ ::std::vector< ::rtl::OUString> aNames; for(OSQLColumns::const_iterator aIter = aCols->begin(); aIter != aCols->end();++aIter) aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME))); - m_aCurrentColumns[ParameterColumns] = new OPrivateColumns(aCols,m_xMetaData->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True); + m_aCurrentColumns[ParameterColumns] = new OPrivateColumns(aCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True); } return m_aCurrentColumns[ParameterColumns]; @@ -1335,7 +1336,7 @@ ::std::vector< ::rtl::OUString> aNames; for(OSQLColumns::const_iterator aIter = _rCols->begin(); aIter != _rCols->end();++aIter) aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME))); - m_aCurrentColumns[_eType] = new OPrivateColumns(_rCols,m_xMetaData->storesMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True); + m_aCurrentColumns[_eType] = new OPrivateColumns(_rCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True); } return m_aCurrentColumns[_eType]; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
