1*cdf0e10cSrcweir %{ 2*cdf0e10cSrcweir 3*cdf0e10cSrcweir //-------------------------------------------------------------------------- 4*cdf0e10cSrcweir // 5*cdf0e10cSrcweir // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6*cdf0e10cSrcweir // 7*cdf0e10cSrcweir // Copyright 2000, 2010 Oracle and/or its affiliates. 8*cdf0e10cSrcweir // 9*cdf0e10cSrcweir // OpenOffice.org - a multi-platform office productivity suite 10*cdf0e10cSrcweir // 11*cdf0e10cSrcweir // This file is part of OpenOffice.org. 12*cdf0e10cSrcweir // 13*cdf0e10cSrcweir // OpenOffice.org is free software: you can redistribute it and/or modify 14*cdf0e10cSrcweir // it under the terms of the GNU Lesser General Public License version 3 15*cdf0e10cSrcweir // only, as published by the Free Software Foundation. 16*cdf0e10cSrcweir // 17*cdf0e10cSrcweir // OpenOffice.org is distributed in the hope that it will be useful, 18*cdf0e10cSrcweir // but WITHOUT ANY WARRANTY; without even the implied warranty of 19*cdf0e10cSrcweir // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20*cdf0e10cSrcweir // GNU Lesser General Public License version 3 for more details 21*cdf0e10cSrcweir // (a copy is included in the LICENSE file that accompanied this code). 22*cdf0e10cSrcweir // 23*cdf0e10cSrcweir // You should have received a copy of the GNU Lesser General Public License 24*cdf0e10cSrcweir // version 3 along with OpenOffice.org. If not, see 25*cdf0e10cSrcweir // <http://www.openoffice.org/license.html> 26*cdf0e10cSrcweir // for a copy of the LGPLv3 License. 27*cdf0e10cSrcweir // 28*cdf0e10cSrcweir //-------------------------------------------------------------------------- 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #define YY_EXIT 1 // YY_FATAL will not halt the application 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #ifndef _CSTDARG_ 33*cdf0e10cSrcweir #include <cstdarg> // std::va_list 34*cdf0e10cSrcweir #endif 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #ifndef _INC_STRING 37*cdf0e10cSrcweir #include <string.h> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "internalnode.hxx" 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #ifndef _CONNECTIVITY_SQLYACC_HXX 43*cdf0e10cSrcweir #define _CONNECTIVITY_SQLYACC_HXX 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #ifndef SQLYYDEBUG 46*cdf0e10cSrcweir #define SQLYYDEBUG 1 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include "sqlbison.hxx" 50*cdf0e10cSrcweir #endif 51*cdf0e10cSrcweir #include "sqlscan.hxx" 52*cdf0e10cSrcweir #include <osl/diagnose.h> 53*cdf0e10cSrcweir #include <rtl/strbuf.hxx> 54*cdf0e10cSrcweir #include <connectivity/sqlparse.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #if defined __GNUC__ 57*cdf0e10cSrcweir #pragma GCC system_header 58*cdf0e10cSrcweir #elif defined __SUNPRO_CC 59*cdf0e10cSrcweir #pragma disable_warn 60*cdf0e10cSrcweir #elif defined _MSC_VER 61*cdf0e10cSrcweir #pragma warning(push, 1) 62*cdf0e10cSrcweir /**/ 63*cdf0e10cSrcweir #ifdef yywrap 64*cdf0e10cSrcweir #undef yywrap 65*cdf0e10cSrcweir #define yywrap() 1 66*cdf0e10cSrcweir #endif 67*cdf0e10cSrcweir /**/ 68*cdf0e10cSrcweir #endif 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir using namespace connectivity; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir //============================================================================= 73*cdf0e10cSrcweir // 74*cdf0e10cSrcweir // Erzeugung der Blaetter fuer die Token 75*cdf0e10cSrcweir // Blaetter werden generell vom Lexer erzeugt 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir static ::rtl::OUString aEmptyString; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir static sal_Int32 gatherString(sal_Int32 delim, sal_Int32 nTyp); 80*cdf0e10cSrcweir static sal_Int32 gatherName(const sal_Char*); 81*cdf0e10cSrcweir static sal_Int32 gatherNamePre(const sal_Char* ); 82*cdf0e10cSrcweir // has to be set before the parser starts 83*cdf0e10cSrcweir OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #define SQL_NEW_NODE(text, token) \ 86*cdf0e10cSrcweir SQLyylval.pParseNode = new OSQLInternalNode(text, token); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir #define SQL_NEW_KEYWORD(token) \ 89*cdf0e10cSrcweir SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); return token; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir #define SQL_NEW_INTNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_INTNUM); return SQL_TOKEN_INTNUM; 92*cdf0e10cSrcweir #define SQL_NEW_APPROXNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_APPROXNUM); return SQL_TOKEN_APPROXNUM; 93*cdf0e10cSrcweir #define SQL_NEW_DATE SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); return SQL_TOKEN_ACCESS_DATE; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir #define YY_INPUT(buf,result,max_size) \ 96*cdf0e10cSrcweir { \ 97*cdf0e10cSrcweir buf[0] = xxx_pGLOBAL_SQLSCAN->SQLyygetc(); \ 98*cdf0e10cSrcweir result = buf[0] != -1; \ 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir #define YY_FATAL_ERROR(msg) \ 102*cdf0e10cSrcweir { \ 103*cdf0e10cSrcweir xxx_pGLOBAL_SQLSCAN->SQLyyerror(msg); \ 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir // 107*cdf0e10cSrcweir //============================================================================= 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir %} 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir %s SQL 112*cdf0e10cSrcweir %s PREDICATE_ENG 113*cdf0e10cSrcweir %s PREDICATE_GER 114*cdf0e10cSrcweir %s DATE 115*cdf0e10cSrcweir %s STRING 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir %option noyywrap 118*cdf0e10cSrcweir %option never-interactive 119*cdf0e10cSrcweir %% 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir ABS {SQL_NEW_KEYWORD(SQL_TOKEN_ABS); } 122*cdf0e10cSrcweir ACOS {SQL_NEW_KEYWORD(SQL_TOKEN_ACOS); } 123*cdf0e10cSrcweir AFTER {SQL_NEW_KEYWORD(SQL_TOKEN_AFTER); } 124*cdf0e10cSrcweir ALL {SQL_NEW_KEYWORD(SQL_TOKEN_ALL); } 125*cdf0e10cSrcweir ALTER {SQL_NEW_KEYWORD(SQL_TOKEN_ALTER); } 126*cdf0e10cSrcweir AND {SQL_NEW_KEYWORD(SQL_TOKEN_AND); } 127*cdf0e10cSrcweir ANY {SQL_NEW_KEYWORD(SQL_TOKEN_ANY); } 128*cdf0e10cSrcweir ARRAY_AGG {SQL_NEW_KEYWORD(SQL_TOKEN_ARRAY_AGG); } 129*cdf0e10cSrcweir AS {SQL_NEW_KEYWORD(SQL_TOKEN_AS); } 130*cdf0e10cSrcweir ASC {SQL_NEW_KEYWORD(SQL_TOKEN_ASC); } 131*cdf0e10cSrcweir ASCII {SQL_NEW_KEYWORD(SQL_TOKEN_ASCII); } 132*cdf0e10cSrcweir ASIN {SQL_NEW_KEYWORD(SQL_TOKEN_ASIN); } 133*cdf0e10cSrcweir AT {SQL_NEW_KEYWORD(SQL_TOKEN_AT); } 134*cdf0e10cSrcweir ATAN {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN); } 135*cdf0e10cSrcweir ATAN2 {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN2); } 136*cdf0e10cSrcweir ATOMIC {SQL_NEW_KEYWORD(SQL_TOKEN_ATOMIC); } 137*cdf0e10cSrcweir AUTHORIZATION {SQL_NEW_KEYWORD(SQL_TOKEN_AUTHORIZATION); } 138*cdf0e10cSrcweir AVG {SQL_NEW_KEYWORD(SQL_TOKEN_AVG); } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir BEFORE {SQL_NEW_KEYWORD(SQL_TOKEN_BEFORE); } 141*cdf0e10cSrcweir BEGIN {SQL_NEW_KEYWORD(SQL_TOKEN_BEGIN); } 142*cdf0e10cSrcweir BETWEEN {SQL_NEW_KEYWORD(SQL_TOKEN_BETWEEN); } 143*cdf0e10cSrcweir BIGINT {SQL_NEW_KEYWORD(SQL_TOKEN_BIGINT); } 144*cdf0e10cSrcweir BINARY {SQL_NEW_KEYWORD(SQL_TOKEN_BINARY); } 145*cdf0e10cSrcweir BIT {SQL_NEW_KEYWORD(SQL_TOKEN_BIT); } 146*cdf0e10cSrcweir BIT_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_BIT_LENGTH); } 147*cdf0e10cSrcweir BLOB {SQL_NEW_KEYWORD(SQL_TOKEN_BLOB); } 148*cdf0e10cSrcweir BOTH {SQL_NEW_KEYWORD(SQL_TOKEN_BOTH); } 149*cdf0e10cSrcweir BY {SQL_NEW_KEYWORD(SQL_TOKEN_BY); } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir CALL {SQL_NEW_KEYWORD(SQL_TOKEN_CALL); } 152*cdf0e10cSrcweir CASE {SQL_NEW_KEYWORD(SQL_TOKEN_CASE); } 153*cdf0e10cSrcweir CAST {SQL_NEW_KEYWORD(SQL_TOKEN_CAST); } 154*cdf0e10cSrcweir CEILING {SQL_NEW_KEYWORD(SQL_TOKEN_CEILING); } 155*cdf0e10cSrcweir CHAR {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR); } 156*cdf0e10cSrcweir CHARACTER {SQL_NEW_KEYWORD(SQL_TOKEN_CHARACTER); } 157*cdf0e10cSrcweir CHAR(ACTER)?_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR_LENGTH); } 158*cdf0e10cSrcweir CHECK {SQL_NEW_KEYWORD(SQL_TOKEN_CHECK); } 159*cdf0e10cSrcweir CLOB {SQL_NEW_KEYWORD(SQL_TOKEN_CLOB); } 160*cdf0e10cSrcweir COALESCE {SQL_NEW_KEYWORD(SQL_TOKEN_COALESCE); } 161*cdf0e10cSrcweir COLLATE {SQL_NEW_KEYWORD(SQL_TOKEN_COLLATE); } 162*cdf0e10cSrcweir COLLECT {SQL_NEW_KEYWORD(SQL_TOKEN_COLLECT); } 163*cdf0e10cSrcweir COMMIT {SQL_NEW_KEYWORD(SQL_TOKEN_COMMIT); } 164*cdf0e10cSrcweir CONCAT {SQL_NEW_KEYWORD(SQL_TOKEN_CONCAT); } 165*cdf0e10cSrcweir CONTINUE {SQL_NEW_KEYWORD(SQL_TOKEN_CONTINUE); } 166*cdf0e10cSrcweir CONVERT {SQL_NEW_KEYWORD(SQL_TOKEN_CONVERT); } 167*cdf0e10cSrcweir COS {SQL_NEW_KEYWORD(SQL_TOKEN_COS); } 168*cdf0e10cSrcweir COT {SQL_NEW_KEYWORD(SQL_TOKEN_COT); } 169*cdf0e10cSrcweir COUNT {SQL_NEW_KEYWORD(SQL_TOKEN_COUNT); } 170*cdf0e10cSrcweir CREATE {SQL_NEW_KEYWORD(SQL_TOKEN_CREATE); } 171*cdf0e10cSrcweir CROSS {SQL_NEW_KEYWORD(SQL_TOKEN_CROSS); } 172*cdf0e10cSrcweir CUME_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_CUME_DIST); } 173*cdf0e10cSrcweir CURRENT {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT); } 174*cdf0e10cSrcweir CURRENT_DATE {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DATE); } 175*cdf0e10cSrcweir CURRENT_CATALOG {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_CATALOG); } 176*cdf0e10cSrcweir CURRENT_DEFAULT_TRANSFORM_GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP); } 177*cdf0e10cSrcweir CURRENT_PATH {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_PATH); } 178*cdf0e10cSrcweir CURRENT_ROLE {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_ROLE); } 179*cdf0e10cSrcweir CURRENT_SCHEMA {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_SCHEMA); } 180*cdf0e10cSrcweir CURRENT_USER {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_USER); } 181*cdf0e10cSrcweir CURDATE {SQL_NEW_KEYWORD(SQL_TOKEN_CURDATE); } 182*cdf0e10cSrcweir CURRENT_TIME {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIME); } 183*cdf0e10cSrcweir CURTIME {SQL_NEW_KEYWORD(SQL_TOKEN_CURTIME); } 184*cdf0e10cSrcweir CURRENT_TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIMESTAMP); } 185*cdf0e10cSrcweir CURSOR {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); } 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir D {SQL_NEW_KEYWORD(SQL_TOKEN_D); } 188*cdf0e10cSrcweir DATE {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); } 189*cdf0e10cSrcweir DATEDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_DATEDIFF); } 190*cdf0e10cSrcweir DATEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_DATEVALUE); } 191*cdf0e10cSrcweir DAY {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); } 192*cdf0e10cSrcweir DAYNAME {SQL_NEW_KEYWORD(SQL_TOKEN_DAYNAME); } 193*cdf0e10cSrcweir DAYOFMONTH {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFMONTH); } 194*cdf0e10cSrcweir DAYOFWEEK {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFWEEK); } 195*cdf0e10cSrcweir DAYOFYEAR {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFYEAR); } 196*cdf0e10cSrcweir DEC {SQL_NEW_KEYWORD(SQL_TOKEN_DEC); } 197*cdf0e10cSrcweir DECIMAL {SQL_NEW_KEYWORD(SQL_TOKEN_DECIMAL); } 198*cdf0e10cSrcweir DECLARE {SQL_NEW_KEYWORD(SQL_TOKEN_DECLARE); } 199*cdf0e10cSrcweir DEFAULT {SQL_NEW_KEYWORD(SQL_TOKEN_DEFAULT); } 200*cdf0e10cSrcweir DEGREES {SQL_NEW_KEYWORD(SQL_TOKEN_DEGREES); } 201*cdf0e10cSrcweir DELETE {SQL_NEW_KEYWORD(SQL_TOKEN_DELETE); } 202*cdf0e10cSrcweir DENSE_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_DENSE_RANK); } 203*cdf0e10cSrcweir DESC {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); } 204*cdf0e10cSrcweir DIFFERENCE {SQL_NEW_KEYWORD(SQL_TOKEN_DIFFERENCE); } 205*cdf0e10cSrcweir DISTINCT {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); } 206*cdf0e10cSrcweir DOUBLE {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); } 207*cdf0e10cSrcweir DROP {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir EACH {SQL_NEW_KEYWORD(SQL_TOKEN_EACH); } 210*cdf0e10cSrcweir ELSE {SQL_NEW_KEYWORD(SQL_TOKEN_ELSE); } 211*cdf0e10cSrcweir END {SQL_NEW_KEYWORD(SQL_TOKEN_END); } 212*cdf0e10cSrcweir EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); } 213*cdf0e10cSrcweir ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); } 214*cdf0e10cSrcweir EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); } 215*cdf0e10cSrcweir EXCLUDE {SQL_NEW_KEYWORD(SQL_TOKEN_EXCLUDE); } 216*cdf0e10cSrcweir EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); } 217*cdf0e10cSrcweir EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); } 218*cdf0e10cSrcweir EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); } 221*cdf0e10cSrcweir FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); } 222*cdf0e10cSrcweir FIRST {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST); } 223*cdf0e10cSrcweir FIRST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST_VALUE); } 224*cdf0e10cSrcweir FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); } 225*cdf0e10cSrcweir FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); } 226*cdf0e10cSrcweir FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); } 227*cdf0e10cSrcweir FOLLOWING {SQL_NEW_KEYWORD(SQL_TOKEN_FOLLOWING); } 228*cdf0e10cSrcweir FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); } 229*cdf0e10cSrcweir FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); } 230*cdf0e10cSrcweir FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); } 231*cdf0e10cSrcweir FROM {SQL_NEW_KEYWORD(SQL_TOKEN_FROM); } 232*cdf0e10cSrcweir FULL {SQL_NEW_KEYWORD(SQL_TOKEN_FULL); } 233*cdf0e10cSrcweir FUSION {SQL_NEW_KEYWORD(SQL_TOKEN_FUSION); } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir GRANT {SQL_NEW_KEYWORD(SQL_TOKEN_GRANT); } 236*cdf0e10cSrcweir GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); } 239*cdf0e10cSrcweir HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir IGNORE {SQL_NEW_KEYWORD(SQL_TOKEN_IGNORE); } 242*cdf0e10cSrcweir IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); } 243*cdf0e10cSrcweir INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); } 244*cdf0e10cSrcweir INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); } 245*cdf0e10cSrcweir INSTEAD {SQL_NEW_KEYWORD(SQL_TOKEN_INSTEAD); } 246*cdf0e10cSrcweir INT(EGER)? {SQL_NEW_KEYWORD(SQL_TOKEN_INTEGER); } 247*cdf0e10cSrcweir INTERSECT {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECT); } 248*cdf0e10cSrcweir INTERVAL {SQL_NEW_KEYWORD(SQL_TOKEN_INTERVAL); } 249*cdf0e10cSrcweir INTERSECTION {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECTION); } 250*cdf0e10cSrcweir INTO {SQL_NEW_KEYWORD(SQL_TOKEN_INTO); } 251*cdf0e10cSrcweir IS {SQL_NEW_KEYWORD(SQL_TOKEN_IS); } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir LAG {SQL_NEW_KEYWORD(SQL_TOKEN_LAG); } 258*cdf0e10cSrcweir LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); } 259*cdf0e10cSrcweir LAST {SQL_NEW_KEYWORD(SQL_TOKEN_LAST); } 260*cdf0e10cSrcweir LAST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_LAST_VALUE); } 261*cdf0e10cSrcweir LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); } 262*cdf0e10cSrcweir LEAD {SQL_NEW_KEYWORD(SQL_TOKEN_LEAD); } 263*cdf0e10cSrcweir LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); } 264*cdf0e10cSrcweir LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); } 265*cdf0e10cSrcweir LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); } 266*cdf0e10cSrcweir LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); } 267*cdf0e10cSrcweir LIMIT {SQL_NEW_KEYWORD(SQL_TOKEN_LIMIT); } 268*cdf0e10cSrcweir LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); } 269*cdf0e10cSrcweir LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); } 270*cdf0e10cSrcweir LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); } 271*cdf0e10cSrcweir LOG {SQL_NEW_KEYWORD(SQL_TOKEN_LOG); } 272*cdf0e10cSrcweir LOGF {SQL_NEW_KEYWORD(SQL_TOKEN_LOGF); } 273*cdf0e10cSrcweir LOG10 {SQL_NEW_KEYWORD(SQL_TOKEN_LOG10); } 274*cdf0e10cSrcweir LOWER {SQL_NEW_KEYWORD(SQL_TOKEN_LOWER); } 275*cdf0e10cSrcweir LTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_LTRIM); } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir MAX {SQL_NEW_KEYWORD(SQL_TOKEN_MAX); } 278*cdf0e10cSrcweir MIN {SQL_NEW_KEYWORD(SQL_TOKEN_MIN); } 279*cdf0e10cSrcweir MINUTE {SQL_NEW_KEYWORD(SQL_TOKEN_MINUTE); } 280*cdf0e10cSrcweir MOD {SQL_NEW_KEYWORD(SQL_TOKEN_MOD); } 281*cdf0e10cSrcweir MONTH {SQL_NEW_KEYWORD(SQL_TOKEN_MONTH); } 282*cdf0e10cSrcweir MONTHNAME {SQL_NEW_KEYWORD(SQL_TOKEN_MONTHNAME); } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir NATIONAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATIONAL); } 285*cdf0e10cSrcweir NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); } 286*cdf0e10cSrcweir NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); } 287*cdf0e10cSrcweir NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); } 288*cdf0e10cSrcweir NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); } 289*cdf0e10cSrcweir NEXT {SQL_NEW_KEYWORD(SQL_TOKEN_NEXT); } 290*cdf0e10cSrcweir NO {SQL_NEW_KEYWORD(SQL_TOKEN_NO); } 291*cdf0e10cSrcweir NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); } 292*cdf0e10cSrcweir NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); } 293*cdf0e10cSrcweir NTH_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_NTH_VALUE); } 294*cdf0e10cSrcweir NTILE {SQL_NEW_KEYWORD(SQL_TOKEN_NTILE); } 295*cdf0e10cSrcweir NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); } 296*cdf0e10cSrcweir NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); } 297*cdf0e10cSrcweir NULLS {SQL_NEW_KEYWORD(SQL_TOKEN_NULLS); } 298*cdf0e10cSrcweir NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); } 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); } 301*cdf0e10cSrcweir OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); } 302*cdf0e10cSrcweir OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); } 303*cdf0e10cSrcweir OFFSET {SQL_NEW_KEYWORD(SQL_TOKEN_OFFSET); } 304*cdf0e10cSrcweir OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); } 305*cdf0e10cSrcweir OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); } 306*cdf0e10cSrcweir ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); } 307*cdf0e10cSrcweir ONLY {SQL_NEW_KEYWORD(SQL_TOKEN_ONLY); } 308*cdf0e10cSrcweir OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); } 309*cdf0e10cSrcweir OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); } 310*cdf0e10cSrcweir ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); } 311*cdf0e10cSrcweir OTHERS {SQL_NEW_KEYWORD(SQL_TOKEN_OTHERS); } 312*cdf0e10cSrcweir OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); } 313*cdf0e10cSrcweir OVER {SQL_NEW_KEYWORD(SQL_TOKEN_OVER); } 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir PARTITION {SQL_NEW_KEYWORD(SQL_TOKEN_PARTITION); } 316*cdf0e10cSrcweir PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); } 317*cdf0e10cSrcweir PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); } 318*cdf0e10cSrcweir PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); } 319*cdf0e10cSrcweir PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); } 320*cdf0e10cSrcweir POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); } 321*cdf0e10cSrcweir POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); } 322*cdf0e10cSrcweir PRECEDING {SQL_NEW_KEYWORD(SQL_TOKEN_PRECEDING); } 323*cdf0e10cSrcweir PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); } 324*cdf0e10cSrcweir PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); } 325*cdf0e10cSrcweir PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); } 326*cdf0e10cSrcweir PROCEDURE {SQL_NEW_KEYWORD(SQL_TOKEN_PROCEDURE); } 327*cdf0e10cSrcweir PUBLIC {SQL_NEW_KEYWORD(SQL_TOKEN_PUBLIC); } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); } 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); } 332*cdf0e10cSrcweir RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); } 333*cdf0e10cSrcweir RANGE {SQL_NEW_KEYWORD(SQL_TOKEN_RANGE); } 334*cdf0e10cSrcweir RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); } 335*cdf0e10cSrcweir REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); } 336*cdf0e10cSrcweir REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); } 337*cdf0e10cSrcweir REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); } 338*cdf0e10cSrcweir REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); } 339*cdf0e10cSrcweir REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); } 340*cdf0e10cSrcweir RESPECT {SQL_NEW_KEYWORD(SQL_TOKEN_RESPECT); } 341*cdf0e10cSrcweir ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); } 342*cdf0e10cSrcweir ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); } 343*cdf0e10cSrcweir ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); } 344*cdf0e10cSrcweir ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); } 345*cdf0e10cSrcweir ROWS {SQL_NEW_KEYWORD(SQL_TOKEN_ROWS); } 346*cdf0e10cSrcweir ROW_NUMBER {SQL_NEW_KEYWORD(SQL_TOKEN_ROW_NUMBER); } 347*cdf0e10cSrcweir RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); } 348*cdf0e10cSrcweir RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir SCHEMA {SQL_NEW_KEYWORD(SQL_TOKEN_SCHEMA); } 351*cdf0e10cSrcweir SECOND {SQL_NEW_KEYWORD(SQL_TOKEN_SECOND); } 352*cdf0e10cSrcweir SELECT {SQL_NEW_KEYWORD(SQL_TOKEN_SELECT); } 353*cdf0e10cSrcweir SET {SQL_NEW_KEYWORD(SQL_TOKEN_SET); } 354*cdf0e10cSrcweir SIZE {SQL_NEW_KEYWORD(SQL_TOKEN_SIZE); } 355*cdf0e10cSrcweir SIGN {SQL_NEW_KEYWORD(SQL_TOKEN_SIGN); } 356*cdf0e10cSrcweir SIN {SQL_NEW_KEYWORD(SQL_TOKEN_SIN); } 357*cdf0e10cSrcweir SMALLINT {SQL_NEW_KEYWORD(SQL_TOKEN_SMALLINT); } 358*cdf0e10cSrcweir SOME {SQL_NEW_KEYWORD(SQL_TOKEN_SOME); } 359*cdf0e10cSrcweir SOUNDEX {SQL_NEW_KEYWORD(SQL_TOKEN_SOUNDEX); } 360*cdf0e10cSrcweir SPACE {SQL_NEW_KEYWORD(SQL_TOKEN_SPACE); } 361*cdf0e10cSrcweir SQRT {SQL_NEW_KEYWORD(SQL_TOKEN_SQRT); } 362*cdf0e10cSrcweir STDDEV_POP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_POP); } 363*cdf0e10cSrcweir STDDEV_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_SAMP); } 364*cdf0e10cSrcweir STATEMENT {SQL_NEW_KEYWORD(SQL_TOKEN_STATEMENT); } 365*cdf0e10cSrcweir SUBSTRING {SQL_NEW_KEYWORD(SQL_TOKEN_SUBSTRING); } 366*cdf0e10cSrcweir SUM {SQL_NEW_KEYWORD(SQL_TOKEN_SUM); } 367*cdf0e10cSrcweir SESSION_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SESSION_USER); } 368*cdf0e10cSrcweir SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); } 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); } 371*cdf0e10cSrcweir TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); } 372*cdf0e10cSrcweir THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); } 373*cdf0e10cSrcweir TIES {SQL_NEW_KEYWORD(SQL_TOKEN_TIES); } 374*cdf0e10cSrcweir TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); } 375*cdf0e10cSrcweir TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); } 376*cdf0e10cSrcweir TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); } 377*cdf0e10cSrcweir TIMESTAMPDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPDIFF); } 378*cdf0e10cSrcweir TIMEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEVALUE); } 379*cdf0e10cSrcweir TIMEZONE_HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_HOUR); } 380*cdf0e10cSrcweir TIMEZONE_MINUTE {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_MINUTE); } 381*cdf0e10cSrcweir TO {SQL_NEW_KEYWORD(SQL_TOKEN_TO); } 382*cdf0e10cSrcweir TRAILING {SQL_NEW_KEYWORD(SQL_TOKEN_TRAILING); } 383*cdf0e10cSrcweir TRANSLATE {SQL_NEW_KEYWORD(SQL_TOKEN_TRANSLATE); } 384*cdf0e10cSrcweir TRIGGER {SQL_NEW_KEYWORD(SQL_TOKEN_TRIGGER); } 385*cdf0e10cSrcweir TRIM {SQL_NEW_KEYWORD(SQL_TOKEN_TRIM); } 386*cdf0e10cSrcweir TRUE {SQL_NEW_KEYWORD(SQL_TOKEN_TRUE); } 387*cdf0e10cSrcweir TRUNCATE {SQL_NEW_KEYWORD(SQL_TOKEN_TRUNCATE); } 388*cdf0e10cSrcweir TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); } 389*cdf0e10cSrcweir T {SQL_NEW_KEYWORD(SQL_TOKEN_T); } 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); } 392*cdf0e10cSrcweir UNBOUNDED {SQL_NEW_KEYWORD(SQL_TOKEN_UNBOUNDED); } 393*cdf0e10cSrcweir UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); } 394*cdf0e10cSrcweir UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); } 395*cdf0e10cSrcweir UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); } 396*cdf0e10cSrcweir UPDATE {SQL_NEW_KEYWORD(SQL_TOKEN_UPDATE); } 397*cdf0e10cSrcweir UPPER {SQL_NEW_KEYWORD(SQL_TOKEN_UPPER); } 398*cdf0e10cSrcweir USAGE {SQL_NEW_KEYWORD(SQL_TOKEN_USAGE); } 399*cdf0e10cSrcweir USER {SQL_NEW_KEYWORD(SQL_TOKEN_USER); } 400*cdf0e10cSrcweir USING {SQL_NEW_KEYWORD(SQL_TOKEN_USING); } 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir VARBINARY {SQL_NEW_KEYWORD(SQL_TOKEN_VARBINARY); } 403*cdf0e10cSrcweir VARCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_VARCHAR); } 404*cdf0e10cSrcweir VARYING {SQL_NEW_KEYWORD(SQL_TOKEN_VARYING); } 405*cdf0e10cSrcweir VAR_POP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_POP); } 406*cdf0e10cSrcweir VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_SAMP); } 407*cdf0e10cSrcweir VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_VALUE); } 408*cdf0e10cSrcweir VALUES {SQL_NEW_KEYWORD(SQL_TOKEN_VALUES); } 409*cdf0e10cSrcweir VIEW {SQL_NEW_KEYWORD(SQL_TOKEN_VIEW); } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir WEEK {SQL_NEW_KEYWORD(SQL_TOKEN_WEEK); } 412*cdf0e10cSrcweir WHEN {SQL_NEW_KEYWORD(SQL_TOKEN_WHEN); } 413*cdf0e10cSrcweir WHERE {SQL_NEW_KEYWORD(SQL_TOKEN_WHERE); } 414*cdf0e10cSrcweir WITH {SQL_NEW_KEYWORD(SQL_TOKEN_WITH); } 415*cdf0e10cSrcweir WITHIN {SQL_NEW_KEYWORD(SQL_TOKEN_WITHIN); } 416*cdf0e10cSrcweir WITHOUT {SQL_NEW_KEYWORD(SQL_TOKEN_WITHOUT); } 417*cdf0e10cSrcweir WORK {SQL_NEW_KEYWORD(SQL_TOKEN_WORK); } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir YEAR {SQL_NEW_KEYWORD(SQL_TOKEN_YEAR); } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir ZONE {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); } 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir "<" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_LESS);return SQL_LESS;} 424*cdf0e10cSrcweir ">" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_GREAT);return SQL_GREAT;} 425*cdf0e10cSrcweir "=" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_EQUAL);return SQL_EQUAL;} 426*cdf0e10cSrcweir "<=" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_LESSEQ);return SQL_LESSEQ;} 427*cdf0e10cSrcweir ">=" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_GREATEQ);return SQL_GREATEQ;} 428*cdf0e10cSrcweir "<>" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_NOTEQUAL);return SQL_NOTEQUAL;} 429*cdf0e10cSrcweir "!=" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_NOTEQUAL);return SQL_NOTEQUAL;} 430*cdf0e10cSrcweir "||" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_CONCAT);return SQL_CONCAT;} 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir [-+*/:(),.;?{}] { return SQLyytext[0]; } 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir <SQL>[A-Za-z\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375][A-Za-z\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375_0-9]* {return gatherName( SQLyytext);} 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir <SQL>([0-9]+) | 439*cdf0e10cSrcweir <SQL>([0-9]+"."[0-9]*) | 440*cdf0e10cSrcweir <SQL>("."[0-9]*) {SQL_NEW_INTNUM; } 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir <SQL>[0-9]+[eE][+-]?[0-9]+ | 443*cdf0e10cSrcweir <SQL>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | 444*cdf0e10cSrcweir <SQL>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir <PREDICATE_GER,PREDICATE_ENG,DATE>[A-Za-z\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375][A-Za-z0-9_%.,*?\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375]* {return gatherNamePre(SQLyytext);} 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir <PREDICATE_GER,PREDICATE_ENG>([0-9]+) {SQL_NEW_INTNUM; } 449*cdf0e10cSrcweir <PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+) {SQL_NEW_INTNUM; } 450*cdf0e10cSrcweir <PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+) {SQL_NEW_INTNUM; } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir <PREDICATE_ENG>([0-9]+"."[0-9]+) | 453*cdf0e10cSrcweir <PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+"."[0-9]+) | 454*cdf0e10cSrcweir <PREDICATE_ENG>("."[0-9]+) {SQL_NEW_APPROXNUM; } 455*cdf0e10cSrcweir <PREDICATE_ENG>[0-9]+[eE][+-]?[0-9]+ | 456*cdf0e10cSrcweir <PREDICATE_ENG>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | 457*cdf0e10cSrcweir <PREDICATE_ENG>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir <PREDICATE_GER>([0-9]+","[0-9]+) | 460*cdf0e10cSrcweir <PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+","[0-9]+) | 461*cdf0e10cSrcweir <PREDICATE_GER>(","[0-9]+) {SQL_NEW_APPROXNUM; } 462*cdf0e10cSrcweir <PREDICATE_GER>[0-9]+[eE][+-]?[0-9]+ | 463*cdf0e10cSrcweir <PREDICATE_GER>[0-9]+","[0-9]*[eE][+-]?[0-9]+ | 464*cdf0e10cSrcweir <PREDICATE_GER>","[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir <PREDICATE_GER,PREDICATE_ENG>[0-9.,][A-Za-z0-9_.,%]* {return gatherNamePre(SQLyytext);} 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir <SQL>\" { return gatherString('\"',0); } 469*cdf0e10cSrcweir <SQL>` { return gatherString('`' ,0); } 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir <PREDICATE_GER,PREDICATE_ENG,DATE,SQL>"[" { return gatherString(']' ,0);} 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir \' { return gatherString('\'',1); } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir <PREDICATE_GER,PREDICATE_ENG,DATE># { return gatherString('#' ,2); } 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir <DATE>[0-9]{1,4}[^ ]*[0-9] | 478*cdf0e10cSrcweir <DATE>[0-9]{1,4}[^ ]*[0-9][ ][0-9]{1,4}[^ ]*[0-9] { SQL_NEW_DATE; } 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir <STRING>["-""+""*""/"":""("")"",""."";""?""{""}"] { return SQLyytext[0]; } /* */ 481*cdf0e10cSrcweir <STRING>"[" { return gatherString(']' ,0); } 482*cdf0e10cSrcweir <STRING>[^ ':["?"]* { return gatherNamePre(SQLyytext); } 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir \n {} 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir [ \t\r]+ {} 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir "--".*$ {} 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir . {YY_FATAL_ERROR("Invalid symbol"); return SQL_TOKEN_INVALIDSYMBOL;} 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir %% 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir // Kludge around a bug (well, Posix incompatibility) in flex 2.5.x 495*cdf0e10cSrcweir // http://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=189332 496*cdf0e10cSrcweir #if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir #ifndef YY_FLUSH_BUFFER 499*cdf0e10cSrcweir #define YY_FLUSH_BUFFER SQLyy_flush_buffer(YY_CURRENT_BUFFER ) 500*cdf0e10cSrcweir #endif 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir #ifndef yytext_ptr 503*cdf0e10cSrcweir #define yytext_ptr SQLyytext 504*cdf0e10cSrcweir #endif 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir #endif 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir // Versions of flex apparently differ in whether input() resp. yyinput() returns 509*cdf0e10cSrcweir // zero or EOF upon end of file: 510*cdf0e10cSrcweir inline bool checkeof(int c) { return c == 0 || c == EOF; } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir /* 513*cdf0e10cSrcweir * Read SQL string literal 514*cdf0e10cSrcweir * Valid strings: 515*cdf0e10cSrcweir * '' 'a string' 'quote '' within string' 516*cdf0e10cSrcweir * "" "a string" "quote "" within string" 517*cdf0e10cSrcweir * nTyp == 0 -> SQL_NODE_NAME 518*cdf0e10cSrcweir * nTyp == 1 -> SQL_NODE_STRING 519*cdf0e10cSrcweir * nTyp == 2 -> SQL_NODE_ACCESS_DATE 520*cdf0e10cSrcweir */ 521*cdf0e10cSrcweir sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir sal_Char ch; 524*cdf0e10cSrcweir ::rtl::OStringBuffer sBuffer(256); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir while (!checkeof(ch = yyinput())) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir if (ch == delim) 529*cdf0e10cSrcweir { 530*cdf0e10cSrcweir if ((ch = yyinput()) != delim) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir if (!checkeof(ch)) 533*cdf0e10cSrcweir unput(ch); 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir switch(nTyp) 536*cdf0e10cSrcweir { 537*cdf0e10cSrcweir case 0: 538*cdf0e10cSrcweir SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); 539*cdf0e10cSrcweir return SQL_TOKEN_NAME; 540*cdf0e10cSrcweir case 1: 541*cdf0e10cSrcweir SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); 542*cdf0e10cSrcweir return SQL_TOKEN_STRING; 543*cdf0e10cSrcweir case 2: 544*cdf0e10cSrcweir SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); 545*cdf0e10cSrcweir return SQL_TOKEN_ACCESS_DATE; 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir else 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir sBuffer.append(ch); 551*cdf0e10cSrcweir } 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir else if (nTyp != 1 && (ch == '\r' || ch == '\n') ) 555*cdf0e10cSrcweir break; 556*cdf0e10cSrcweir else 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir sBuffer.append(ch); 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir YY_FATAL_ERROR("Unterminated name string"); 562*cdf0e10cSrcweir return SQL_TOKEN_INVALIDSYMBOL; 563*cdf0e10cSrcweir } 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir sal_Int32 mapEnumToToken(IParseContext::InternationalKeyCode _eKeyCode ) 566*cdf0e10cSrcweir { 567*cdf0e10cSrcweir sal_Int32 nTokenID = 0; 568*cdf0e10cSrcweir switch( _eKeyCode ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir case IParseContext::KEY_LIKE: nTokenID = SQL_TOKEN_LIKE; break; 571*cdf0e10cSrcweir case IParseContext::KEY_NOT: nTokenID = SQL_TOKEN_NOT; break; 572*cdf0e10cSrcweir case IParseContext::KEY_NULL: nTokenID = SQL_TOKEN_NULL; break; 573*cdf0e10cSrcweir case IParseContext::KEY_TRUE: nTokenID = SQL_TOKEN_TRUE; break; 574*cdf0e10cSrcweir case IParseContext::KEY_FALSE: nTokenID = SQL_TOKEN_FALSE; break; 575*cdf0e10cSrcweir case IParseContext::KEY_IS: nTokenID = SQL_TOKEN_IS; break; 576*cdf0e10cSrcweir case IParseContext::KEY_BETWEEN: nTokenID = SQL_TOKEN_BETWEEN; break; 577*cdf0e10cSrcweir case IParseContext::KEY_OR: nTokenID = SQL_TOKEN_OR; break; 578*cdf0e10cSrcweir case IParseContext::KEY_AND: nTokenID = SQL_TOKEN_AND; break; 579*cdf0e10cSrcweir case IParseContext::KEY_AVG: nTokenID = SQL_TOKEN_AVG; break; 580*cdf0e10cSrcweir case IParseContext::KEY_COUNT: nTokenID = SQL_TOKEN_COUNT; break; 581*cdf0e10cSrcweir case IParseContext::KEY_MAX: nTokenID = SQL_TOKEN_MAX; break; 582*cdf0e10cSrcweir case IParseContext::KEY_MIN: nTokenID = SQL_TOKEN_MIN; break; 583*cdf0e10cSrcweir case IParseContext::KEY_SUM: nTokenID = SQL_TOKEN_SUM; break; 584*cdf0e10cSrcweir case IParseContext::KEY_EVERY: nTokenID = SQL_TOKEN_EVERY; break; 585*cdf0e10cSrcweir case IParseContext::KEY_ANY: nTokenID = SQL_TOKEN_ANY; break; 586*cdf0e10cSrcweir case IParseContext::KEY_SOME: nTokenID = SQL_TOKEN_SOME; break; 587*cdf0e10cSrcweir case IParseContext::KEY_STDDEV_POP: nTokenID = SQL_TOKEN_STDDEV_POP; break; 588*cdf0e10cSrcweir case IParseContext::KEY_STDDEV_SAMP: nTokenID = SQL_TOKEN_STDDEV_SAMP; break; 589*cdf0e10cSrcweir case IParseContext::KEY_VAR_SAMP: nTokenID = SQL_TOKEN_VAR_SAMP; break; 590*cdf0e10cSrcweir case IParseContext::KEY_VAR_POP: nTokenID = SQL_TOKEN_VAR_POP; break; 591*cdf0e10cSrcweir case IParseContext::KEY_COLLECT: nTokenID = SQL_TOKEN_COLLECT; break; 592*cdf0e10cSrcweir case IParseContext::KEY_FUSION: nTokenID = SQL_TOKEN_FUSION; break; 593*cdf0e10cSrcweir case IParseContext::KEY_INTERSECTION: nTokenID = SQL_TOKEN_INTERSECTION; break; 594*cdf0e10cSrcweir default: 595*cdf0e10cSrcweir OSL_ENSURE( false, "mapEnumToToken: unsupported key!" ); 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir return nTokenID; 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir /* 600*cdf0e10cSrcweir * Read SQL Name literal 601*cdf0e10cSrcweir * Valid Names or internatioanl keywords: 602*cdf0e10cSrcweir * As we have international keywords, we test first on them 603*cdf0e10cSrcweir */ 604*cdf0e10cSrcweir sal_Int32 gatherName(const sal_Char* text) 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir sal_Int32 nToken; 607*cdf0e10cSrcweir OSL_ENSURE(xxx_pGLOBAL_SQLSCAN,"You forgot to set the scanner!"); 608*cdf0e10cSrcweir IParseContext::InternationalKeyCode eKeyCode = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); 609*cdf0e10cSrcweir switch (eKeyCode) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir case IParseContext::KEY_LIKE: 612*cdf0e10cSrcweir case IParseContext::KEY_NOT: 613*cdf0e10cSrcweir case IParseContext::KEY_NULL: 614*cdf0e10cSrcweir case IParseContext::KEY_TRUE: 615*cdf0e10cSrcweir case IParseContext::KEY_FALSE: 616*cdf0e10cSrcweir case IParseContext::KEY_IS: 617*cdf0e10cSrcweir case IParseContext::KEY_BETWEEN: 618*cdf0e10cSrcweir case IParseContext::KEY_OR: 619*cdf0e10cSrcweir case IParseContext::KEY_AND: 620*cdf0e10cSrcweir case IParseContext::KEY_COUNT: 621*cdf0e10cSrcweir case IParseContext::KEY_AVG: 622*cdf0e10cSrcweir case IParseContext::KEY_MAX: 623*cdf0e10cSrcweir case IParseContext::KEY_MIN: 624*cdf0e10cSrcweir case IParseContext::KEY_SUM: 625*cdf0e10cSrcweir case IParseContext::KEY_EVERY: 626*cdf0e10cSrcweir case IParseContext::KEY_ANY: 627*cdf0e10cSrcweir case IParseContext::KEY_SOME: 628*cdf0e10cSrcweir case IParseContext::KEY_STDDEV_POP: 629*cdf0e10cSrcweir case IParseContext::KEY_STDDEV_SAMP: 630*cdf0e10cSrcweir case IParseContext::KEY_VAR_SAMP: 631*cdf0e10cSrcweir case IParseContext::KEY_VAR_POP: 632*cdf0e10cSrcweir case IParseContext::KEY_COLLECT: 633*cdf0e10cSrcweir case IParseContext::KEY_FUSION: 634*cdf0e10cSrcweir case IParseContext::KEY_INTERSECTION: 635*cdf0e10cSrcweir nToken = mapEnumToToken(eKeyCode); 636*cdf0e10cSrcweir SQL_NEW_KEYWORD(nToken); 637*cdf0e10cSrcweir break; 638*cdf0e10cSrcweir default: 639*cdf0e10cSrcweir SQL_NEW_NODE(::rtl::OUString(text,strlen(text),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); 640*cdf0e10cSrcweir return SQL_TOKEN_NAME; 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir } 643*cdf0e10cSrcweir /** 644*cdf0e10cSrcweir Read SQL Name literal for predicate check 645*cdf0e10cSrcweir Valid Names or internatioanl keywords: 646*cdf0e10cSrcweir As we have international keywords, we test first on them 647*cdf0e10cSrcweir */ 648*cdf0e10cSrcweir sal_Int32 gatherNamePre(const sal_Char* text) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir sal_Int32 nToken; 651*cdf0e10cSrcweir OSL_ENSURE(xxx_pGLOBAL_SQLSCAN,"You forgot to set the scanner!"); 652*cdf0e10cSrcweir IParseContext::InternationalKeyCode eKeyCode = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); 653*cdf0e10cSrcweir switch (eKeyCode) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir case IParseContext::KEY_LIKE: 656*cdf0e10cSrcweir case IParseContext::KEY_NOT: 657*cdf0e10cSrcweir case IParseContext::KEY_NULL: 658*cdf0e10cSrcweir case IParseContext::KEY_TRUE: 659*cdf0e10cSrcweir case IParseContext::KEY_FALSE: 660*cdf0e10cSrcweir case IParseContext::KEY_IS: 661*cdf0e10cSrcweir case IParseContext::KEY_BETWEEN: 662*cdf0e10cSrcweir case IParseContext::KEY_OR: 663*cdf0e10cSrcweir case IParseContext::KEY_AND: 664*cdf0e10cSrcweir case IParseContext::KEY_COUNT: 665*cdf0e10cSrcweir case IParseContext::KEY_AVG: 666*cdf0e10cSrcweir case IParseContext::KEY_MAX: 667*cdf0e10cSrcweir case IParseContext::KEY_MIN: 668*cdf0e10cSrcweir case IParseContext::KEY_SUM: 669*cdf0e10cSrcweir case IParseContext::KEY_EVERY: 670*cdf0e10cSrcweir case IParseContext::KEY_ANY: 671*cdf0e10cSrcweir case IParseContext::KEY_SOME: 672*cdf0e10cSrcweir case IParseContext::KEY_STDDEV_POP: 673*cdf0e10cSrcweir case IParseContext::KEY_STDDEV_SAMP: 674*cdf0e10cSrcweir case IParseContext::KEY_VAR_SAMP: 675*cdf0e10cSrcweir case IParseContext::KEY_VAR_POP: 676*cdf0e10cSrcweir case IParseContext::KEY_COLLECT: 677*cdf0e10cSrcweir case IParseContext::KEY_FUSION: 678*cdf0e10cSrcweir case IParseContext::KEY_INTERSECTION: 679*cdf0e10cSrcweir nToken = mapEnumToToken(eKeyCode); 680*cdf0e10cSrcweir SQL_NEW_KEYWORD(nToken); 681*cdf0e10cSrcweir break; 682*cdf0e10cSrcweir default: 683*cdf0e10cSrcweir // we need a special handling for parameter 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir ::rtl::OString sStmt = xxx_pGLOBAL_SQLSCAN->getStatement(); 686*cdf0e10cSrcweir sal_Int32 nLength = strlen(text); 687*cdf0e10cSrcweir sal_Int32 nPos = xxx_pGLOBAL_SQLSCAN->GetCurrentPos() - nLength - 2; 688*cdf0e10cSrcweir if (sStmt.getStr()[nPos] == ':') 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir SQL_NEW_NODE(::rtl::OUString(text,nLength,RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); 691*cdf0e10cSrcweir nToken = SQL_TOKEN_NAME; 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir else 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir SQL_NEW_NODE(::rtl::OUString(text,nLength,RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); 696*cdf0e10cSrcweir nToken = SQL_TOKEN_STRING; 697*cdf0e10cSrcweir } 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir return nToken; 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir using namespace connectivity; 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir static sal_uInt32 Intl_TokenID[] = 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir SQL_TOKEN_LIKE, SQL_TOKEN_NOT, SQL_TOKEN_NULL, SQL_TOKEN_TRUE, 708*cdf0e10cSrcweir SQL_TOKEN_FALSE, SQL_TOKEN_IS, SQL_TOKEN_BETWEEN, SQL_TOKEN_OR, 709*cdf0e10cSrcweir SQL_TOKEN_AND, SQL_TOKEN_AVG, SQL_TOKEN_COUNT, SQL_TOKEN_MAX, 710*cdf0e10cSrcweir SQL_TOKEN_MIN, SQL_TOKEN_SUM 711*cdf0e10cSrcweir }; 712*cdf0e10cSrcweir static bool IN_SQLyyerror; 713*cdf0e10cSrcweir //------------------------------------------------------------------------------ 714*cdf0e10cSrcweir OSQLScanner::OSQLScanner() 715*cdf0e10cSrcweir : m_nCurrentPos(0) 716*cdf0e10cSrcweir , m_bInternational(sal_False) 717*cdf0e10cSrcweir , m_pContext(NULL) 718*cdf0e10cSrcweir , m_nRule(0) // 0 is INITIAL 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir IN_SQLyyerror = false; 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir //------------------------------------------------------------------------------ 724*cdf0e10cSrcweir OSQLScanner::~OSQLScanner() 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir //------------------------------------------------------------------------------ 728*cdf0e10cSrcweir void OSQLScanner::SQLyyerror(sal_Char *fmt) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir if(IN_SQLyyerror) 732*cdf0e10cSrcweir return; 733*cdf0e10cSrcweir IN_SQLyyerror = true; 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir OSL_ENSURE(m_pContext, "OSQLScanner::SQLyyerror: No Context set"); 736*cdf0e10cSrcweir m_sErrorMessage = ::rtl::OUString(fmt,strlen(fmt),RTL_TEXTENCODING_UTF8); 737*cdf0e10cSrcweir if (m_nCurrentPos < m_sStatement.getLength()) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir m_sErrorMessage += ::rtl::OUString::createFromAscii(": "); 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir ::rtl::OUString aError; 742*cdf0e10cSrcweir static sal_Int32 BUFFERSIZE = 256; 743*cdf0e10cSrcweir static sal_Char* Buffer = 0; 744*cdf0e10cSrcweir if(!Buffer) 745*cdf0e10cSrcweir Buffer = new sal_Char[BUFFERSIZE]; 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir sal_Char *s = Buffer; 748*cdf0e10cSrcweir sal_Int32 nPos = 1; 749*cdf0e10cSrcweir sal_Int32 ch = SQLyytext ? (SQLyytext[0] == 0 ? ' ' : SQLyytext[0]): ' '; 750*cdf0e10cSrcweir *s++ = ch; 751*cdf0e10cSrcweir while (!checkeof(ch = yyinput())) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir if (ch == ' ') 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir if ((ch = yyinput()) != ' ') 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir if (!checkeof(ch)) 758*cdf0e10cSrcweir unput(ch); 759*cdf0e10cSrcweir } 760*cdf0e10cSrcweir *s = '\0'; 761*cdf0e10cSrcweir aError = ::rtl::OUString(Buffer,nPos,RTL_TEXTENCODING_UTF8); 762*cdf0e10cSrcweir break; 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir else 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir *s++ = ch; 767*cdf0e10cSrcweir if (++nPos == BUFFERSIZE) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir ::rtl::OString aBuf(Buffer); 770*cdf0e10cSrcweir delete[] Buffer; 771*cdf0e10cSrcweir BUFFERSIZE *=2; 772*cdf0e10cSrcweir Buffer = new sal_Char[BUFFERSIZE]; 773*cdf0e10cSrcweir for(sal_Int32 i=0;i<aBuf.getLength();++i,++Buffer) 774*cdf0e10cSrcweir *Buffer = aBuf.getStr()[i]; 775*cdf0e10cSrcweir s = &Buffer[nPos]; 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir m_sErrorMessage += aError; 780*cdf0e10cSrcweir delete[] Buffer; 781*cdf0e10cSrcweir Buffer = NULL; 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir IN_SQLyyerror = false; 784*cdf0e10cSrcweir YY_FLUSH_BUFFER; 785*cdf0e10cSrcweir } 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir //------------------------------------------------------------------------------ 788*cdf0e10cSrcweir void OSQLScanner::prepareScan(const ::rtl::OUString & rNewStatement, const IParseContext* pContext, sal_Bool bInternational) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir YY_FLUSH_BUFFER; 791*cdf0e10cSrcweir BEGIN(m_nRule); 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir m_sErrorMessage = ::rtl::OUString(); 794*cdf0e10cSrcweir m_sStatement = ::rtl::OString(rNewStatement,rNewStatement.getLength(), RTL_TEXTENCODING_UTF8); 795*cdf0e10cSrcweir m_nCurrentPos = 0; 796*cdf0e10cSrcweir m_bInternational = bInternational; 797*cdf0e10cSrcweir m_pContext = pContext; 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir //------------------------------------------------------------------------------ 801*cdf0e10cSrcweir sal_Int32 OSQLScanner::SQLyygetc(void) 802*cdf0e10cSrcweir { 803*cdf0e10cSrcweir sal_Int32 nPos = (m_nCurrentPos >= m_sStatement.getLength()) ? -1 : m_sStatement.getStr()[m_nCurrentPos]; 804*cdf0e10cSrcweir m_nCurrentPos++; 805*cdf0e10cSrcweir return nPos; 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir //------------------------------------------------------------------------------ 809*cdf0e10cSrcweir IParseContext::InternationalKeyCode OSQLScanner::getInternationalTokenID(const sal_Char* sToken) const 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir OSL_ENSURE(m_pContext, "OSQLScanner::getInternationalTokenID: No Context set"); 812*cdf0e10cSrcweir return (m_bInternational) ? m_pContext->getIntlKeyCode(::rtl::OString(sToken) ) : IParseContext::KEY_NONE; 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir // ------------------------------------------------------------------------- 815*cdf0e10cSrcweir sal_Int32 OSQLScanner::GetCurrentRule() const { return m_nRule; } 816*cdf0e10cSrcweir sal_Int32 OSQLScanner::GetGERRule() const { return PREDICATE_GER; } 817*cdf0e10cSrcweir sal_Int32 OSQLScanner::GetENGRule() const { return PREDICATE_ENG; } 818*cdf0e10cSrcweir sal_Int32 OSQLScanner::GetSQLRule() const { return SQL; } 819*cdf0e10cSrcweir sal_Int32 OSQLScanner::GetDATERule() const { return DATE; } 820*cdf0e10cSrcweir sal_Int32 OSQLScanner::GetSTRINGRule() const { return STRING; } 821*cdf0e10cSrcweir // ------------------------------------------------------------------------- 822*cdf0e10cSrcweir void OSQLScanner::setScanner(sal_Bool _bNull) 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir xxx_pGLOBAL_SQLSCAN = _bNull ? NULL : this; 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir // ------------------------------------------------------------------------- 827*cdf0e10cSrcweir sal_Int32 OSQLScanner::SQLlex() 828*cdf0e10cSrcweir { 829*cdf0e10cSrcweir return SQLyylex(); 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir 832*cdf0e10cSrcweir #if defined __SUNPRO_CC 833*cdf0e10cSrcweir #pragma enable_warn 834*cdf0e10cSrcweir #elif defined _MSC_VER 835*cdf0e10cSrcweir #pragma warning(pop) 836*cdf0e10cSrcweir #endif 837