Files
libreoffice/connectivity/source/parse/sqliterator.cxx

2000 lines
81 KiB
C++
Raw Normal View History

2000-09-18 15:18:56 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 15:18:56 +00:00
*
* $RCSfile: sqliterator.cxx,v $
2000-09-18 15:18:56 +00:00
*
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
* $Revision: 1.48 $
2000-09-18 15:18:56 +00:00
*
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
* last change: $Author: obo $ $Date: 2006-07-10 14:38:34 $
2000-09-18 15:18:56 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-18 15:18:56 +00:00
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
2000-09-18 15:18:56 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
2000-09-18 15:18:56 +00:00
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
2000-09-18 15:18:56 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
2000-09-18 15:18:56 +00:00
*
************************************************************************/
#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
#include "connectivity/sqliterator.hxx"
#endif
#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_
#include "connectivity/sdbcx/VTable.hxx"
#endif
2000-09-18 15:18:56 +00:00
#ifndef _CONNECTIVITY_SQLPARSE_HXX
#include <connectivity/sqlparse.hxx>
#endif
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include <connectivity/dbtools.hxx>
#endif
2000-09-18 15:18:56 +00:00
#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
#endif
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
#endif
2000-09-18 15:18:56 +00:00
#ifdef SQL_TEST_PARSETREEITERATOR
#include <iostream>
2000-09-18 15:18:56 +00:00
#endif
#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
#include "connectivity/PColumn.hxx"
#endif
2001-02-01 12:10:17 +00:00
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include "connectivity/dbtools.hxx"
#endif
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
#ifndef TOOLS_DIAGNOSE_EX_H
#include <tools/diagnose_ex.h>
#endif
2001-05-14 10:42:44 +00:00
#ifndef CONNECTIVITY_CONNECTION_HXX
#include "TConnection.hxx"
#endif
2001-05-18 07:33:49 +00:00
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
#ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
#include <connectivity/dbmetadata.hxx>
#endif
#ifndef _COM_SUN_STAR_SDB_SQLFILTEROPERATOR_HPP_
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#endif
#ifndef CONNECTIVITY_DIAGNOSE_EX_H
#include "diagnose_ex.h"
#endif
2000-09-18 15:18:56 +00:00
2001-05-18 07:33:49 +00:00
using namespace ::comphelper;
2001-02-01 12:10:17 +00:00
using namespace ::connectivity;
using namespace ::connectivity::sdbcx;
using namespace ::dbtools;
2001-02-01 12:10:17 +00:00
using namespace ::connectivity::parse;
2000-09-18 15:18:56 +00:00
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
2000-09-18 15:18:56 +00:00
2000-10-19 10:47:14 +00:00
static ::rtl::OUString aEmptyString;
2000-09-18 15:18:56 +00:00
namespace connectivity
{
struct OSQLParseTreeIteratorImpl
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
Reference< XConnection > m_xConnection;
Reference< XDatabaseMetaData > m_xDatabaseMetaData;
Reference< XNameAccess > m_xTableContainer;
Reference< XNameAccess > m_xQueryContainer;
::boost::shared_ptr< OSQLTables > m_pTables; /// all tables which participate in the SQL statement
::boost::shared_ptr< OSQLTables > m_pSubTables; /// all tables from sub queries not the tables from the select tables
::boost::shared_ptr< QueryNameSet > m_pForbiddenQueryNames;
sal_uInt32 m_nIncludeMask;
bool m_bIsCaseSensitive;
OSQLParseTreeIteratorImpl( const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxTables )
:m_xConnection( _rxConnection )
,m_nIncludeMask( OSQLParseTreeIterator::All )
,m_bIsCaseSensitive( true )
{
OSL_PRECOND( m_xConnection.is(), "OSQLParseTreeIteratorImpl::OSQLParseTreeIteratorImpl: invalid connection!" );
m_xDatabaseMetaData = m_xConnection->getMetaData();
m_bIsCaseSensitive = m_xDatabaseMetaData.is() && m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers();
m_pTables.reset( new OSQLTables( m_bIsCaseSensitive ) );
m_pSubTables.reset( new OSQLTables( m_bIsCaseSensitive ) );
m_xTableContainer = _rxTables;
DatabaseMetaData aMetaData( m_xConnection );
if ( aMetaData.supportsSubqueriesInFrom() )
{
// connections might support the XQueriesSupplier interface, if they implement the css.sdb.Connection
// service
Reference< XQueriesSupplier > xSuppQueries( m_xConnection, UNO_QUERY );
if ( xSuppQueries.is() )
m_xQueryContainer = xSuppQueries->getQueries();
}
}
public:
inline bool isQueryAllowed( const ::rtl::OUString& _rQueryName )
{
if ( !m_pForbiddenQueryNames.get() )
return true;
if ( m_pForbiddenQueryNames->find( _rQueryName ) == m_pForbiddenQueryNames->end() )
return true;
return false;
}
};
//-------------------------------------------------------------------------
/** helper class for temporarily adding a query name to a list of forbidden query names
*/
class ForbidQueryName
{
::boost::shared_ptr< QueryNameSet >& m_rpAllForbiddenNames;
::rtl::OUString m_sForbiddenQueryName;
public:
ForbidQueryName( OSQLParseTreeIteratorImpl& _rIteratorImpl, const ::rtl::OUString _rForbiddenQueryName )
:m_rpAllForbiddenNames( _rIteratorImpl.m_pForbiddenQueryNames )
,m_sForbiddenQueryName( _rForbiddenQueryName )
{
if ( !m_rpAllForbiddenNames.get() )
m_rpAllForbiddenNames.reset( new QueryNameSet );
m_rpAllForbiddenNames->insert( m_sForbiddenQueryName );
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
~ForbidQueryName()
{
m_rpAllForbiddenNames->erase( m_sForbiddenQueryName );
}
};
}
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSQLParseTreeIterator::OSQLParseTreeIterator(const Reference< XConnection >& _rxConnection,
const Reference< XNameAccess >& _rxTables,
const OSQLParser& _rParser,
const OSQLParseNode* pRoot )
:m_rParser( _rParser )
,m_pImpl( new OSQLParseTreeIteratorImpl( _rxConnection, _rxTables ) )
2000-09-18 15:18:56 +00:00
{
setParseTree(pRoot);
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
//-----------------------------------------------------------------------------
OSQLParseTreeIterator::OSQLParseTreeIterator( const OSQLParseTreeIterator& _rParentIterator, const OSQLParser& _rParser, const OSQLParseNode* pRoot )
:m_rParser( _rParser )
,m_pImpl( new OSQLParseTreeIteratorImpl( _rParentIterator.m_pImpl->m_xConnection, _rParentIterator.m_pImpl->m_xTableContainer ) )
{
m_pImpl->m_pForbiddenQueryNames = _rParentIterator.m_pImpl->m_pForbiddenQueryNames;
setParseTree( pRoot );
}
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
OSQLParseTreeIterator::~OSQLParseTreeIterator()
{
dispose();
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
// -----------------------------------------------------------------------------
const OSQLTables& OSQLParseTreeIterator::getTables() const
{
return *m_pImpl->m_pTables;
}
// -----------------------------------------------------------------------------
bool OSQLParseTreeIterator::isCaseSensitive() const
{
return m_pImpl->m_bIsCaseSensitive;
}
2000-11-03 12:31:35 +00:00
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::dispose()
2000-09-18 15:18:56 +00:00
{
m_aSelectColumns = NULL;
m_aGroupColumns = NULL;
m_aOrderColumns = NULL;
m_aParameters = NULL;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_pImpl->m_xTableContainer = NULL;
m_pImpl->m_xDatabaseMetaData = NULL;
m_aCreateColumns = NULL;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_pImpl->m_pTables->clear();
m_pImpl->m_pSubTables->clear();
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_pImpl->m_pTables->clear();
m_pImpl->m_pSubTables->clear();
2000-09-18 15:18:56 +00:00
m_aSelectColumns = new OSQLColumns();
m_aGroupColumns = new OSQLColumns();
m_aOrderColumns = new OSQLColumns();
m_aParameters = new OSQLColumns();
m_aCreateColumns = new OSQLColumns();
2000-09-18 15:18:56 +00:00
m_pParseTree = pNewParseTree;
if (!m_pParseTree)
{
m_eStatementType = SQL_STATEMENT_UNKNOWN;
return;
}
// falls m_pParseTree aber keine Connection, dann Fehler
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( !m_pImpl->m_xTableContainer.is() )
2000-09-18 15:18:56 +00:00
return;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_aErrors = SQLException();
2000-09-18 15:18:56 +00:00
// Statement-Typ ermitteln ...
if (SQL_ISRULE(m_pParseTree,select_statement) || SQL_ISRULE(m_pParseTree,union_statement) )
{
m_eStatementType = SQL_STATEMENT_SELECT;
}
else if (SQL_ISRULE(m_pParseTree,insert_statement))
{
m_eStatementType = SQL_STATEMENT_INSERT;
}
else if (SQL_ISRULE(m_pParseTree,update_statement_searched))
{
m_eStatementType = SQL_STATEMENT_UPDATE;
}
else if (SQL_ISRULE(m_pParseTree,delete_statement_searched))
{
m_eStatementType = SQL_STATEMENT_DELETE;
}
else if (m_pParseTree->count() == 3 && SQL_ISRULE(m_pParseTree->getChild(1),odbc_call_spec))
{
m_eStatementType = SQL_STATEMENT_ODBC_CALL;
}
else if (SQL_ISRULE(m_pParseTree->getChild(0),base_table_def))
{
m_eStatementType = SQL_STATEMENT_CREATE_TABLE;
m_pParseTree = m_pParseTree->getChild(0);
}
2000-09-18 15:18:56 +00:00
else
{
m_eStatementType = SQL_STATEMENT_UNKNOWN;
//aIteratorStatus.setInvalidStatement();
return;
}
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
namespace
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
//.........................................................................
static void impl_getRowString( const Reference< XRow >& _rxRow, const sal_Int32 _nColumnIndex, ::rtl::OUString& _out_rString )
{
_out_rString = _rxRow->getString( _nColumnIndex );
if ( _rxRow->wasNull() )
_out_rString= ::rtl::OUString();
}
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
//.........................................................................
static ::rtl::OUString lcl_findTableInMetaData(
const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rCatalog,
const ::rtl::OUString& _rSchema, const ::rtl::OUString& _rTableName )
{
::rtl::OUString sComposedName;
static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
static const ::rtl::OUString s_sWildcard = ::rtl::OUString::createFromAscii("%");
// we want all catalogues, all schemas, all tables
Sequence< ::rtl::OUString > sTableTypes(3);
sTableTypes[0] = s_sTableTypeView;
sTableTypes[1] = s_sTableTypeTable;
sTableTypes[2] = s_sWildcard; // just to be sure to include anything else ....
if ( _rxDBMeta.is() )
{
sComposedName = ::rtl::OUString();
Reference< XResultSet> xRes = _rxDBMeta->getTables(
_rCatalog.getLength() ? makeAny( _rCatalog ) : Any(), _rSchema.getLength() ? _rSchema : s_sWildcard, _rTableName, sTableTypes );
Reference< XRow > xCurrentRow( xRes, UNO_QUERY );
if ( xCurrentRow.is() && xRes->next() )
{
::rtl::OUString sCatalog, sSchema, sName;
impl_getRowString( xCurrentRow, 1, sCatalog );
impl_getRowString( xCurrentRow, 2, sSchema );
impl_getRowString( xCurrentRow, 3, sName );
sComposedName = ::dbtools::composeTableName(
_rxDBMeta,
sCatalog,
sSchema,
sName,
sal_False,
::dbtools::eInDataManipulation
);
}
}
return sComposedName;
}
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_getQueryParameterColumns( const OSQLTable& _rQuery )
{
if ( ( m_pImpl->m_nIncludeMask & Parameters ) != Parameters )
// parameters not to be included in the traversal
return;
::vos::ORef< OSQLColumns > pSubQueryParameterColumns( new OSQLColumns() );
// get the command and the EscapeProcessing properties from the sub query
::rtl::OUString sSubQueryCommand;
sal_Bool bEscapeProcessing = sal_False;
try
{
Reference< XPropertySet > xQueryProperties( _rQuery, UNO_QUERY_THROW );
OSL_VERIFY( xQueryProperties->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_COMMAND ) ) >>= sSubQueryCommand );
OSL_VERIFY( xQueryProperties->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ESCAPEPROCESSING ) ) >>= bEscapeProcessing );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
// parse the sub query
do {
if ( !bEscapeProcessing || ( sSubQueryCommand.getLength() == 0 ) )
break;
::rtl::OUString sError;
::std::auto_ptr< OSQLParseNode > pSubQueryNode( const_cast< OSQLParser& >( m_rParser ).parseTree( sError, sSubQueryCommand, sal_False ) );
if ( !pSubQueryNode.get() )
break;
OSQLParseTreeIterator aSubQueryIterator( *this, m_rParser, pSubQueryNode.get() );
aSubQueryIterator.traverseSome( Parameters );
pSubQueryParameterColumns = aSubQueryIterator.getParameters();
aSubQueryIterator.dispose();
} while ( false );
// copy the parameters of the sub query to our own parameter array
::std::copy( pSubQueryParameterColumns->begin(), pSubQueryParameterColumns->end(),
::std::insert_iterator< OSQLColumns >( *m_aParameters, m_aParameters->end() ) );
}
//-----------------------------------------------------------------------------
OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const ::rtl::OUString& _rComposedName )
{
if ( !_rComposedName.getLength() )
{
OSL_ENSURE( false, "OSQLParseTreeIterator::impl_locateRecordSource: no object name at all?" );
return OSQLTable();
}
OSQLTable aReturn;
::rtl::OUString sComposedName( _rComposedName );
try
{
::rtl::OUString sCatalog, sSchema, sName;
qualifiedNameComponents( m_pImpl->m_xDatabaseMetaData, sComposedName, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation );
// check whether there is a query with the given name
bool bQueryDoesExist = m_pImpl->m_xQueryContainer.is() && m_pImpl->m_xQueryContainer->hasByName( sComposedName );
// check whether the table container contains an object with the given name
if ( !bQueryDoesExist && !m_pImpl->m_xTableContainer->hasByName( sComposedName ) )
sComposedName = lcl_findTableInMetaData( m_pImpl->m_xDatabaseMetaData, sCatalog, sSchema, sName );
bool bTableDoesExist = m_pImpl->m_xTableContainer->hasByName( sComposedName );
// now obtain the object
// if we're creating a table, and there already is a table or query with the same name,
// this is worth an error
if ( SQL_STATEMENT_CREATE_TABLE == m_eStatementType )
{
if ( bQueryDoesExist )
impl_appendError( IParseContext::ERROR_INVALID_QUERY_EXIST, &sName );
else if ( bTableDoesExist )
impl_appendError( IParseContext::ERROR_INVALID_TABLE_EXIST, &sName );
else
aReturn = impl_createTableObject( sName, sCatalog, sSchema );
}
else
{
// queries win over tables, so if there's a query with this name, take this, no matter if
// there's a table, too
if ( bQueryDoesExist )
{
if ( !m_pImpl->isQueryAllowed( sComposedName ) )
{
impl_appendError( SQLException(
m_rParser.getContext().getErrorMessage( IParseContext::ERROR_CYCLIC_SUB_QUERIES ),
NULL,
getStandardSQLState( SQL_CYCLIC_SUB_QUERIES ),
0,
Any()
) );
return NULL;
}
m_pImpl->m_xQueryContainer->getByName( sComposedName ) >>= aReturn;
// collect the parameters from the sub query
ForbidQueryName aForbidName( *m_pImpl, sComposedName );
impl_getQueryParameterColumns( aReturn );
}
else if ( bTableDoesExist )
m_pImpl->m_xTableContainer->getByName( sComposedName ) >>= aReturn;
else
{
if ( m_pImpl->m_xQueryContainer.is() )
// the connection on which we're working supports sub queries in from (else
// m_xQueryContainer would not have been set), so emit a better error message
impl_appendError( IParseContext::ERROR_INVALID_TABLE_OR_QUERY, &sName );
else
impl_appendError( IParseContext::ERROR_INVALID_TABLE, &sName );
}
}
}
catch(Exception&)
{
impl_appendError( IParseContext::ERROR_INVALID_TABLE, &sComposedName );
}
return aReturn;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange )
{
if ( ( m_pImpl->m_nIncludeMask & TableNames ) != TableNames )
// tables should not be included in the traversal
return;
2000-09-18 15:18:56 +00:00
2001-03-21 12:52:43 +00:00
OSL_ENSURE(pTableName != NULL,"OSQLParseTreeIterator::traverseOneTableName: pTableName == NULL");
2000-10-19 10:47:14 +00:00
2001-01-09 12:11:07 +00:00
Any aCatalog;
::rtl::OUString aSchema,aTableName,aComposedName;
2000-10-19 10:47:14 +00:00
::rtl::OUString aTableRange(rTableRange);
2000-09-18 15:18:56 +00:00
// Tabellenname abholen
2001-01-09 12:11:07 +00:00
OSQLParseNode::getTableComponents(pTableName,aCatalog,aSchema,aTableName);
// create the composed name like DOMAIN.USER.TABLE1
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
aComposedName = ::dbtools::composeTableName(m_pImpl->m_xDatabaseMetaData,
2001-01-09 12:11:07 +00:00
aCatalog.hasValue() ? ::comphelper::getString(aCatalog) : ::rtl::OUString(),
aSchema,
aTableName,
sal_False,
::dbtools::eInDataManipulation);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
2001-01-09 12:11:07 +00:00
// if there is no alias for the table name assign the orignal name to it
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( !aTableRange.getLength() )
2001-01-09 12:11:07 +00:00
aTableRange = aComposedName;
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
// get the object representing this table/query
OSQLTable aTable = impl_locateRecordSource( aComposedName );
if ( aTable.is() )
_rTables[ aTableRange ] = aTable;
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, ::rtl::OUString& aTableRange )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_PRECOND( SQL_ISRULE( pTableRef, joined_table ) || SQL_ISRULE( pTableRef, cross_union ) || SQL_ISRULE( pTableRef, qualified_join ) ,
"OSQLParseTreeIterator::getQualified_join: illegal node!" );
2000-10-19 10:47:14 +00:00
aTableRange = ::rtl::OUString();
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
const OSQLParseNode* pNode = getTableNode(_rTables,pTableRef->getChild(0),aTableRange);
if ( isTableNode( pNode ) )
traverseOneTableName( _rTables, pNode, aTableRange );
2001-07-19 08:29:22 +00:00
2000-10-19 10:47:14 +00:00
sal_uInt32 nPos = 4;
2000-09-18 15:18:56 +00:00
if(SQL_ISRULE(pTableRef,cross_union) || pTableRef->getChild(1)->getTokenID() != SQL_TOKEN_NATURAL)
nPos = 3;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pNode = getTableNode(_rTables,pTableRef->getChild(nPos),aTableRange);
if ( isTableNode( pNode ) )
traverseOneTableName( _rTables, pNode, aTableRange );
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
const OSQLParseNode* OSQLParseTreeIterator::getTableNode( OSQLTables& _rTables, const OSQLParseNode *pTableRef,::rtl::OUString& aTableRange )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_PRECOND( SQL_ISRULE( pTableRef, table_ref ) || SQL_ISRULE( pTableRef, joined_table )
|| SQL_ISRULE( pTableRef, qualified_join ) || SQL_ISRULE( pTableRef, cross_union )
|| SQL_ISRULE( pTableRef, subquery ),
"OSQLParseTreeIterator::getTableNode: only to be called for table_ref nodes!" );
2000-10-19 10:47:14 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
const OSQLParseNode* pTableNameNode = NULL;
if ( SQL_ISRULE( pTableRef, joined_table ) )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
getQualified_join( _rTables, pTableRef->getChild(1), aTableRange );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else if ( SQL_ISRULE( pTableRef, qualified_join ) || SQL_ISRULE( pTableRef, cross_union ) )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
getQualified_join( _rTables, pTableRef, aTableRange );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( pTableRef->count() == 4 )
{
if ( SQL_ISPUNCTUATION( pTableRef->getChild(0), "{" ) )
{ // { OJ joined_table }
getQualified_join( _rTables, pTableRef->getChild(2), aTableRange );
}
else
{ // table_node as range_variable op_column_commalist
pTableNameNode = pTableRef->getChild(0);
aTableRange = pTableRef->getChild(2)->getTokenValue();
}
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else if ( pTableRef->count() == 3 )
{ // subquery as range_variable
const OSQLParseNode* pSubQuery = pTableRef->getChild(0);
OSL_ENSURE( pSubQuery->count() == 3, "sub queries should have 3 children!" );
const OSQLParseNode* pQueryExpression = pSubQuery->getChild(1);
if ( SQL_ISRULE( pQueryExpression, select_statement ) )
{
getSelect_statement( *m_pImpl->m_pSubTables, pQueryExpression );
aTableRange = pTableRef->getChild(2)->getTokenValue();
}
else
{
OSL_ENSURE( false, "OSQLParseTreeIterator::getTableNode: subquery which is no select_statement: not yet implemented!" );
}
}
else if ( pTableRef->count() == 6 )
{
// '(' joined_table ')' as range_variable op_column_commalist
getQualified_join( _rTables, pTableRef->getChild(1), aTableRange );
aTableRange = pTableRef->getChild(4)->getTokenValue();
}
else
OSL_ENSURE( false, "OSQLParseTreeIterator::getTableNode: unhandled case!" );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return pTableNameNode;
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect)
2000-09-18 15:18:56 +00:00
{
if(SQL_ISRULE(pSelect,union_statement))
{
getSelect_statement(_rTables,pSelect->getChild(0));
2000-09-18 15:18:56 +00:00
//getSelect_statement(pSelect->getChild(3));
return;
}
OSQLParseNode * pTableRefCommalist = pSelect->getChild(3)->getChild(0)->getChild(1);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableRefCommalist != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableRefCommalist,table_ref_commalist),"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
const OSQLParseNode* pTableName = NULL;
2000-10-19 10:47:14 +00:00
::rtl::OUString aTableRange;
for (sal_uInt32 i = 0; i < pTableRefCommalist->count(); i++)
2000-09-18 15:18:56 +00:00
{ // from clause durchlaufen
2000-10-19 10:47:14 +00:00
aTableRange = ::rtl::OUString();
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
const OSQLParseNode* pTableListElement = pTableRefCommalist->getChild(i);
if ( isTableNode( pTableListElement ) )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseOneTableName( _rTables, pTableListElement, aTableRange );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else if ( SQL_ISRULE( pTableListElement, table_ref ) )
2000-09-18 15:18:56 +00:00
{
// Tabellenreferenz kann aus Tabellennamen, Tabellennamen (+),'('joined_table')'(+) bestehen
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pTableName = pTableListElement->getChild(0);
if( isTableNode( pTableName ) )
2000-09-18 15:18:56 +00:00
{ // Tabellennamen gefunden
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( pTableListElement->count() == 4 )
{ // table_node as range_variable op_column_commalist
OSL_ENSURE( pTableListElement->getChild(1)->getKnownRuleID() == OSQLParseNode::as,
"OSQLParseTreeIterator::getSelect_statement: table_ref rules changed?" );
aTableRange = pTableListElement->getChild(2)->getTokenValue();
}
traverseOneTableName( _rTables, pTableName, aTableRange );
2000-09-18 15:18:56 +00:00
}
else if(SQL_ISPUNCTUATION(pTableName,"{"))
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
{ // '{' SQL_TOKEN_OJ joined_table '}'
getQualified_join( _rTables, pTableListElement->getChild(2), aTableRange );
}
else
{ // '(' joined_table ')' as range_variable op_column_commalist
getTableNode( _rTables, pTableListElement, aTableRange );
}
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else if (SQL_ISRULE( pTableListElement, qualified_join ) || SQL_ISRULE( pTableListElement, cross_union ) )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
getQualified_join( _rTables, pTableListElement, aTableRange );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else if ( SQL_ISRULE( pTableListElement, joined_table ) )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
getQualified_join( _rTables, pTableListElement->getChild(1), aTableRange );
2000-09-18 15:18:56 +00:00
}
// if (! aIteratorStatus.IsSuccessful()) break;
}
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
bool OSQLParseTreeIterator::traverseTableNames(OSQLTables& _rTables)
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( m_pParseTree == NULL )
return false;
2000-10-19 10:47:14 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSQLParseNode* pTableName = NULL;
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
switch ( m_eStatementType )
{
case SQL_STATEMENT_SELECT:
getSelect_statement( _rTables, m_pParseTree );
break;
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
case SQL_STATEMENT_CREATE_TABLE:
case SQL_STATEMENT_INSERT:
case SQL_STATEMENT_DELETE:
pTableName = m_pParseTree->getChild(2);
break;
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
case SQL_STATEMENT_UPDATE:
pTableName = m_pParseTree->getChild(1);
break;
default:
break;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( pTableName )
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
::rtl::OUString sTableRange;
traverseOneTableName( _rTables, pTableName, sTableRange );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return !hasErrors();
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
2002-07-15 11:34:56 +00:00
::rtl::OUString OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* _pDerivedColumn)
2000-09-18 15:18:56 +00:00
{
2002-07-15 11:34:56 +00:00
OSL_ENSURE(SQL_ISRULE(_pDerivedColumn,derived_column),"No derived column!");
::rtl::OUString sColumnAlias;
if(_pDerivedColumn->getChild(1)->count() == 2)
sColumnAlias = _pDerivedColumn->getChild(1)->getChild(1)->getTokenValue();
else if(!_pDerivedColumn->getChild(1)->isRule())
sColumnAlias = _pDerivedColumn->getChild(1)->getTokenValue();
return sColumnAlias;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
// -----------------------------------------------------------------------------
namespace
{
void lcl_getColumnRange( const OSQLParseNode* _pColumnRef, const Reference< XDatabaseMetaData>& _xMetaData,
::rtl::OUString& _out_rColumnName, ::rtl::OUString& _out_rTableRange,
const OSQLColumns* _pSelectColumns, ::rtl::OUString& _out_rColumnAliasIfPresent )
{
_out_rColumnName = _out_rTableRange = _out_rColumnAliasIfPresent = ::rtl::OUString();
if ( SQL_ISRULE( _pColumnRef, column_ref ) )
{
if( _pColumnRef->count() > 1 )
{
for ( sal_Int32 i=0; i<((sal_Int32)_pColumnRef->count())-2; ++i )
_pColumnRef->getChild(i)->parseNodeToStr( _out_rTableRange, _xMetaData, NULL, sal_False, sal_False );
_out_rColumnName = _pColumnRef->getChild( _pColumnRef->count()-1 )->getChild(0)->getTokenValue();
}
else
_out_rColumnName = _pColumnRef->getChild(0)->getTokenValue();
// look up the column in the select column, to find an possible alias
if ( _pSelectColumns )
{
for ( OSQLColumns::const_iterator lookupColumn = _pSelectColumns->begin();
lookupColumn != _pSelectColumns->end();
++lookupColumn
)
{
Reference< XPropertySet > xColumn( *lookupColumn );
try
{
::rtl::OUString sName, sTableName;
xColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_REALNAME ) ) >>= sName;
xColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_TABLENAME ) ) >>= sTableName;
if ( sName == _out_rColumnName && sTableName == _out_rTableRange )
xColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= _out_rColumnAliasIfPresent;
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
}
}
else if(SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec))
{ // Funktion
_pColumnRef->parseNodeToStr(_out_rColumnName,_xMetaData);
}
else if(_pColumnRef->getNodeType() == SQL_NODE_NAME)
_out_rColumnName = _pColumnRef->getTokenValue();
}
}
2002-07-15 11:34:56 +00:00
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef,
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
::rtl::OUString& _rColumnName,
2002-07-15 11:34:56 +00:00
::rtl::OUString& _rTableRange) const
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
::rtl::OUString sDummy;
lcl_getColumnRange( _pColumnRef, m_pImpl->m_xDatabaseMetaData, _rColumnName, _rTableRange, NULL, sDummy );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef,
::rtl::OUString& _rColumnName,
::rtl::OUString& _rTableRange,
::rtl::OUString& _out_rColumnAliasIfPresent ) const
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
lcl_getColumnRange( _pColumnRef, m_pImpl->m_xDatabaseMetaData, _rColumnName, _rTableRange, &*m_aSelectColumns, _out_rColumnAliasIfPresent );
}
2000-10-19 10:47:14 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef,
const Reference< XDatabaseMetaData>& _xMetaData, ::rtl::OUString& _out_rColumnName, ::rtl::OUString& _out_rTableRange )
{
::rtl::OUString sDummy;
lcl_getColumnRange( _pColumnRef, _xMetaData, _out_rColumnName, _out_rTableRange, NULL, sDummy );
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
2000-10-19 10:47:14 +00:00
sal_Bool OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const
2000-09-18 15:18:56 +00:00
{
// Ermitteln ob alle Spalten zu einer Tabelle gehoeren
if (SQL_ISRULE(pNode,column_ref))
{
2000-10-19 10:47:14 +00:00
::rtl::OUString aColName, aTableRange;
2000-09-18 15:18:56 +00:00
getColumnRange(pNode, aColName, aTableRange);
2000-10-19 10:47:14 +00:00
if (!aTableRange.getLength()) // keinen gefunden
2000-09-18 15:18:56 +00:00
{
// dann die Spalte in den Tabellen suchen
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
for (ConstOSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end(); ++aIter)
2000-09-18 15:18:56 +00:00
{
if (aIter->second.is())
{
try
{
Reference< XNameAccess > xColumns = aIter->second->getColumns();
if(xColumns->hasByName(aColName))
2000-09-18 15:18:56 +00:00
{
Reference< XPropertySet > xColumn;
if (xColumns->getByName(aColName) >>= xColumn)
{
OSL_ENSURE(xColumn.is(),"Column isn't a propertyset!");
aTableRange = aIter->first;
break;
}
2000-09-18 15:18:56 +00:00
}
}
catch(Exception&)
2000-09-18 15:18:56 +00:00
{
}
}
}
2000-10-19 10:47:14 +00:00
if (!aTableRange.getLength())
return sal_False;
2000-09-18 15:18:56 +00:00
}
2000-10-19 10:47:14 +00:00
if (!rTableRange.getLength())
2000-09-18 15:18:56 +00:00
rTableRange = aTableRange;
else if (rTableRange != aTableRange)
2000-10-19 10:47:14 +00:00
return sal_False;
2000-09-18 15:18:56 +00:00
}
else
{
2000-10-19 10:47:14 +00:00
for (sal_uInt32 i = 0, ncount = pNode->count(); i < ncount; i++)
2000-09-18 15:18:56 +00:00
{
if (!getColumnTableRange(pNode->getChild(i), rTableRange))
2000-10-19 10:47:14 +00:00
return sal_False;
2000-09-18 15:18:56 +00:00
}
}
2000-10-19 10:47:14 +00:00
return sal_True;
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNode)
{
// aIteratorStatus.Clear();
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if (!pSelectNode || m_eStatementType != SQL_STATEMENT_CREATE_TABLE || m_pImpl->m_pTables->empty())
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
impl_appendError( IParseContext::ERROR_GENERAL );
return;
}
if (!SQL_ISRULE(pSelectNode,base_table_element_commalist))
return ;
for (sal_uInt32 i = 0; i < pSelectNode->count(); i++)
{
OSQLParseNode *pColumnRef = pSelectNode->getChild(i);
if (SQL_ISRULE(pColumnRef,column_def))
{
::rtl::OUString aColumnName;
::rtl::OUString aTypeName;
::rtl::OUString aTableRange;
sal_Int32 nType = DataType::VARCHAR;
sal_Int32 nLen = 0;
aColumnName = pColumnRef->getChild(0)->getTokenValue();
OSQLParseNode *pDatatype = pColumnRef->getChild(1);
if (pDatatype && SQL_ISRULE(pDatatype,data_type))
{
//data type
// 0 | 1| 2 |3
//char ( 20 )
aTypeName = pDatatype->getChild(0)->getTokenValue();
if (pDatatype->count() == 4
&& SQL_ISPUNCTUATION(pDatatype->getChild(1), "(")
&& SQL_ISPUNCTUATION(pDatatype->getChild(3) , ")") )
{
nLen = pDatatype->getChild(2)->getTokenValue().toInt32();
}
}
else if(pDatatype && pDatatype->getNodeType() == SQL_NODE_KEYWORD)
{
aTypeName = ::rtl::OUString::createFromAscii("VARCHAR");
}
if (aTypeName.getLength())
{
//TO DO:Create a new class for create statement to handle field length
OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(),
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
ColumnValue::NULLABLE_UNKNOWN,0,0,nType,sal_False,sal_False,isCaseSensitive());
pColumn->setFunction(sal_False);
pColumn->setRealName(aColumnName);
Reference< XPropertySet> xCol = pColumn;
m_aCreateColumns->push_back(xCol);
}
}
}
}
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSelectNode)
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( ( m_pImpl->m_nIncludeMask & SelectColumns ) != SelectColumns )
return true;
2000-10-19 10:47:14 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if (!pSelectNode || m_eStatementType != SQL_STATEMENT_SELECT || m_pImpl->m_pTables->empty())
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
impl_appendError( IParseContext::ERROR_GENERAL );
return false;
2000-09-18 15:18:56 +00:00
}
if(SQL_ISRULE(pSelectNode,union_statement))
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return traverseSelectColumnNames( pSelectNode->getChild( 0 ) )
/*&& traverseSelectColumnNames( pSelectNode->getChild( 3 ) )*/;
2000-09-18 15:18:56 +00:00
}
// nyi: mehr Pruefung auf korrekte Struktur!
if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*"))
{
// SELECT * ...
setSelectColumnName(m_aSelectColumns,::rtl::OUString::createFromAscii("*"), aEmptyString,aEmptyString);
2000-09-18 15:18:56 +00:00
}
else if (SQL_ISRULE(pSelectNode->getChild(2),scalar_exp_commalist))
{
2001-01-09 12:11:07 +00:00
// SELECT column[,column] oder SELECT COUNT(*) ...
2000-09-18 15:18:56 +00:00
OSQLParseNode * pSelection = pSelectNode->getChild(2);
2000-10-19 10:47:14 +00:00
for (sal_uInt32 i = 0; i < pSelection->count(); i++)
2000-09-18 15:18:56 +00:00
{
OSQLParseNode *pColumnRef = pSelection->getChild(i);
2001-01-09 12:11:07 +00:00
//if (SQL_ISRULE(pColumnRef,select_sublist))
if (SQL_ISRULE(pColumnRef,derived_column) &&
SQL_ISRULE(pColumnRef->getChild(0),column_ref) &&
pColumnRef->getChild(0)->count() == 3 &&
SQL_ISPUNCTUATION(pColumnRef->getChild(0)->getChild(2),"*"))
2000-09-18 15:18:56 +00:00
{
// alle Spalten der Tabelle
2000-10-19 10:47:14 +00:00
::rtl::OUString aTableRange;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pColumnRef->getChild(0)->parseNodeToStr( aTableRange, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
setSelectColumnName(m_aSelectColumns,::rtl::OUString::createFromAscii("*"), aEmptyString,aTableRange);
2000-09-18 15:18:56 +00:00
continue;
}
else if (SQL_ISRULE(pColumnRef,derived_column))
2000-09-18 15:18:56 +00:00
{
2000-10-19 10:47:14 +00:00
::rtl::OUString aColumnAlias(getColumnAlias(pColumnRef)); // kann leer sein
::rtl::OUString sColumnName;
2000-10-19 10:47:14 +00:00
::rtl::OUString aTableRange;
sal_Int32 nType = DataType::VARCHAR;
2000-10-19 10:47:14 +00:00
sal_Bool bFkt(sal_False);
2000-09-18 15:18:56 +00:00
pColumnRef = pColumnRef->getChild(0);
if (
pColumnRef->count() == 3 &&
SQL_ISPUNCTUATION(pColumnRef->getChild(0),"(") &&
SQL_ISPUNCTUATION(pColumnRef->getChild(2),")")
)
pColumnRef = pColumnRef->getChild(1);
2000-09-18 15:18:56 +00:00
if (SQL_ISRULE(pColumnRef,column_ref))
{
getColumnRange(pColumnRef,sColumnName,aTableRange);
OSL_ENSURE(sColumnName.getLength(),"Columnname darf nicht leer sein");
2000-09-18 15:18:56 +00:00
}
else /*if (SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) ||
SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) ||
SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct)||
SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))*/
{
/* Funktionsaufruf vorhanden */
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_True );
::rtl::OUString sTableRange;
// check if the column is also a parameter
traverseORCriteria(pColumnRef); // num_value_exp
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseParameter( pColumnRef, NULL, sColumnName, sTableRange, aColumnAlias );
2000-09-18 15:18:56 +00:00
// gehoeren alle beteiligten Spalten der Funktion zu einer Tabelle
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if (m_pImpl->m_pTables->size() == 1)
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
aTableRange = m_pImpl->m_pTables->begin()->first;
2000-09-18 15:18:56 +00:00
}
else
{
getColumnTableRange(pColumnRef,aTableRange);
}
if ( pColumnRef->isRule() )
{
bFkt = sal_True;
if ( SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term) || SQL_ISRULE(pColumnRef,factor) )
{
nType = DataType::DOUBLE;
}
else
{
::rtl::OUString sFunctionName;
if ( SQL_ISRULE(pColumnRef,length_exp) )
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pColumnRef->getChild(0)->getChild(0)->parseNodeToStr(
sFunctionName, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
else
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pColumnRef->getChild(0)->parseNodeToStr(
sFunctionName, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
}
}
2000-09-18 15:18:56 +00:00
}
/*
else
{
aIteratorStatus.setStatementTooComplex();
return;
}
*/
2000-10-19 10:47:14 +00:00
if(!aColumnAlias.getLength())
aColumnAlias = sColumnName;
setSelectColumnName(m_aSelectColumns,sColumnName,aColumnAlias,aTableRange,bFkt,nType,SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec));
2000-09-18 15:18:56 +00:00
}
}
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return !hasErrors();
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
bool OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSelectNode)
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseByColumnNames( pSelectNode, sal_True );
return !hasErrors();
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder)
{
2000-09-18 15:18:56 +00:00
// aIteratorStatus.Clear();
if (pSelectNode == NULL)
{
//aIteratorStatus.setInvalidStatement();
return;
}
if (m_eStatementType != SQL_STATEMENT_SELECT)
{
//aIteratorStatus.setInvalidStatement();
return;
}
if(SQL_ISRULE(pSelectNode,union_statement))
{
traverseByColumnNames(pSelectNode->getChild(0),_bOrder);
2000-09-18 15:18:56 +00:00
return;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
sal_uInt32 nPos = ( _bOrder ? 4 : 2 );
OSQLParseNode * pOptByClause = pTableExp->getChild(nPos);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!");
if ( pOptByClause->count() == 0 )
2000-09-18 15:18:56 +00:00
return;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pOptByClause->count() == 3,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pOrderingSpecCommalist = pOptByClause->getChild(2);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pOrderingSpecCommalist != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(!_bOrder || SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OSQLParseTreeIterator:ordering_spec_commalist error in parse tree!");
OSL_ENSURE(pOrderingSpecCommalist->count() > 0,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
::rtl::OUString sColumnName,aColumnAlias;
2000-10-19 10:47:14 +00:00
::rtl::OUString aTableRange;
sal_uInt32 nCount = pOrderingSpecCommalist->count();
for (sal_uInt32 i = 0; i < nCount; ++i)
2000-09-18 15:18:56 +00:00
{
OSQLParseNode* pColumnRef = pOrderingSpecCommalist->getChild(i);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pColumnRef != NULL,"OSQLParseTreeIterator: error in parse tree!");
if ( _bOrder )
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(SQL_ISRULE(pColumnRef,ordering_spec),"OSQLParseTreeIterator:ordering_spec error in parse tree!");
OSL_ENSURE(pColumnRef->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pColumnRef = pColumnRef->getChild(0);
}
2000-10-19 10:47:14 +00:00
aTableRange = ::rtl::OUString();
sColumnName = ::rtl::OUString();
if ( SQL_ISRULE(pColumnRef,column_ref) )
2000-09-18 15:18:56 +00:00
{
// Column-Name (und TableRange):
if(SQL_ISRULE(pColumnRef,column_ref))
getColumnRange(pColumnRef,sColumnName,aTableRange);
2000-09-18 15:18:56 +00:00
else // eine Expression
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
2000-09-18 15:18:56 +00:00
OSL_ENSURE(sColumnName.getLength(),"sColumnName darf nicht leer sein");
2000-09-18 15:18:56 +00:00
}
else
{ // here I found a predicate
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pColumnRef != NULL,"OSQLParseTreeIterator: error in parse tree!");
if ( _bOrder )
2000-09-18 15:18:56 +00:00
{
// Ascending/Descending
OSQLParseNode * pOptAscDesc = pColumnRef->getParent()->getChild(1);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pOptAscDesc != NULL,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
sal_Bool bAscending = pOptAscDesc && SQL_ISTOKEN(pOptAscDesc,ASC);
setOrderByColumnName(sColumnName, aTableRange,bAscending);
}
else
setGroupByColumnName(sColumnName, aTableRange);
2000-09-18 15:18:56 +00:00
}
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
bool OSQLParseTreeIterator::traverseGroupByColumnNames(const OSQLParseNode* pSelectNode)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseByColumnNames( pSelectNode, sal_False );
return !hasErrors();
}
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSelectNode)
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( pSelectNode == NULL )
return false;
2000-09-18 15:18:56 +00:00
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf WHERE-Klausel setzen:
OSQLParseNode * pWhereClause = NULL;
if (m_eStatementType == SQL_STATEMENT_SELECT)
{
if(SQL_ISRULE(pSelectNode,union_statement))
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return traverseSelectionCriteria( pSelectNode->getChild( 0 ) )
&& traverseSelectionCriteria( pSelectNode->getChild( 3 ) );
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pWhereClause = pTableExp->getChild(1);
} else if (SQL_ISRULE(pSelectNode,update_statement_searched)) {
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSelectNode->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pWhereClause = pSelectNode->getChild(4);
} else if (SQL_ISRULE(pSelectNode,delete_statement_searched)) {
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSelectNode->count() == 4,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pWhereClause = pSelectNode->getChild(3);
} else if (SQL_ISRULE(pSelectNode,delete_statement_positioned)) {
// nyi
2000-10-19 10:47:14 +00:00
OSL_ASSERT("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi");
2000-09-18 15:18:56 +00:00
} else {
// Anderes Statement. Keine Selektionskriterien.
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return false;
2000-09-18 15:18:56 +00:00
}
if (! SQL_ISRULE(pWhereClause,where_clause)) {
// Die Where Clause ist meistens optional, d. h. es koennte sich auch
// um "optional_where_clause" handeln.
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(SQL_ISRULE(pWhereClause,opt_where_clause),"OSQLParseTreeIterator: error in parse tree!");
return false;
2000-09-18 15:18:56 +00:00
}
// Wenn es aber eine where_clause ist, dann darf sie nicht leer sein:
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pWhereClause->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pComparisonPredicate != NULL,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
//
// Und nun die Vergleichskriterien abarbeiten (rekursiv, alles ist erstmal ein OR-Kriterium):
//
traverseORCriteria(pComparisonPredicate);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
return !hasErrors();
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition)
{
2000-10-19 10:47:14 +00:00
2000-09-18 15:18:56 +00:00
if (
pSearchCondition->count() == 3 &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")
)
{
// Runde Klammern um den Ausdruck
traverseORCriteria(pSearchCondition->getChild(1));
} else if (SQL_ISRULE(pSearchCondition,search_condition) &&
pSearchCondition->count() == 3 &&
SQL_ISTOKEN(pSearchCondition->getChild(1),OR))
{
// OR-Verknuepfung:
for (int i = 0; i < 3; i++) {
if (i == 1) continue; // Schluesselwort OR ueberspringen
// Ist das erste Element wieder eine OR-Verknuepfung?
if (i == 0 &&
SQL_ISRULE(pSearchCondition->getChild(0),search_condition) &&
pSearchCondition->getChild(0)->count() == 3 &&
SQL_ISTOKEN(pSearchCondition->getChild(0)->getChild(1),OR))
{
// Dann rekursiv absteigen ...
traverseORCriteria(pSearchCondition->getChild(0));
} else {
// AND-Kriterien ...
traverseANDCriteria(pSearchCondition->getChild(i));
// if (! aIteratorStatus.IsSuccessful()) break;
}
// if (! aIteratorStatus.IsSuccessful()) break;
}
} else {
// Nur *ein* Kriterium oder eine AND-Verknuepfung von Kriterien.
// Direkt die AND-Kriterien behandeln.
traverseANDCriteria(pSearchCondition);
// if (! aIteratorStatus.IsSuccessful()) return;
}
// Fehler einfach weiterreichen.
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition)
{
2000-10-19 10:47:14 +00:00
2000-09-18 15:18:56 +00:00
if (
SQL_ISRULE(pSearchCondition,boolean_primary) &&
pSearchCondition->count() == 3 &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")
)
{
// Runde Klammern
traverseANDCriteria(pSearchCondition->getChild(1));
}
// Das erste Element ist eine OR-Verknuepfung
else if ( SQL_ISRULE(pSearchCondition,search_condition) && pSearchCondition->count() == 3 )
{
// Dann rekursiv absteigen (dieselbe Row benutzen) ...
traverseORCriteria(pSearchCondition->getChild(0));
// if (! aIteratorStatus.IsSuccessful())
// return;
// Und mit dem rechten Child weitermachen:
traverseANDCriteria(pSearchCondition->getChild(2));
}
// Das erste Element ist (wieder) eine AND-Verknuepfung
else if ( SQL_ISRULE(pSearchCondition,boolean_term) && pSearchCondition->count() == 3 )
{
// Dann rekursiv absteigen (dieselbe Row benutzen) ...
traverseANDCriteria(pSearchCondition->getChild(0));
// if (! aIteratorStatus.IsSuccessful())
// return;
// Und mit dem rechten Child weitermachen:
traverseANDCriteria(pSearchCondition->getChild(2));
}
// Sonst einzelne Suchkriterien wie =, !=, ..., LIKE, IS NULL usw. behandeln:
else if (SQL_ISRULE(pSearchCondition,comparison_predicate) )
{
2000-10-19 10:47:14 +00:00
::rtl::OUString aValue;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pSearchCondition->getChild(2)->parseNodeToStr( aValue, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
traverseOnePredicate(pSearchCondition->getChild(0),aValue,pSearchCondition->getChild(2));
2000-09-18 15:18:56 +00:00
// if (! aIteratorStatus.IsSuccessful())
// return;
}
else if (SQL_ISRULE(pSearchCondition,like_predicate) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSearchCondition->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
2000-09-29 14:13:06 +00:00
sal_Int32 nCurentPos = pSearchCondition->count()-2;
OSQLParseNode * pNum_value_exp = pSearchCondition->getChild(nCurentPos);
OSQLParseNode * pOptEscape = pSearchCondition->getChild(nCurentPos+1);
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pNum_value_exp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pOptEscape != NULL,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
if (pOptEscape->count() != 0)
{
// aIteratorStatus.setStatementTooComplex();
return;
}
2000-10-19 10:47:14 +00:00
::rtl::OUString aValue;
2000-09-18 15:18:56 +00:00
OSQLParseNode * pParam = NULL;
if (SQL_ISRULE(pNum_value_exp,parameter))
pParam = pNum_value_exp;
else if(pNum_value_exp->isToken())
// Normaler Wert
aValue = pNum_value_exp->getTokenValue();
else
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
pNum_value_exp->parseNodeToStr( aValue, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
2000-09-18 15:18:56 +00:00
pParam = pNum_value_exp;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseOnePredicate(pSearchCondition->getChild(0),aValue,pParam);
2000-09-18 15:18:56 +00:00
// if (! aIteratorStatus.IsSuccessful())
// return;
}
else if (SQL_ISRULE(pSearchCondition,in_predicate))
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSearchCondition->count() == 4,"OSQLParseTreeIterator: error in parse tree!");
traverseORCriteria(pSearchCondition->getChild(0));
// if (! aIteratorStatus.IsSuccessful()) return;
OSQLParseNode* pChild = pSearchCondition->getChild(3);
if ( SQL_ISRULE(pChild->getChild(0),subquery) )
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseTableNames( *m_pImpl->m_pSubTables );
traverseSelectionCriteria(pChild->getChild(0)->getChild(1));
}
else
{ // '(' value_exp_commalist ')'
pChild = pChild->getChild(1);
sal_Int32 nCount = pChild->count();
for (sal_Int32 i=0; i < nCount; ++i)
{
traverseANDCriteria(pChild->getChild(i));
}
}
}
2000-09-18 15:18:56 +00:00
else if (SQL_ISRULE(pSearchCondition,test_for_null) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pSearchCondition->count() >= 3,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISTOKEN(pSearchCondition->getChild(1),IS),"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
2000-10-19 10:47:14 +00:00
::rtl::OUString aString;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseOnePredicate(pSearchCondition->getChild(0),aString,NULL);
2000-09-18 15:18:56 +00:00
// if (! aIteratorStatus.IsSuccessful()) return;
2001-04-30 08:59:56 +00:00
}
else if (SQL_ISRULE(pSearchCondition,num_value_exp) || SQL_ISRULE(pSearchCondition,term))
{
::rtl::OUString aString;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
traverseOnePredicate(pSearchCondition->getChild(0),aString,pSearchCondition->getChild(0));
traverseOnePredicate(pSearchCondition->getChild(2),aString,pSearchCondition->getChild(2));
2000-09-18 15:18:56 +00:00
}
// Fehler einfach weiterreichen.
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseParameter(OSQLParseNode* _pParseNode
,OSQLParseNode* _pColumnRef
,const ::rtl::OUString& _aColumnName
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
,const ::rtl::OUString& _aTableRange
,const ::rtl::OUString& _rColumnAlias)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( !SQL_ISRULE( _pParseNode, parameter ) )
return;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( ( m_pImpl->m_nIncludeMask & Parameters ) != Parameters )
// parameters not to be included in the traversal
return;
OSL_ENSURE(_pParseNode->count() > 0,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pMark = _pParseNode->getChild(0);
::rtl::OUString sParameterName;
if (SQL_ISPUNCTUATION(pMark,"?"))
{
sParameterName = _rColumnAlias.getLength()
? _rColumnAlias
: _aColumnName.getLength()
? _aColumnName
: ::rtl::OUString::createFromAscii("?");
}
else if (SQL_ISPUNCTUATION(pMark,":"))
{
sParameterName = _pParseNode->getChild(1)->getTokenValue();
}
else if (SQL_ISPUNCTUATION(pMark,"["))
{
sParameterName = _pParseNode->getChild(1)->getTokenValue();
}
else
{
OSL_ASSERT("OSQLParseTreeIterator: error in parse tree!");
}
// found a parameter
if ( _pColumnRef && (SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) )
{// found a function as column_ref
::rtl::OUString sFunctionName;
_pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xDatabaseMetaData, NULL, sal_False, sal_False );
sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
OParseColumn* pColumn = new OParseColumn( sParameterName,
::rtl::OUString(),
::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
nType,
sal_False,
sal_False,
isCaseSensitive());
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(sal_True);
pColumn->setRealName(sFunctionName);
m_aParameters->push_back(pColumn);
}
else
{
sal_Bool bNotFound = sal_True;
OSQLColumns::const_iterator aIter = ::connectivity::find(
m_aSelectColumns->begin(),
m_aSelectColumns->end(),
_aColumnName,::comphelper::UStringMixEqual( isCaseSensitive() )
);
if(aIter != m_aSelectColumns->end())
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OParseColumn* pNewColumn = new OParseColumn(*aIter,isCaseSensitive());
pNewColumn->setName(sParameterName);
pNewColumn->setRealName(_aColumnName);
m_aParameters->push_back(pNewColumn);
bNotFound = sal_False;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else if(_aColumnName.getLength())// search in the tables for the right one
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
Reference<XPropertySet> xColumn = findColumn( _aColumnName, _aTableRange, true );
if ( xColumn.is() )
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OParseColumn* pNewColumn = new OParseColumn(xColumn,isCaseSensitive());
pNewColumn->setName(sParameterName);
pNewColumn->setRealName(_aColumnName);
m_aParameters->push_back(pNewColumn);
bNotFound = sal_False;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
}
if ( bNotFound )
{
::rtl::OUString aNewColName( getUniqueColumnName( sParameterName ) );
OParseColumn* pColumn = new OParseColumn(aNewColName,
::rtl::OUString(),
::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
DataType::VARCHAR,
sal_False,
sal_False,
isCaseSensitive() );
pColumn->setName(aNewColName);
pColumn->setRealName(sParameterName);
m_aParameters->push_back(pColumn);
}
}
}
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseOnePredicate(
OSQLParseNode * pColumnRef,
2000-10-19 10:47:14 +00:00
::rtl::OUString& rValue,
2000-09-18 15:18:56 +00:00
OSQLParseNode * pParseNode)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( !pParseNode )
return;
2000-09-18 15:18:56 +00:00
// Column-Name (und TableRange):
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
::rtl::OUString aColumnName, aTableRange, sColumnAlias;
getColumnRange( pColumnRef, aColumnName, aTableRange, sColumnAlias);
2000-09-18 15:18:56 +00:00
2000-10-19 10:47:14 +00:00
::rtl::OUString aName;
2001-04-30 08:59:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if (SQL_ISRULE(pParseNode,parameter))
traverseParameter( pParseNode, pColumnRef, aColumnName, aTableRange, sColumnAlias );
else if (SQL_ISRULE(pParseNode,column_ref))// Column-Name (und TableRange):
getColumnRange(pParseNode,aName,rValue);
else
{
traverseORCriteria(pParseNode);
// if (! aIteratorStatus.IsSuccessful()) return;
2000-09-18 15:18:56 +00:00
}
}
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
void OSQLParseTreeIterator::traverseSome( sal_uInt32 _nIncludeMask )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
impl_traverse( _nIncludeMask );
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseAll()
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
impl_traverse( All );
}
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_traverse( sal_uInt32 _nIncludeMask )
{
impl_resetErrors();
m_pImpl->m_nIncludeMask = _nIncludeMask;
if ( !traverseTableNames( *m_pImpl->m_pTables ) )
return;
switch ( m_eStatementType )
{
case SQL_STATEMENT_SELECT:
2000-09-18 15:18:56 +00:00
{
const OSQLParseNode* pSelectNode = m_pParseTree;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if ( !traverseSelectColumnNames( pSelectNode )
|| !traverseOrderByColumnNames( pSelectNode )
|| !traverseGroupByColumnNames( pSelectNode )
|| !traverseSelectionCriteria( pSelectNode )
)
return;
}
break;
case SQL_STATEMENT_CREATE_TABLE:
{
//0 | 1 | 2 |3| 4 |5
//create table sc.foo ( a char(20), b char )
const OSQLParseNode* pCreateNode = m_pParseTree->getChild(4);
traverseCreateColumns(pCreateNode);
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
break;
default:
OSL_ENSURE( false, "OSQLParseTreeIterator::traverseAll: not yet implemented for this statement type!" );
break;
}
2000-09-18 15:18:56 +00:00
}
// Dummy-Implementationen:
//-----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSQLTable OSQLParseTreeIterator::impl_createTableObject( const ::rtl::OUString& rTableName,
const ::rtl::OUString& rCatalogName, const ::rtl::OUString& rSchemaName )
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_PRECOND( m_eStatementType == SQL_STATEMENT_CREATE_TABLE,
"OSQLParseTreeIterator::impl_createTableObject: only to be called for CREATE TABLE statements!" );
// (in all other cases, m_pTables is to contain the table objects as obtained from the tables
// container of the connection (m_xTablesContainer)
OSQLTable aReturnTable = new OTable(
NULL,
sal_False,
rTableName,
::rtl::OUString::createFromAscii("Table"),
::rtl::OUString::createFromAscii("New Created Table"),
rSchemaName,
rCatalogName
);
return aReturnTable;
2000-09-18 15:18:56 +00:00
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::appendColumns(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString& _rTableAlias,const OSQLTable& _rTable)
2000-09-18 15:18:56 +00:00
{
2000-10-19 10:47:14 +00:00
2000-09-18 15:18:56 +00:00
if (!_rTable.is())
return;
Reference<XNameAccess> xColumns = _rTable->getColumns();
if ( !xColumns.is() )
return;
2000-09-18 15:18:56 +00:00
Sequence< ::rtl::OUString > aColNames = xColumns->getElementNames();
const ::rtl::OUString* pBegin = aColNames.getConstArray();
const ::rtl::OUString* pEnd = pBegin + aColNames.getLength();
for(;pBegin != pEnd;++pBegin)
{
2001-02-01 12:10:17 +00:00
::rtl::OUString aName(getUniqueColumnName(*pBegin));
2000-10-30 06:47:10 +00:00
Reference< XPropertySet > xColumn;
if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is())
2000-09-18 15:18:56 +00:00
{
2001-02-01 12:10:17 +00:00
OParseColumn* pColumn = new OParseColumn(aName
2001-05-14 10:42:44 +00:00
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
, getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)))
, getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
, isCaseSensitive() );
2001-02-01 12:10:17 +00:00
pColumn->setTableName(_rTableAlias);
pColumn->setRealName(*pBegin);
2000-10-30 06:47:10 +00:00
Reference< XPropertySet> xCol = pColumn;
_rColumns->push_back(xCol);
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
else
impl_appendError( IParseContext::ERROR_INVALID_COLUMN, pBegin, &_rTableAlias );
2000-09-18 15:18:56 +00:00
}
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString & rColumnName,const ::rtl::OUString & rColumnAlias, const ::rtl::OUString & rTableRange,sal_Bool bFkt,sal_Int32 _nType,sal_Bool bAggFkt)
2000-09-18 15:18:56 +00:00
{
2000-10-19 10:47:14 +00:00
if(rColumnName.toChar() == '*' && !rTableRange.getLength())
2000-09-18 15:18:56 +00:00
{ // Suche "uber alle vorkommenden Tabellen
OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
for(ConstOSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end();++aIter)
appendColumns(_rColumns,aIter->first,aIter->second);
2000-09-18 15:18:56 +00:00
}
2000-10-19 10:47:14 +00:00
else if(rColumnName.toChar() == '*' && rTableRange.getLength()) // alle Columns aus dieser Tabelle
2000-09-18 15:18:56 +00:00
{
OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
ConstOSQLTablesIterator aFind = m_pImpl->m_pTables->find(rTableRange);
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if(aFind == m_pImpl->m_pTables->end())
2000-09-18 15:18:56 +00:00
{
2000-10-19 10:47:14 +00:00
::rtl::OUString strExpression = rTableRange;
strExpression += ::rtl::OUString::createFromAscii(".");
2000-09-18 15:18:56 +00:00
strExpression += rColumnName;
}
else
appendColumns(_rColumns,rTableRange,aFind->second);
2000-09-18 15:18:56 +00:00
}
else if( !rTableRange.getLength() )// ein Columnname existiert
2000-09-18 15:18:56 +00:00
{
if(!bFkt)
{
sal_uInt32 ncount = _rColumns->size();
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
for(OSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end(); ++aIter)
2000-09-18 15:18:56 +00:00
{
if (aIter->second.is())
{
Reference<XNameAccess> xColumns = aIter->second->getColumns();
2000-10-30 06:47:10 +00:00
Reference< XPropertySet > xColumn;
if ( xColumns->hasByName(rColumnName) && (xColumns->getByName(rColumnName) >>= xColumn) )
2000-09-18 15:18:56 +00:00
{
OSL_ENSURE(xColumn.is(),"Column isn't a propertyset!");
2000-10-19 10:47:14 +00:00
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
2000-09-18 15:18:56 +00:00
Reference< XPropertySet> xCol;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OParseColumn* pColumn = new OParseColumn(xColumn,isCaseSensitive());
xCol = pColumn;
2000-09-18 15:18:56 +00:00
pColumn->setTableName(aIter->first);
pColumn->setName(aNewColName);
pColumn->setRealName(rColumnName);
_rColumns->push_back(xCol);
2000-09-18 15:18:56 +00:00
continue; // diese Column darf nur einmal vorkommen
}
}
}
if ( ncount == _rColumns->size() )
2000-09-18 15:18:56 +00:00
{
2000-10-19 10:47:14 +00:00
::rtl::OUString strExpression = rTableRange;
if (strExpression.getLength())
strExpression += ::rtl::OUString::createFromAscii(".");
2000-09-18 15:18:56 +00:00
strExpression += rColumnName;
}
}
else
{
2000-10-19 10:47:14 +00:00
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
2000-09-18 15:18:56 +00:00
OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive());
2000-09-18 15:18:56 +00:00
pColumn->setFunction(bFkt);
pColumn->setAggregateFunction(bAggFkt);
2000-09-18 15:18:56 +00:00
pColumn->setRealName(rColumnName);
2000-10-30 06:47:10 +00:00
Reference< XPropertySet> xCol = pColumn;
_rColumns->push_back(xCol);
2000-09-18 15:18:56 +00:00
}
}
else // ColumnName und Tablename vorhanden
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
ConstOSQLTablesIterator aFind = m_pImpl->m_pTables->find(rTableRange);
2000-09-18 15:18:56 +00:00
2000-10-19 10:47:14 +00:00
sal_Bool bError = sal_False;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
if (aFind != m_pImpl->m_pTables->end() && aFind->second.is())
2000-09-18 15:18:56 +00:00
{
if (bFkt)
{
2000-10-19 10:47:14 +00:00
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
2000-09-18 15:18:56 +00:00
OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive());
2000-09-18 15:18:56 +00:00
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(bAggFkt);
2000-09-18 15:18:56 +00:00
pColumn->setRealName(rColumnName);
pColumn->setTableName(aFind->first);
2000-10-30 06:47:10 +00:00
Reference< XPropertySet> xCol = pColumn;
_rColumns->push_back(xCol);
2000-09-18 15:18:56 +00:00
}
else
{
2000-10-30 06:47:10 +00:00
Reference< XPropertySet > xColumn;
if (aFind->second->getColumns()->hasByName(rColumnName) && (aFind->second->getColumns()->getByName(rColumnName) >>= xColumn))
2000-09-18 15:18:56 +00:00
{
2000-10-19 10:47:14 +00:00
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
2000-09-18 15:18:56 +00:00
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OParseColumn* pColumn = new OParseColumn(xColumn,isCaseSensitive());
2000-09-18 15:18:56 +00:00
pColumn->setName(aNewColName);
pColumn->setRealName(rColumnName);
pColumn->setTableName(aFind->first);
2000-10-30 06:47:10 +00:00
Reference< XPropertySet> xCol = pColumn;
_rColumns->push_back(xCol);
2000-09-18 15:18:56 +00:00
}
else
2000-10-19 10:47:14 +00:00
bError = sal_True;
2000-09-18 15:18:56 +00:00
}
}
else
2000-10-19 10:47:14 +00:00
bError = sal_True;
2000-09-18 15:18:56 +00:00
// Tabelle existiert nicht oder Feld nicht vorhanden
if (bError)
{
2000-10-19 10:47:14 +00:00
::rtl::OUString strExpression = rTableRange;
if (strExpression.getLength())
strExpression += ::rtl::OUString::createFromAscii(".");
2000-09-18 15:18:56 +00:00
strExpression += rColumnName;
2000-10-19 10:47:14 +00:00
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
2000-09-18 15:18:56 +00:00
OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,isCaseSensitive());
2000-09-18 15:18:56 +00:00
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(bAggFkt);
2000-09-18 15:18:56 +00:00
2000-10-30 06:47:10 +00:00
Reference< XPropertySet> xCol = pColumn;
_rColumns->push_back(xCol);
2000-09-18 15:18:56 +00:00
}
}
}
//-----------------------------------------------------------------------------
2000-10-19 10:47:14 +00:00
::rtl::OUString OSQLParseTreeIterator::getUniqueColumnName(const ::rtl::OUString & rColumnName) const
2000-09-18 15:18:56 +00:00
{
::rtl::OUString aAlias(rColumnName);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSQLColumns::const_iterator aIter = find(
m_aSelectColumns->begin(),
m_aSelectColumns->end(),
aAlias,
::comphelper::UStringMixEqual( isCaseSensitive() )
);
2000-09-18 15:18:56 +00:00
sal_Int32 i=1;
while(aIter != m_aSelectColumns->end())
{
(aAlias = rColumnName) += ::rtl::OUString::valueOf(i++);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
aIter = find(
m_aSelectColumns->begin(),
m_aSelectColumns->end(),
aAlias,
::comphelper::UStringMixEqual( isCaseSensitive() )
);
2000-09-18 15:18:56 +00:00
}
return aAlias;
}
//-----------------------------------------------------------------------------
2000-10-19 10:47:14 +00:00
void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange,sal_Bool bAscending)
2000-09-18 15:18:56 +00:00
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
Reference<XPropertySet> xColumn = findColumn( rColumnName, rTableRange, false );
if ( xColumn.is() )
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_aOrderColumns->push_back(new OOrderColumn(xColumn,isCaseSensitive(),bAscending));
else
{
sal_Int32 nId = rColumnName.toInt32();
if ( nId > 0 && nId < static_cast<sal_Int32>(m_aSelectColumns->size()) )
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_aOrderColumns->push_back(new OOrderColumn((*m_aSelectColumns)[nId-1],isCaseSensitive(),bAscending));
}
2000-09-18 15:18:56 +00:00
#ifdef SQL_TEST_PARSETREEITERATOR
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
2000-10-19 10:47:14 +00:00
<< (bAscending ? "sal_True" : "sal_False")
2000-09-18 15:18:56 +00:00
<< "\n";
#endif
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
Reference<XPropertySet> xColumn = findColumn( rColumnName, rTableRange, false );
if ( xColumn.is() )
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_aGroupColumns->push_back(new OParseColumn(xColumn,isCaseSensitive()));
else
{
sal_Int32 nId = rColumnName.toInt32();
if ( nId > 0 && nId < static_cast<sal_Int32>(m_aSelectColumns->size()) )
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
m_aGroupColumns->push_back(new OParseColumn((*m_aSelectColumns)[nId-1],isCaseSensitive()));
}
2000-09-18 15:18:56 +00:00
#ifdef SQL_TEST_PARSETREEITERATOR
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
<< (bAscending ? "sal_True" : "sal_False")
<< "\n";
#endif
}
2000-09-18 15:18:56 +00:00
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const
{
2000-10-19 10:47:14 +00:00
2000-09-18 15:18:56 +00:00
if (!m_pParseTree)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf WHERE-Klausel setzen:
OSQLParseNode * pWhereClause = NULL;
if(getStatementType() == SQL_STATEMENT_SELECT)
{
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pWhereClause = pTableExp->getChild(1);
}
else if (SQL_ISRULE(m_pParseTree,update_statement_searched) ||
SQL_ISRULE(m_pParseTree,delete_statement_searched))
{
pWhereClause = m_pParseTree->getChild(m_pParseTree->count()-1);
}
if(pWhereClause->count() != 2)
pWhereClause = NULL;
return pWhereClause;
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const
{
2000-10-19 10:47:14 +00:00
2000-09-18 15:18:56 +00:00
if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf ORDER-Klausel setzen:
OSQLParseNode * pOrderClause = NULL;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pOrderClause = pTableExp->getChild(4);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pOrderClause->count() != 3)
pOrderClause = NULL;
return pOrderClause;
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const
{
if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf ORDER-Klausel setzen:
OSQLParseNode * pGroupClause = NULL;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
2001-10-26 07:04:06 +00:00
pGroupClause = pTableExp->getChild(2);
2000-09-18 15:18:56 +00:00
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pGroupClause->count() != 3)
pGroupClause = NULL;
return pGroupClause;
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const
{
if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf ORDER-Klausel setzen:
OSQLParseNode * pHavingClause = NULL;
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
2000-09-18 15:18:56 +00:00
pHavingClause = pTableExp->getChild(3);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pHavingClause->count() < 1)
pHavingClause = NULL;
return pHavingClause;
}
2001-01-09 12:11:07 +00:00
// -----------------------------------------------------------------------------
sal_Bool OSQLParseTreeIterator::isTableNode(const OSQLParseNode* _pTableNode) const
{
return _pTableNode && (SQL_ISRULE(_pTableNode,catalog_name) ||
SQL_ISRULE(_pTableNode,schema_name) ||
SQL_ISRULE(_pTableNode,table_name));
}
2001-02-23 13:54:11 +00:00
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleWhereTree() const
{
const OSQLParseNode* pNode = getWhereTree();
return pNode ? pNode->getChild(1) : NULL;
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleOrderTree() const
{
const OSQLParseNode* pNode = getOrderTree();
return pNode ? pNode->getChild(2) : NULL;
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleGroupByTree() const
{
const OSQLParseNode* pNode = getGroupByTree();
return pNode ? pNode->getChild(2) : NULL;
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleHavingTree() const
{
const OSQLParseNode* pNode = getHavingTree();
return pNode ? pNode->getChild(1) : NULL;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
// -----------------------------------------------------------------------------
Reference< XPropertySet > OSQLParseTreeIterator::findColumn( const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, bool _bLookInSubTables )
{
Reference< XPropertySet > xColumn = findColumn( *m_pImpl->m_pTables, rColumnName, rTableRange );
if ( !xColumn.is() && _bLookInSubTables )
xColumn = findColumn( *m_pImpl->m_pSubTables, rColumnName, rTableRange );
return xColumn;
}
// -----------------------------------------------------------------------------
Reference< XPropertySet > OSQLParseTreeIterator::findColumn(const OSQLTables& _rTables,const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange)
{
Reference< XPropertySet > xColumn;
if ( rTableRange.getLength() )
{
ConstOSQLTablesIterator aFind = _rTables.find(rTableRange);
2000-10-19 10:47:14 +00:00
if ( aFind != _rTables.end()
&& aFind->second.is()
&& aFind->second->getColumns().is()
&& aFind->second->getColumns()->hasByName(rColumnName) )
aFind->second->getColumns()->getByName(rColumnName) >>= xColumn;
}
if ( !xColumn.is() )
{
OSQLTables::const_iterator aEnd = _rTables.end();
for(OSQLTables::const_iterator aIter = _rTables.begin(); aIter != aEnd; ++aIter)
{
if ( aIter->second.is() )
{
Reference<XNameAccess> xColumns = aIter->second->getColumns();
if( xColumns.is() && xColumns->hasByName(rColumnName) && (xColumns->getByName(rColumnName) >>= xColumn) )
{
OSL_ENSURE(xColumn.is(),"Column isn't a propertyset!");
break; // diese Column darf nur einmal vorkommen
}
}
}
}
return xColumn;
}
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
// -----------------------------------------------------------------------------
INTEGRATION: CWS qiq (1.46.78); FILE MERGED 2006/07/04 07:16:34 fs 1.46.78.17: #i10000# 2006/06/30 14:55:36 fs 1.46.78.16: corected parameter in sub query parsing 2006/06/30 13:34:08 fs 1.46.78.15: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:32:39 fs 1.46.78.14: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:19:37 fs 1.46.78.13: #i51143# localize the error message about cyclic sub queries 2006/06/30 13:06:25 fs 1.46.78.12: #i51143# protect against cyclic references in the query names 2006/06/28 08:40:40 fs 1.46.78.11: #i10000# 2006/06/28 07:39:19 fs 1.46.78.10: #i10000# 2006/06/27 15:10:24 fs 1.46.78.9: RESYNC: (1.46-1.47); FILE MERGED 2006/06/26 21:11:50 fs 1.46.78.8: layout 2006/06/09 13:05:40 fs 1.46.78.7: corrected an assertion 2006/06/07 12:18:06 fs 1.46.78.6: #i51143# allow subqueries in FROM / getTableRef -> getTableNode 2006/05/23 13:54:37 fs 1.46.78.5: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/19 08:15:57 fs 1.46.78.4: #i51143# more fine grained error messages about existing tables/queries 2006/05/16 20:09:21 fs 1.46.78.3: #i51143# minor refactoring 2006/05/15 13:45:33 fs 1.46.78.2: #i51143# heavily extended the heuristics to allow queries in queries - still need a better indicator for allowing this feature 2006/05/10 10:53:22 fs 1.46.78.1: primary change: #i51143# allow the iterator to also recognize queries secondary change: some code cleanup: - removed unused code - "warnings" replaced with "errors" (since this is what they are)
2006-07-10 13:38:34 +00:00
void OSQLParseTreeIterator::impl_appendError( IParseContext::ErrorCode _eError, const ::rtl::OUString* _pReplaceToken1, const ::rtl::OUString* _pReplaceToken2 )
{
::rtl::OUString sErrorMessage = m_rParser.getContext().getErrorMessage( _eError );
if ( _pReplaceToken1 )
{
sErrorMessage = sErrorMessage.replaceAt( sErrorMessage.indexOf('#'), 1, *_pReplaceToken1 );
if ( _pReplaceToken2 )
sErrorMessage = sErrorMessage.replaceAt( sErrorMessage.indexOf('#'), 1, *_pReplaceToken2 );
}
impl_appendError( SQLException(
sErrorMessage, NULL, getStandardSQLState( SQL_GENERAL_ERROR ), 1000, Any() ) );
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_appendError( const SQLException& _rError )
{
if ( m_aErrors.Message.getLength() )
{
SQLException* pErrorChain = &m_aErrors;
while ( pErrorChain->NextException.hasValue() )
pErrorChain = static_cast< SQLException* >( pErrorChain->NextException.pData );
pErrorChain->NextException <<= _rError;
}
else
m_aErrors = _rError;
}