2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-10-05 07:39:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 08:06:27 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
2008-04-10 08:06:27 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
2008-04-10 08:06:27 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
2008-04-10 08:06:27 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
2008-04-10 08:06:27 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
2008-04-10 08:06:27 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-10-05 07:39:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 01:36:18 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_connectivity.hxx"
|
2000-10-05 07:39:29 +00:00
|
|
|
#include "file/fcomp.hxx"
|
|
|
|
#include <tools/debug.hxx>
|
2001-05-14 10:42:44 +00:00
|
|
|
#include "TConnection.hxx"
|
2000-10-05 07:39:29 +00:00
|
|
|
#include "connectivity/sqlparse.hxx"
|
|
|
|
#include "file/fanalyzer.hxx"
|
|
|
|
#include <com/sun/star/sdbc/XColumnLocate.hpp>
|
2001-08-09 11:54:45 +00:00
|
|
|
#include <com/sun/star/util/DateTime.hpp>
|
|
|
|
#include <com/sun/star/util/Date.hpp>
|
|
|
|
#include <com/sun/star/util/Time.hpp>
|
2001-01-25 07:26:21 +00:00
|
|
|
#include "connectivity/dbexception.hxx"
|
2001-08-09 11:54:45 +00:00
|
|
|
#include "connectivity/dbconversion.hxx"
|
2004-03-15 11:47:22 +00:00
|
|
|
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
|
2008-10-01 12:28:29 +00:00
|
|
|
#include "resource/file_res.hrc"
|
2003-09-04 07:26:30 +00:00
|
|
|
#include "file/FStringFunctions.hxx"
|
|
|
|
#include "file/FDateFunctions.hxx"
|
|
|
|
#include "file/FNumericFunctions.hxx"
|
2008-10-01 12:28:29 +00:00
|
|
|
#include "file/FConnection.hxx"
|
2004-08-02 16:04:09 +00:00
|
|
|
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
|
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
using namespace connectivity;
|
|
|
|
using namespace connectivity::file;
|
|
|
|
using namespace com::sun::star::uno;
|
|
|
|
using namespace com::sun::star::sdbc;
|
2004-03-15 11:47:22 +00:00
|
|
|
using namespace com::sun::star::sdb;
|
2000-10-05 07:39:29 +00:00
|
|
|
using namespace ::com::sun::star::container;
|
2001-08-09 11:54:45 +00:00
|
|
|
using namespace ::com::sun::star::util;
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2006-06-20 00:27:29 +00:00
|
|
|
DBG_NAME(OPredicateCompiler)
|
2000-10-05 07:39:29 +00:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
OPredicateCompiler::OPredicateCompiler(OSQLAnalyzer* pAnalyzer)//,OCursor& rCurs)
|
|
|
|
: m_pAnalyzer(pAnalyzer)
|
2001-04-10 07:51:30 +00:00
|
|
|
, m_nParamCounter(0)
|
2006-06-20 00:27:29 +00:00
|
|
|
, m_bORCondition(FALSE)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
|
|
|
DBG_CTOR(OPredicateCompiler,NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
OPredicateCompiler::~OPredicateCompiler()
|
|
|
|
{
|
|
|
|
Clean();
|
|
|
|
DBG_DTOR(OPredicateCompiler,NULL);
|
|
|
|
}
|
2000-11-03 13:21:22 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OPredicateCompiler::dispose()
|
|
|
|
{
|
|
|
|
Clean();
|
2001-05-07 09:37:54 +00:00
|
|
|
m_orgColumns = NULL;
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xIndexes.clear();
|
2000-11-03 13:21:22 +00:00
|
|
|
}
|
2011-02-18 19:35:44 -05:00
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
|
|
|
|
{
|
|
|
|
if (!pSQLParseNode)
|
|
|
|
return;
|
|
|
|
|
2001-04-10 07:51:30 +00:00
|
|
|
m_nParamCounter = 0;
|
2011-02-18 21:46:25 +01:00
|
|
|
// analyse Parse Tree (depending on Statement-type)
|
|
|
|
// and set pointer on WHERE-clause:
|
2000-10-05 07:39:29 +00:00
|
|
|
OSQLParseNode * pWhereClause = NULL;
|
|
|
|
OSQLParseNode * pOrderbyClause = NULL;
|
|
|
|
|
|
|
|
if (SQL_ISRULE(pSQLParseNode,select_statement))
|
|
|
|
{
|
|
|
|
DBG_ASSERT(pSQLParseNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
|
|
|
|
OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
|
|
|
|
DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree");
|
|
|
|
DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree");
|
|
|
|
DBG_ASSERT(pTableExp->count() == 5,"Fehler im Parse Tree");
|
|
|
|
|
2003-03-19 15:38:50 +00:00
|
|
|
// check that we don't use anything other than count(*) as function
|
|
|
|
OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
|
|
|
|
if ( SQL_ISRULE(pSelection,scalar_exp_commalist) )
|
|
|
|
{
|
|
|
|
for (sal_uInt32 i = 0; i < pSelection->count(); i++)
|
|
|
|
{
|
|
|
|
OSQLParseNode *pColumnRef = pSelection->getChild(i)->getChild(0);
|
2003-09-04 07:26:30 +00:00
|
|
|
if ( SQL_ISRULE(pColumnRef,general_set_fct) && pColumnRef->count() != 4 )
|
2003-03-19 15:38:50 +00:00
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL);
|
2003-03-19 15:38:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
pWhereClause = pTableExp->getChild(1);
|
|
|
|
pOrderbyClause = pTableExp->getChild(4);
|
2011-02-03 13:17:05 +00:00
|
|
|
(void)pOrderbyClause;
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
else if (SQL_ISRULE(pSQLParseNode,update_statement_searched))
|
|
|
|
{
|
|
|
|
DBG_ASSERT(pSQLParseNode->count() == 5,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
pWhereClause = pSQLParseNode->getChild(4);
|
|
|
|
}
|
|
|
|
else if (SQL_ISRULE(pSQLParseNode,delete_statement_searched))
|
|
|
|
{
|
|
|
|
DBG_ASSERT(pSQLParseNode->count() == 4,"Fehler im Parse Tree");
|
|
|
|
pWhereClause = pSQLParseNode->getChild(3);
|
|
|
|
}
|
|
|
|
else
|
2011-02-18 21:46:25 +01:00
|
|
|
// Other Statement. no selection-criteria
|
2000-10-05 07:39:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (SQL_ISRULE(pWhereClause,where_clause))
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// a where-clause is not allowed to be empty:
|
2000-10-05 07:39:29 +00:00
|
|
|
DBG_ASSERT(pWhereClause->count() == 2,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
|
|
|
|
OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1);
|
|
|
|
DBG_ASSERT(pComparisonPredicate != NULL,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
|
2003-09-04 07:26:30 +00:00
|
|
|
execute( pComparisonPredicate );
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// The where-clause is optionally in the majority of cases, i.e. it might be an "optional-where-clause".
|
2001-04-30 09:16:19 +00:00
|
|
|
DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OPredicateCompiler: Fehler im Parse Tree");
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
|
|
|
|
{
|
|
|
|
OOperand* pOperand = NULL;
|
2011-02-18 21:46:25 +01:00
|
|
|
if (pPredicateNode->count() == 3 && // Expression is bracketed
|
2000-10-05 07:39:29 +00:00
|
|
|
SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"(") &&
|
|
|
|
SQL_ISPUNCTUATION(pPredicateNode->getChild(2),")"))
|
|
|
|
{
|
|
|
|
execute(pPredicateNode->getChild(1));
|
|
|
|
}
|
|
|
|
else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term)))
|
2011-02-18 21:46:25 +01:00
|
|
|
&& // AND/OR-linkage:
|
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected
2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte
2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name
2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard
2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus
2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up
2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up
2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct
2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0
2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected
2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string
2009-07-20 11:40:39 +0200 fs r274117 : removed unused include
2009-07-20 11:40:01 +0200 fs r274116 : class name corrected
2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path
2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst
2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar
2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well
2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths
2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality
2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52)
2009-07-01 21:41:50 +0200 fs r273614 : #i10000#
2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents
2009-07-01 12:10:31 +0200 fs r273562 : updated
2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names
2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays
2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder
2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb
2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d
2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions
2009-06-29 10:01:13 +0200 fs r273453 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays
2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899#
2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes
2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes
2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log
2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts
2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string
2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime
2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata
2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge
2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved
2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set
2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge
2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge
2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing
2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d
2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries?
2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed
2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix
2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section
2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox
2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop
2009-06-19 13:18:26 +0200 oj r273157 : remove unused param
2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50)
2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e
2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e
2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e
2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50
2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text
2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any
2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid
2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ...
2009-06-10 09:53:20 +0200 oj r272797 : add lic text
2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618
2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed
2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property
2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases
2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases
2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases
2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid
2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing
2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType
2009-06-08 13:51:20 +0200 oj r272730 : add tests
2009-06-05 14:38:01 +0200 oj r272686 : add dep
2009-06-05 14:35:00 +0200 oj r272684 : add new tests
2009-06-05 13:41:18 +0200 oj r272681 : code clean ups
2009-06-05 12:40:51 +0200 oj r272678 : code cleanup
2009-06-05 12:02:57 +0200 oj r272677 : code cleanup
2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML
2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard
2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 10:09:17 +00:00
|
|
|
pPredicateNode->count() == 3)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
execute(pPredicateNode->getChild(0)); // process the left branch
|
|
|
|
execute(pPredicateNode->getChild(2)); // process the right branch
|
2000-10-05 07:39:29 +00:00
|
|
|
|
|
|
|
if (SQL_ISTOKEN(pPredicateNode->getChild(1),OR)) // OR-Operator
|
|
|
|
{
|
|
|
|
m_aCodeList.push_back(new OOp_OR());
|
|
|
|
m_bORCondition = sal_True;
|
|
|
|
}
|
|
|
|
else if (SQL_ISTOKEN(pPredicateNode->getChild(1),AND)) // AND-Operator
|
|
|
|
m_aCodeList.push_back(new OOp_AND());
|
|
|
|
else
|
|
|
|
{
|
2001-04-30 09:16:19 +00:00
|
|
|
DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree");
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
}
|
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected
2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte
2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name
2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard
2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus
2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up
2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up
2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct
2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0
2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected
2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string
2009-07-20 11:40:39 +0200 fs r274117 : removed unused include
2009-07-20 11:40:01 +0200 fs r274116 : class name corrected
2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path
2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst
2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar
2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well
2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths
2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality
2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52)
2009-07-01 21:41:50 +0200 fs r273614 : #i10000#
2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents
2009-07-01 12:10:31 +0200 fs r273562 : updated
2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names
2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays
2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder
2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb
2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d
2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions
2009-06-29 10:01:13 +0200 fs r273453 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays
2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899#
2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes
2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes
2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log
2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts
2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string
2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime
2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata
2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge
2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved
2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set
2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge
2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge
2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing
2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d
2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries?
2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed
2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix
2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section
2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox
2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop
2009-06-19 13:18:26 +0200 oj r273157 : remove unused param
2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50)
2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e
2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e
2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e
2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50
2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text
2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any
2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid
2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ...
2009-06-10 09:53:20 +0200 oj r272797 : add lic text
2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618
2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed
2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property
2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases
2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases
2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases
2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid
2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing
2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType
2009-06-08 13:51:20 +0200 oj r272730 : add tests
2009-06-05 14:38:01 +0200 oj r272686 : add dep
2009-06-05 14:35:00 +0200 oj r272684 : add new tests
2009-06-05 13:41:18 +0200 oj r272681 : code clean ups
2009-06-05 12:40:51 +0200 oj r272678 : code cleanup
2009-06-05 12:02:57 +0200 oj r272677 : code cleanup
2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML
2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard
2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 10:09:17 +00:00
|
|
|
else if (SQL_ISRULE(pPredicateNode,boolean_factor))
|
|
|
|
{
|
|
|
|
execute(pPredicateNode->getChild(1));
|
|
|
|
m_aCodeList.push_back(new OOp_NOT());
|
|
|
|
}
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (SQL_ISRULE(pPredicateNode,comparison_predicate))
|
|
|
|
{
|
|
|
|
execute_COMPARE(pPredicateNode);
|
|
|
|
}
|
|
|
|
else if (SQL_ISRULE(pPredicateNode,like_predicate))
|
|
|
|
{
|
|
|
|
execute_LIKE(pPredicateNode);
|
|
|
|
}
|
2004-08-02 16:04:09 +00:00
|
|
|
else if (SQL_ISRULE(pPredicateNode,between_predicate))
|
|
|
|
{
|
|
|
|
execute_BETWEEN(pPredicateNode);
|
|
|
|
}
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (SQL_ISRULE(pPredicateNode,test_for_null))
|
|
|
|
{
|
|
|
|
execute_ISNULL(pPredicateNode);
|
|
|
|
}
|
2001-04-30 09:16:19 +00:00
|
|
|
else if(SQL_ISRULE(pPredicateNode,num_value_exp))
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
execute(pPredicateNode->getChild(0)); // process the left branch
|
|
|
|
execute(pPredicateNode->getChild(2)); // process the right branch
|
2001-04-30 09:16:19 +00:00
|
|
|
if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"+"))
|
|
|
|
{
|
|
|
|
m_aCodeList.push_back(new OOp_ADD());
|
|
|
|
}
|
|
|
|
else if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"-"))
|
|
|
|
m_aCodeList.push_back(new OOp_SUB());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(SQL_ISRULE(pPredicateNode,term))
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
execute(pPredicateNode->getChild(0)); // process the left branch
|
|
|
|
execute(pPredicateNode->getChild(2)); // process the right branch
|
2001-04-30 09:16:19 +00:00
|
|
|
if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"*"))
|
|
|
|
{
|
|
|
|
m_aCodeList.push_back(new OOp_MUL());
|
|
|
|
}
|
|
|
|
else if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"/"))
|
|
|
|
m_aCodeList.push_back(new OOp_DIV());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp");
|
|
|
|
}
|
|
|
|
}
|
2000-10-05 07:39:29 +00:00
|
|
|
else
|
2011-02-18 21:46:25 +01:00
|
|
|
pOperand = execute_Operand(pPredicateNode); // now only simple operands will be processed
|
2000-10-05 07:39:29 +00:00
|
|
|
|
|
|
|
return pOperand;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
2001-01-25 07:26:21 +00:00
|
|
|
OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT(pPredicateNode->count() == 3,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
|
2003-09-04 07:26:30 +00:00
|
|
|
if ( !(SQL_ISRULE(pPredicateNode->getChild(0),column_ref) ||
|
|
|
|
pPredicateNode->getChild(2)->getNodeType() == SQL_NODE_STRING ||
|
|
|
|
pPredicateNode->getChild(2)->getNodeType() == SQL_NODE_INTNUM ||
|
|
|
|
pPredicateNode->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM ||
|
|
|
|
SQL_ISTOKEN(pPredicateNode->getChild(2),TRUE) ||
|
|
|
|
SQL_ISTOKEN(pPredicateNode->getChild(2),FALSE) ||
|
|
|
|
SQL_ISRULE(pPredicateNode->getChild(2),parameter) ||
|
2000-10-05 07:39:29 +00:00
|
|
|
// odbc date
|
2003-09-04 07:26:30 +00:00
|
|
|
SQL_ISRULE(pPredicateNode->getChild(2),set_fct_spec) ||
|
|
|
|
SQL_ISRULE(pPredicateNode->getChild(2),position_exp) ||
|
|
|
|
SQL_ISRULE(pPredicateNode->getChild(2),char_substring_fct) ||
|
|
|
|
// upper, lower etc.
|
|
|
|
SQL_ISRULE(pPredicateNode->getChild(2),fold)) )
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
|
2000-10-05 07:39:29 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-06-20 00:27:29 +00:00
|
|
|
sal_Int32 ePredicateType( SQLFilterOperator::EQUAL );
|
2000-10-05 07:39:29 +00:00
|
|
|
OSQLParseNode *pPrec = pPredicateNode->getChild(1);
|
|
|
|
|
|
|
|
if (pPrec->getNodeType() == SQL_NODE_EQUAL)
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::EQUAL;
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::NOT_EQUAL;
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (pPrec->getNodeType() == SQL_NODE_LESS)
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::LESS;
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (pPrec->getNodeType() == SQL_NODE_LESSEQ)
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::LESS_EQUAL;
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (pPrec->getNodeType() == SQL_NODE_GREATEQ)
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::GREATER_EQUAL;
|
2000-10-05 07:39:29 +00:00
|
|
|
else if (pPrec->getNodeType() == SQL_NODE_GREAT)
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::GREATER;
|
2006-06-20 00:27:29 +00:00
|
|
|
else
|
|
|
|
OSL_ENSURE( false, "OPredicateCompiler::execute_COMPARE: unexpected node type!" );
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2006-06-20 00:27:29 +00:00
|
|
|
execute(pPredicateNode->getChild(0));
|
|
|
|
execute(pPredicateNode->getChild(2));
|
|
|
|
m_aCodeList.push_back( new OOp_COMPARE(ePredicateType) );
|
2000-10-05 07:39:29 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
2001-01-25 07:26:21 +00:00
|
|
|
OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
2010-02-08 14:05:16 +01:00
|
|
|
DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
|
2000-10-05 07:39:29 +00:00
|
|
|
|
|
|
|
sal_Unicode cEscape = L'\0';
|
2010-02-08 14:05:16 +01:00
|
|
|
const bool bNotLike = pPart2->getChild(0)->isToken();
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2010-05-27 08:38:58 +02:00
|
|
|
OSQLParseNode* pAtom = pPart2->getChild(pPart2->count()-2);
|
|
|
|
OSQLParseNode* pOptEscape = pPart2->getChild(pPart2->count()-1);
|
2000-10-05 07:39:29 +00:00
|
|
|
|
|
|
|
if (!(pAtom->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(pAtom,parameter)))
|
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
if (pOptEscape->count() != 0)
|
|
|
|
{
|
|
|
|
if (pOptEscape->count() != 2)
|
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
OSQLParseNode *pEscNode = pOptEscape->getChild(1);
|
|
|
|
if (pEscNode->getNodeType() != SQL_NODE_STRING)
|
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
else
|
2000-10-19 10:56:36 +00:00
|
|
|
cEscape = pEscNode->getTokenValue().toChar();
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
|
2006-06-20 00:27:29 +00:00
|
|
|
execute(pPredicateNode->getChild(0));
|
|
|
|
execute(pAtom);
|
|
|
|
|
2010-02-08 14:05:16 +01:00
|
|
|
OBoolOperator* pOperator = bNotLike
|
|
|
|
? new OOp_NOTLIKE(cEscape)
|
|
|
|
: new OOp_LIKE(cEscape);
|
2000-10-05 07:39:29 +00:00
|
|
|
m_aCodeList.push_back(pOperator);
|
2006-06-20 00:27:29 +00:00
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-08-02 16:04:09 +00:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2010-02-08 14:05:16 +01:00
|
|
|
DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
|
2004-08-02 16:04:09 +00:00
|
|
|
|
|
|
|
OSQLParseNode* pColumn = pPredicateNode->getChild(0);
|
2010-02-08 14:05:16 +01:00
|
|
|
const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
|
2010-05-28 11:37:27 +02:00
|
|
|
OSQLParseNode* p1stValue = pPart2->getChild(2);
|
|
|
|
OSQLParseNode* p2ndtValue = pPart2->getChild(4);
|
2004-08-02 16:04:09 +00:00
|
|
|
|
|
|
|
if (
|
|
|
|
!(p1stValue->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(p1stValue,parameter))
|
|
|
|
&& !(p2ndtValue->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(p2ndtValue,parameter))
|
|
|
|
)
|
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_BETWEEN,NULL);
|
2004-08-02 16:04:09 +00:00
|
|
|
}
|
|
|
|
|
2010-02-08 14:05:16 +01:00
|
|
|
sal_Bool bNot = SQL_ISTOKEN(pPart2->getChild(0),NOT);
|
2004-08-02 16:04:09 +00:00
|
|
|
|
|
|
|
OOperand* pColumnOp = execute(pColumn);
|
|
|
|
OOperand* pOb1 = execute(p1stValue);
|
|
|
|
OBoolOperator* pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::LESS_EQUAL : SQLFilterOperator::GREATER);
|
|
|
|
m_aCodeList.push_back(pOperator);
|
|
|
|
|
|
|
|
execute(pColumn);
|
|
|
|
OOperand* pOb2 = execute(p2ndtValue);
|
|
|
|
pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::GREATER_EQUAL : SQLFilterOperator::LESS);
|
|
|
|
m_aCodeList.push_back(pOperator);
|
|
|
|
|
|
|
|
if ( pColumnOp && pOb1 && pOb2 )
|
|
|
|
{
|
|
|
|
switch(pColumnOp->getDBType())
|
|
|
|
{
|
|
|
|
case DataType::CHAR:
|
|
|
|
case DataType::VARCHAR:
|
|
|
|
case DataType::LONGVARCHAR:
|
|
|
|
pOb1->setValue(pOb1->getValue().getString());
|
|
|
|
pOb2->setValue(pOb2->getValue().getString());
|
|
|
|
break;
|
|
|
|
case DataType::DECIMAL:
|
|
|
|
case DataType::NUMERIC:
|
|
|
|
pOb1->setValue((double)pOb1->getValue());
|
|
|
|
pOb2->setValue((double)pOb2->getValue());
|
|
|
|
break;
|
|
|
|
case DataType::FLOAT:
|
|
|
|
pOb1->setValue((float)pOb1->getValue());
|
|
|
|
pOb2->setValue((float)pOb2->getValue());
|
|
|
|
break;
|
|
|
|
case DataType::DOUBLE:
|
|
|
|
case DataType::REAL:
|
|
|
|
pOb1->setValue((double)pOb1->getValue());
|
|
|
|
pOb2->setValue((double)pOb2->getValue());
|
|
|
|
break;
|
|
|
|
case DataType::DATE:
|
|
|
|
pOb1->setValue((Date)pOb1->getValue());
|
|
|
|
pOb2->setValue((Date)pOb2->getValue());
|
|
|
|
break;
|
|
|
|
case DataType::TIME:
|
|
|
|
pOb1->setValue((Time)pOb1->getValue());
|
|
|
|
pOb2->setValue((Time)pOb2->getValue());
|
|
|
|
break;
|
|
|
|
case DataType::TIMESTAMP:
|
|
|
|
pOb1->setValue((DateTime)pOb1->getValue());
|
|
|
|
pOb2->setValue((DateTime)pOb2->getValue());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2004-08-02 16:04:09 +00:00
|
|
|
OBoolOperator* pBoolOp = NULL;
|
|
|
|
if ( bNot )
|
|
|
|
pBoolOp = new OOp_OR();
|
|
|
|
else
|
|
|
|
pBoolOp = new OOp_AND();
|
|
|
|
m_aCodeList.push_back(pBoolOp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-10-05 07:39:29 +00:00
|
|
|
//------------------------------------------------------------------
|
2001-01-25 07:26:21 +00:00
|
|
|
OOperand* OPredicateCompiler::execute_ISNULL(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
2010-02-08 14:05:16 +01:00
|
|
|
DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
|
|
|
|
DBG_ASSERT(SQL_ISTOKEN(pPart2->getChild(0),IS),"OFILECursor: Fehler im Parse Tree");
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2004-03-15 11:47:22 +00:00
|
|
|
sal_Int32 ePredicateType;
|
2010-02-08 14:05:16 +01:00
|
|
|
if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::NOT_SQLNULL;
|
2000-10-05 07:39:29 +00:00
|
|
|
else
|
2004-03-15 11:47:22 +00:00
|
|
|
ePredicateType = SQLFilterOperator::SQLNULL;
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2006-06-20 00:27:29 +00:00
|
|
|
execute(pPredicateNode->getChild(0));
|
2004-03-15 11:47:22 +00:00
|
|
|
OBoolOperator* pOperator = (ePredicateType == SQLFilterOperator::SQLNULL) ?
|
2000-10-05 07:39:29 +00:00
|
|
|
new OOp_ISNULL() : new OOp_ISNOTNULL();
|
|
|
|
m_aCodeList.push_back(pOperator);
|
2006-06-20 00:27:29 +00:00
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------
|
2001-01-25 07:26:21 +00:00
|
|
|
OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
|
|
|
OOperand* pOperand = NULL;
|
|
|
|
|
|
|
|
if (SQL_ISRULE(pPredicateNode,column_ref))
|
|
|
|
{
|
2000-10-19 10:56:36 +00:00
|
|
|
::rtl::OUString aColumnName;
|
2000-10-05 07:39:29 +00:00
|
|
|
if (pPredicateNode->count() == 1)
|
|
|
|
{
|
|
|
|
aColumnName = pPredicateNode->getChild(0)->getTokenValue();
|
|
|
|
}
|
|
|
|
else if (pPredicateNode->count() == 3)
|
|
|
|
{
|
2000-10-19 10:56:36 +00:00
|
|
|
::rtl::OUString aTableName = pPredicateNode->getChild(0)->getTokenValue();
|
2001-02-12 09:49:13 +00:00
|
|
|
if(SQL_ISRULE(pPredicateNode->getChild(2),column_val))
|
|
|
|
aColumnName = pPredicateNode->getChild(2)->getChild(0)->getTokenValue();
|
|
|
|
else
|
|
|
|
aColumnName = pPredicateNode->getChild(2)->getTokenValue();
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
|
2001-04-10 07:03:36 +00:00
|
|
|
if(!m_orgColumns->hasByName(aColumnName))
|
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution(
|
|
|
|
STR_INVALID_COLUMNNAME,
|
|
|
|
"$columnname$", aColumnName
|
|
|
|
) );
|
|
|
|
::dbtools::throwGenericSQLException( sError, NULL );
|
2001-04-10 07:03:36 +00:00
|
|
|
}
|
2000-10-30 07:07:33 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol;
|
2000-10-05 07:39:29 +00:00
|
|
|
try
|
|
|
|
{
|
2001-05-07 09:37:54 +00:00
|
|
|
if (m_orgColumns->getByName(aColumnName) >>= xCol)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
2001-05-07 09:37:54 +00:00
|
|
|
pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes);
|
|
|
|
}
|
|
|
|
else
|
2011-02-18 21:46:25 +01:00
|
|
|
{// Column doesn't exist in the Result-set
|
2008-10-01 12:28:29 +00:00
|
|
|
const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution(
|
|
|
|
STR_INVALID_COLUMNNAME,
|
|
|
|
"$columnname$", aColumnName
|
|
|
|
) );
|
|
|
|
::dbtools::throwGenericSQLException( sError, NULL );
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
}
|
2001-01-25 07:26:21 +00:00
|
|
|
catch(Exception &)
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
2001-01-25 07:26:21 +00:00
|
|
|
OSL_ENSURE(0,"OPredicateCompiler::execute_Operand Exception");
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (SQL_ISRULE(pPredicateNode,parameter))
|
|
|
|
{
|
2001-04-10 07:51:30 +00:00
|
|
|
pOperand = new OOperandParam(pPredicateNode, ++m_nParamCounter);
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
else if (pPredicateNode->getNodeType() == SQL_NODE_STRING ||
|
|
|
|
pPredicateNode->getNodeType() == SQL_NODE_INTNUM ||
|
|
|
|
pPredicateNode->getNodeType() == SQL_NODE_APPROXNUM ||
|
|
|
|
pPredicateNode->getNodeType() == SQL_NODE_NAME ||
|
|
|
|
SQL_ISTOKEN(pPredicateNode,TRUE) ||
|
|
|
|
SQL_ISTOKEN(pPredicateNode,FALSE) ||
|
|
|
|
SQL_ISRULE(pPredicateNode,parameter))
|
|
|
|
{
|
|
|
|
pOperand = new OOperandConst(*pPredicateNode, pPredicateNode->getTokenValue());
|
|
|
|
}
|
|
|
|
else if((pPredicateNode->count() == 2) &&
|
|
|
|
(SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"+") || SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"-")) &&
|
|
|
|
pPredicateNode->getChild(1)->getNodeType() == SQL_NODE_INTNUM)
|
2011-02-18 21:46:25 +01:00
|
|
|
{ // if -1 or +1 is there
|
2000-10-19 10:56:36 +00:00
|
|
|
::rtl::OUString aValue(pPredicateNode->getChild(0)->getTokenValue());
|
2000-10-05 07:39:29 +00:00
|
|
|
aValue += pPredicateNode->getChild(1)->getTokenValue();
|
|
|
|
pOperand = new OOperandConst(*pPredicateNode->getChild(1), aValue);
|
|
|
|
}
|
2003-09-04 07:26:30 +00:00
|
|
|
else if( SQL_ISRULE(pPredicateNode,set_fct_spec) && SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"{") )
|
2000-10-05 07:39:29 +00:00
|
|
|
{
|
|
|
|
const OSQLParseNode* pODBCNode = pPredicateNode->getChild(1);
|
|
|
|
const OSQLParseNode* pODBCNodeChild = pODBCNode->getChild(0);
|
|
|
|
|
|
|
|
// Odbc Date or time
|
|
|
|
if (pODBCNodeChild->getNodeType() == SQL_NODE_KEYWORD && (
|
|
|
|
SQL_ISTOKEN(pODBCNodeChild,D) ||
|
|
|
|
SQL_ISTOKEN(pODBCNodeChild,T) ||
|
|
|
|
SQL_ISTOKEN(pODBCNodeChild,TS) ))
|
|
|
|
{
|
2001-08-09 11:54:45 +00:00
|
|
|
::rtl::OUString sDateTime = pODBCNode->getChild(1)->getTokenValue();
|
|
|
|
pOperand = new OOperandConst(*pODBCNode->getChild(1), sDateTime);
|
|
|
|
if(SQL_ISTOKEN(pODBCNodeChild,D))
|
|
|
|
{
|
2002-07-04 05:39:26 +00:00
|
|
|
pOperand->setValue(::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(sDateTime)));
|
2001-08-09 11:54:45 +00:00
|
|
|
}
|
|
|
|
else if(SQL_ISTOKEN(pODBCNodeChild,T))
|
|
|
|
{
|
2002-07-04 05:39:26 +00:00
|
|
|
pOperand->setValue(::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(sDateTime)));
|
2001-08-09 11:54:45 +00:00
|
|
|
}
|
|
|
|
else if(SQL_ISTOKEN(pODBCNodeChild,TS))
|
|
|
|
{
|
2002-07-04 05:39:26 +00:00
|
|
|
pOperand->setValue(::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(sDateTime)));
|
2001-08-09 11:54:45 +00:00
|
|
|
}
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
else
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
|
2003-09-04 07:26:30 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else if( SQL_ISRULE(pPredicateNode,fold) )
|
|
|
|
{
|
|
|
|
execute_Fold(pPredicateNode);
|
|
|
|
}
|
|
|
|
else if( SQL_ISRULE(pPredicateNode,set_fct_spec)
|
|
|
|
|| SQL_ISRULE(pPredicateNode,position_exp)
|
|
|
|
|| SQL_ISRULE(pPredicateNode,char_substring_fct)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
executeFunction(pPredicateNode);
|
|
|
|
}
|
|
|
|
else if( SQL_ISRULE(pPredicateNode,length_exp) )
|
|
|
|
{
|
|
|
|
executeFunction(pPredicateNode->getChild(0));
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
|
2000-10-05 07:39:29 +00:00
|
|
|
}
|
|
|
|
if (pOperand)
|
|
|
|
m_aCodeList.push_back(pOperand);
|
|
|
|
return pOperand;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
sal_Bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
|
|
|
|
{
|
|
|
|
static sal_Bool bResult;
|
|
|
|
|
|
|
|
OCodeList::iterator aIter = rCodeList.begin();
|
|
|
|
if (!(*aIter))
|
2011-02-18 21:46:25 +01:00
|
|
|
return sal_True; // no Predicate
|
2000-10-05 07:39:29 +00:00
|
|
|
|
|
|
|
for(;aIter != rCodeList.end();++aIter)
|
|
|
|
{
|
|
|
|
OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
|
|
|
|
if (pOperand)
|
|
|
|
m_aStack.push(pOperand);
|
|
|
|
else
|
|
|
|
((OOperator *)(*aIter))->Exec(m_aStack);
|
|
|
|
}
|
|
|
|
|
|
|
|
OOperand* pOperand = m_aStack.top();
|
|
|
|
m_aStack.pop();
|
|
|
|
|
|
|
|
DBG_ASSERT(m_aStack.size() == 0, "StackFehler");
|
|
|
|
DBG_ASSERT(pOperand, "StackFehler");
|
|
|
|
|
|
|
|
bResult = pOperand->isValid();
|
|
|
|
if (IS_TYPE(OOperandResult,pOperand))
|
|
|
|
delete pOperand;
|
|
|
|
return bResult;
|
|
|
|
}
|
2000-11-10 10:04:52 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2003-09-04 07:26:30 +00:00
|
|
|
void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList,ORowSetValueDecoratorRef& _rVal)
|
|
|
|
{
|
|
|
|
OCodeList::iterator aIter = rCodeList.begin();
|
|
|
|
if (!(*aIter))
|
2011-02-18 21:46:25 +01:00
|
|
|
return ; // no Predicate
|
2003-09-04 07:26:30 +00:00
|
|
|
|
|
|
|
for(;aIter != rCodeList.end();++aIter)
|
|
|
|
{
|
|
|
|
OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
|
|
|
|
if (pOperand)
|
|
|
|
m_aStack.push(pOperand);
|
|
|
|
else
|
|
|
|
((OOperator *)(*aIter))->Exec(m_aStack);
|
|
|
|
}
|
|
|
|
|
|
|
|
OOperand* pOperand = m_aStack.top();
|
|
|
|
m_aStack.pop();
|
|
|
|
|
|
|
|
DBG_ASSERT(m_aStack.size() == 0, "StackFehler");
|
|
|
|
DBG_ASSERT(pOperand, "StackFehler");
|
|
|
|
|
|
|
|
(*_rVal) = pOperand->getValue();
|
|
|
|
if (IS_TYPE(OOperandResult,pOperand))
|
|
|
|
delete pOperand;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OOperand* OPredicateCompiler::execute_Fold(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
DBG_ASSERT(pPredicateNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
|
|
|
|
|
|
|
|
sal_Bool bUpper = SQL_ISTOKEN(pPredicateNode->getChild(0),UPPER);
|
|
|
|
|
2006-06-20 00:27:29 +00:00
|
|
|
execute(pPredicateNode->getChild(2));
|
2003-09-04 07:26:30 +00:00
|
|
|
OOperator* pOperator = NULL;
|
|
|
|
if ( bUpper )
|
|
|
|
pOperator = new OOp_Upper();
|
|
|
|
else
|
|
|
|
pOperator = new OOp_Lower();
|
|
|
|
|
|
|
|
m_aCodeList.push_back(pOperator);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
OOperator* pOperator = NULL;
|
|
|
|
|
|
|
|
OSL_ENSURE(pPredicateNode->getChild(0)->isToken(),"The first one must be the name of the function!");
|
|
|
|
sal_Int32 nTokenId = pPredicateNode->getChild(0)->getTokenID();
|
|
|
|
switch ( nTokenId )
|
|
|
|
{
|
|
|
|
case SQL_TOKEN_CHAR_LENGTH:
|
|
|
|
case SQL_TOKEN_LENGTH:
|
|
|
|
case SQL_TOKEN_OCTET_LENGTH:
|
|
|
|
case SQL_TOKEN_ASCII:
|
|
|
|
case SQL_TOKEN_LCASE:
|
|
|
|
case SQL_TOKEN_LTRIM:
|
|
|
|
case SQL_TOKEN_RTRIM:
|
|
|
|
case SQL_TOKEN_SPACE:
|
|
|
|
case SQL_TOKEN_UCASE:
|
|
|
|
case SQL_TOKEN_ABS:
|
|
|
|
case SQL_TOKEN_ACOS:
|
|
|
|
case SQL_TOKEN_ASIN:
|
|
|
|
case SQL_TOKEN_ATAN:
|
|
|
|
case SQL_TOKEN_CEILING:
|
|
|
|
case SQL_TOKEN_COS:
|
|
|
|
case SQL_TOKEN_DEGREES:
|
|
|
|
case SQL_TOKEN_EXP:
|
|
|
|
case SQL_TOKEN_FLOOR:
|
|
|
|
case SQL_TOKEN_LOG10:
|
2004-03-15 11:47:22 +00:00
|
|
|
case SQL_TOKEN_LN:
|
2003-09-04 07:26:30 +00:00
|
|
|
case SQL_TOKEN_RADIANS:
|
|
|
|
case SQL_TOKEN_SIGN:
|
|
|
|
case SQL_TOKEN_SIN:
|
|
|
|
case SQL_TOKEN_SQRT:
|
|
|
|
case SQL_TOKEN_TAN:
|
|
|
|
case SQL_TOKEN_DAYNAME:
|
|
|
|
case SQL_TOKEN_DAYOFMONTH:
|
|
|
|
case SQL_TOKEN_DAYOFWEEK:
|
|
|
|
case SQL_TOKEN_DAYOFYEAR:
|
|
|
|
case SQL_TOKEN_HOUR:
|
|
|
|
case SQL_TOKEN_MINUTE:
|
|
|
|
case SQL_TOKEN_MONTH:
|
|
|
|
case SQL_TOKEN_MONTHNAME:
|
|
|
|
case SQL_TOKEN_QUARTER:
|
|
|
|
case SQL_TOKEN_SECOND:
|
|
|
|
case SQL_TOKEN_YEAR:
|
|
|
|
|
|
|
|
execute(pPredicateNode->getChild(2));
|
|
|
|
|
|
|
|
switch( nTokenId )
|
|
|
|
{
|
|
|
|
case SQL_TOKEN_CHAR_LENGTH:
|
|
|
|
case SQL_TOKEN_LENGTH:
|
|
|
|
case SQL_TOKEN_OCTET_LENGTH:
|
|
|
|
pOperator = new OOp_CharLength();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ASCII:
|
|
|
|
pOperator = new OOp_Ascii();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_LCASE:
|
|
|
|
pOperator = new OOp_Lower();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SQL_TOKEN_LTRIM:
|
|
|
|
pOperator = new OOp_LTrim();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_RTRIM:
|
|
|
|
pOperator = new OOp_RTrim();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_SPACE:
|
|
|
|
pOperator = new OOp_Space();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_UCASE:
|
|
|
|
pOperator = new OOp_Upper();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ABS:
|
|
|
|
pOperator = new OOp_Abs();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ACOS:
|
|
|
|
pOperator = new OOp_ACos();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ASIN:
|
|
|
|
pOperator = new OOp_ASin();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ATAN:
|
|
|
|
pOperator = new OOp_ATan();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_CEILING:
|
|
|
|
pOperator = new OOp_Ceiling();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_COS:
|
|
|
|
pOperator = new OOp_Cos();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_DEGREES:
|
|
|
|
pOperator = new OOp_Degrees();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_EXP:
|
|
|
|
pOperator = new OOp_Exp();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_FLOOR:
|
|
|
|
pOperator = new OOp_Floor();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_LOG10:
|
|
|
|
pOperator = new OOp_Log10();
|
|
|
|
break;
|
2004-03-15 11:47:22 +00:00
|
|
|
case SQL_TOKEN_LN:
|
|
|
|
pOperator = new OOp_Ln();
|
|
|
|
break;
|
2003-09-04 07:26:30 +00:00
|
|
|
case SQL_TOKEN_RADIANS:
|
|
|
|
pOperator = new OOp_Radians();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_SIGN:
|
|
|
|
pOperator = new OOp_Sign();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_SIN:
|
|
|
|
pOperator = new OOp_Sin();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_SQRT:
|
|
|
|
pOperator = new OOp_Sqrt();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_TAN:
|
|
|
|
pOperator = new OOp_Tan();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_DAYOFWEEK:
|
|
|
|
pOperator = new OOp_DayOfWeek();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_DAYOFMONTH:
|
|
|
|
pOperator = new OOp_DayOfMonth();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_DAYOFYEAR:
|
|
|
|
pOperator = new OOp_DayOfYear();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_MONTH:
|
|
|
|
pOperator = new OOp_Month();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_DAYNAME:
|
|
|
|
pOperator = new OOp_DayName();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_MONTHNAME:
|
|
|
|
pOperator = new OOp_MonthName();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_QUARTER:
|
|
|
|
pOperator = new OOp_Quarter();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_YEAR:
|
|
|
|
pOperator = new OOp_Year();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_HOUR:
|
|
|
|
pOperator = new OOp_Hour();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_MINUTE:
|
|
|
|
pOperator = new OOp_Minute();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_SECOND:
|
|
|
|
pOperator = new OOp_Second();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_ENSURE(0,"Error in switch!");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_CHAR:
|
|
|
|
case SQL_TOKEN_CONCAT:
|
|
|
|
case SQL_TOKEN_INSERT:
|
|
|
|
case SQL_TOKEN_LEFT:
|
|
|
|
case SQL_TOKEN_LOCATE:
|
|
|
|
case SQL_TOKEN_LOCATE_2:
|
|
|
|
case SQL_TOKEN_REPEAT:
|
|
|
|
case SQL_TOKEN_REPLACE:
|
|
|
|
case SQL_TOKEN_RIGHT:
|
|
|
|
case SQL_TOKEN_MOD:
|
|
|
|
case SQL_TOKEN_ROUND:
|
|
|
|
case SQL_TOKEN_LOGF:
|
2007-09-26 13:29:12 +00:00
|
|
|
case SQL_TOKEN_LOG:
|
2003-09-04 07:26:30 +00:00
|
|
|
case SQL_TOKEN_POWER:
|
|
|
|
case SQL_TOKEN_ATAN2:
|
|
|
|
case SQL_TOKEN_PI:
|
|
|
|
case SQL_TOKEN_CURDATE:
|
|
|
|
case SQL_TOKEN_CURTIME:
|
|
|
|
case SQL_TOKEN_NOW:
|
|
|
|
case SQL_TOKEN_WEEK:
|
|
|
|
{
|
|
|
|
m_aCodeList.push_back(new OStopOperand);
|
|
|
|
OSQLParseNode* pList = pPredicateNode->getChild(2);
|
2004-03-15 11:47:22 +00:00
|
|
|
for (sal_uInt32 i=0; i < pList->count(); ++i)
|
2003-09-04 07:26:30 +00:00
|
|
|
execute(pList->getChild(i));
|
|
|
|
|
|
|
|
switch( nTokenId )
|
|
|
|
{
|
|
|
|
case SQL_TOKEN_CHAR:
|
|
|
|
pOperator = new OOp_Char();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_CONCAT:
|
|
|
|
pOperator = new OOp_Concat();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_INSERT:
|
|
|
|
pOperator = new OOp_Insert();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_LEFT:
|
|
|
|
pOperator = new OOp_Left();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_LOCATE:
|
|
|
|
case SQL_TOKEN_LOCATE_2:
|
|
|
|
pOperator = new OOp_Locate();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_REPEAT:
|
|
|
|
pOperator = new OOp_Repeat();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_REPLACE:
|
|
|
|
pOperator = new OOp_Replace();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_RIGHT:
|
|
|
|
pOperator = new OOp_Right();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_MOD:
|
|
|
|
pOperator = new OOp_Mod();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ROUND:
|
|
|
|
pOperator = new OOp_Round();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_LOGF:
|
2007-09-26 13:29:12 +00:00
|
|
|
case SQL_TOKEN_LOG:
|
2003-09-04 07:26:30 +00:00
|
|
|
pOperator = new OOp_Log();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_POWER:
|
|
|
|
pOperator = new OOp_Pow();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_ATAN2:
|
|
|
|
pOperator = new OOp_ATan2();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_PI:
|
|
|
|
pOperator = new OOp_Pi();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_CURDATE:
|
|
|
|
pOperator = new OOp_CurDate();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_CURTIME:
|
|
|
|
pOperator = new OOp_CurTime();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_NOW:
|
|
|
|
pOperator = new OOp_Now();
|
|
|
|
break;
|
|
|
|
case SQL_TOKEN_WEEK:
|
|
|
|
pOperator = new OOp_Week();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_ENSURE(0,"Error in switch!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SQL_TOKEN_SUBSTRING:
|
|
|
|
m_aCodeList.push_back(new OStopOperand);
|
|
|
|
if ( pPredicateNode->count() == 4 ) //char_substring_fct
|
|
|
|
{
|
|
|
|
OSQLParseNode* pList = pPredicateNode->getChild(2);
|
2004-03-15 11:47:22 +00:00
|
|
|
for (sal_uInt32 i=0; i < pList->count(); ++i)
|
2003-09-04 07:26:30 +00:00
|
|
|
execute(pList->getChild(i));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
execute(pPredicateNode->getChild(2));
|
|
|
|
execute(pPredicateNode->getChild(4));
|
|
|
|
execute(pPredicateNode->getChild(5)->getChild(1));
|
|
|
|
}
|
|
|
|
pOperator = new OOp_SubString();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SQL_TOKEN_POSITION:
|
|
|
|
m_aCodeList.push_back(new OStopOperand);
|
|
|
|
if ( pPredicateNode->count() == 4 ) //position_exp
|
|
|
|
{
|
|
|
|
OSQLParseNode* pList = pPredicateNode->getChild(2);
|
2004-03-15 11:47:22 +00:00
|
|
|
for (sal_uInt32 i=0; i < pList->count(); ++i)
|
2003-09-04 07:26:30 +00:00
|
|
|
execute(pList->getChild(i));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
execute(pPredicateNode->getChild(2));
|
|
|
|
execute(pPredicateNode->getChild(4));
|
|
|
|
}
|
|
|
|
pOperator = new OOp_Locate();
|
|
|
|
break;
|
|
|
|
default:
|
2008-10-01 12:28:29 +00:00
|
|
|
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_FUNCTION_NOT_SUPPORTED,NULL);
|
2003-09-04 07:26:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_aCodeList.push_back(pOperator);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2000-11-10 10:04:52 +00:00
|
|
|
|
2000-10-05 07:39:29 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|