1cdf0e10cSrcweir %{ 2cdf0e10cSrcweir //-------------------------------------------------------------------------- 3cdf0e10cSrcweir // 4cdf0e10cSrcweir // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5cdf0e10cSrcweir // 6cdf0e10cSrcweir // Copyright 2000, 2010 Oracle and/or its affiliates. 7cdf0e10cSrcweir // 8cdf0e10cSrcweir // OpenOffice.org - a multi-platform office productivity suite 9cdf0e10cSrcweir // 10cdf0e10cSrcweir // This file is part of OpenOffice.org. 11cdf0e10cSrcweir // 12cdf0e10cSrcweir // OpenOffice.org is free software: you can redistribute it and/or modify 13cdf0e10cSrcweir // it under the terms of the GNU Lesser General Public License version 3 14cdf0e10cSrcweir // only, as published by the Free Software Foundation. 15cdf0e10cSrcweir // 16cdf0e10cSrcweir // OpenOffice.org is distributed in the hope that it will be useful, 17cdf0e10cSrcweir // but WITHOUT ANY WARRANTY; without even the implied warranty of 18cdf0e10cSrcweir // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19cdf0e10cSrcweir // GNU Lesser General Public License version 3 for more details 20cdf0e10cSrcweir // (a copy is included in the LICENSE file that accompanied this code). 21cdf0e10cSrcweir // 22cdf0e10cSrcweir // You should have received a copy of the GNU Lesser General Public License 23cdf0e10cSrcweir // version 3 along with OpenOffice.org. If not, see 24cdf0e10cSrcweir // <http://www.openoffice.org/license.html> 25cdf0e10cSrcweir // for a copy of the LGPLv3 License. 26cdf0e10cSrcweir // 27cdf0e10cSrcweir //-------------------------------------------------------------------------- 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <vector> 30cdf0e10cSrcweir #include <string.h> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #ifndef _CONNECTIVITY_SQLNODE_HXX 33cdf0e10cSrcweir #include <connectivity/sqlnode.hxx> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #ifndef _CONNECTIVITY_SQLPARSE_HXX 36cdf0e10cSrcweir #include <connectivity/sqlparse.hxx> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX 39cdf0e10cSrcweir #include <internalnode.hxx> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ 42cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp> 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ 45cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp> 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ 48cdf0e10cSrcweir #include <com/sun/star/util/Date.hpp> 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ 51cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp> 52cdf0e10cSrcweir #endif 53cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_TIME_HPP_ 54cdf0e10cSrcweir #include <com/sun/star/util/Time.hpp> 55cdf0e10cSrcweir #endif 56cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ 57cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatter.hpp> 58cdf0e10cSrcweir #endif 59cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ 60cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp> 61cdf0e10cSrcweir #endif 62cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATS_HPP_ 63cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormats.hpp> 64cdf0e10cSrcweir #endif 65cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ 66cdf0e10cSrcweir #include <com/sun/star/util/NumberFormat.hpp> 67cdf0e10cSrcweir #endif 68cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ 69cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatTypes.hpp> 70cdf0e10cSrcweir #endif 71cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 72cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 73cdf0e10cSrcweir #endif 74cdf0e10cSrcweir #ifndef _COM_SUN_STAR_I18N_KPARSETYPE_HPP_ 75cdf0e10cSrcweir #include <com/sun/star/i18n/KParseType.hpp> 76cdf0e10cSrcweir #endif 77cdf0e10cSrcweir #ifndef _COM_SUN_STAR_I18N_KPARSETOKENS_HPP_ 78cdf0e10cSrcweir #include <com/sun/star/i18n/KParseTokens.hpp> 79cdf0e10cSrcweir #endif 80cdf0e10cSrcweir #ifndef _CONNECTIVITY_SQLSCAN_HXX 81cdf0e10cSrcweir #include "sqlscan.hxx" 82cdf0e10cSrcweir #endif 83cdf0e10cSrcweir #ifndef _OSL_DIAGNOSE_H_ 84cdf0e10cSrcweir #include <osl/diagnose.h> 85cdf0e10cSrcweir #endif 86cdf0e10cSrcweir #ifndef _DBHELPER_DBCONVERSION_HXX_ 87cdf0e10cSrcweir #include "connectivity/dbconversion.hxx" 88cdf0e10cSrcweir #endif 89cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 90cdf0e10cSrcweir 91cdf0e10cSrcweir #if defined __GNUC__ 92cdf0e10cSrcweir #pragma GCC system_header 93cdf0e10cSrcweir #elif defined __SUNPRO_CC 94cdf0e10cSrcweir #pragma disable_warn 95cdf0e10cSrcweir #elif defined _MSC_VER 96cdf0e10cSrcweir #pragma warning(push, 1) 97cdf0e10cSrcweir #pragma warning(disable:4273 4701 4706) 98cdf0e10cSrcweir #endif 99cdf0e10cSrcweir 100cdf0e10cSrcweir static ::rtl::OUString aEmptyString; 101cdf0e10cSrcweir 102cdf0e10cSrcweir static connectivity::OSQLInternalNode* newNode(const sal_Char* pNewValue, 103cdf0e10cSrcweir const connectivity::SQLNodeType eNodeType, 104cdf0e10cSrcweir const sal_uInt32 nNodeID = 0) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir return new connectivity::OSQLInternalNode(pNewValue, eNodeType, nNodeID); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir static connectivity::OSQLInternalNode* newNode(const ::rtl::OString& _NewValue, 110cdf0e10cSrcweir const connectivity::SQLNodeType eNodeType, 111cdf0e10cSrcweir const sal_uInt32 nNodeID = 0) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir static connectivity::OSQLInternalNode* newNode(const ::rtl::OUString& _NewValue, 117cdf0e10cSrcweir const connectivity::SQLNodeType eNodeType, 118cdf0e10cSrcweir const sal_uInt32 nNodeID = 0) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID); 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir 124cdf0e10cSrcweir // yyi ist die interne Nr. der Regel, die gerade reduziert wird. 125cdf0e10cSrcweir // Ueber die Mapping-Tabelle yyrmap wird daraus eine externe Regel-Nr. 126cdf0e10cSrcweir #define SQL_NEW_RULE newNode(aEmptyString, SQL_NODE_RULE, yyr1[yyn]) 127cdf0e10cSrcweir #define SQL_NEW_LISTRULE newNode(aEmptyString, SQL_NODE_LISTRULE, yyr1[yyn]) 128cdf0e10cSrcweir #define SQL_NEW_COMMALISTRULE newNode(aEmptyString, SQL_NODE_COMMALISTRULE, yyr1[yyn]) 129cdf0e10cSrcweir 130cdf0e10cSrcweir 131cdf0e10cSrcweir connectivity::OSQLParser* xxx_pGLOBAL_SQLPARSER; 132cdf0e10cSrcweir 133cdf0e10cSrcweir #define YYERROR_VERBOSE 134cdf0e10cSrcweir 135cdf0e10cSrcweir #define SQLyyerror(s) \ 136cdf0e10cSrcweir { \ 137cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->error(s); \ 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir using namespace connectivity; 141cdf0e10cSrcweir #define SQLyylex xxx_pGLOBAL_SQLPARSER->SQLlex 142cdf0e10cSrcweir %} 143cdf0e10cSrcweir /* symbolic tokens */ 144cdf0e10cSrcweir 145cdf0e10cSrcweir %union { 146cdf0e10cSrcweir connectivity::OSQLParseNode * pParseNode; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir %type <pParseNode> '(' ')' ',' ':' ';' '?' '[' ']' '{' '}' '.' 'K' 'M' 'G' 'T' 'P' 149cdf0e10cSrcweir 150cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_STRING SQL_TOKEN_ACCESS_DATE SQL_TOKEN_INT SQL_TOKEN_REAL_NUM 151cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_INTNUM SQL_TOKEN_APPROXNUM SQL_TOKEN_NOT SQL_TOKEN_NAME 152cdf0e10cSrcweir 153cdf0e10cSrcweir 154cdf0e10cSrcweir %nonassoc <pParseNode> SQL_TOKEN_UMINUS 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158cdf0e10cSrcweir /* literal keyword tokens */ 159cdf0e10cSrcweir 160cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_ALL SQL_TOKEN_ALTER SQL_TOKEN_AMMSC SQL_TOKEN_ANY SQL_TOKEN_AS SQL_TOKEN_ASC SQL_TOKEN_AT SQL_TOKEN_AUTHORIZATION SQL_TOKEN_AVG 161cdf0e10cSrcweir 162cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_BETWEEN SQL_TOKEN_BIT SQL_TOKEN_BOTH SQL_TOKEN_BY 163cdf0e10cSrcweir 164cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_CAST SQL_TOKEN_CHARACTER SQL_TOKEN_CHECK SQL_TOKEN_COLLATE SQL_TOKEN_COMMIT SQL_TOKEN_CONTINUE SQL_TOKEN_CONVERT SQL_TOKEN_COUNT SQL_TOKEN_CREATE SQL_TOKEN_CROSS 165cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_CURRENT SQL_TOKEN_CURSOR 166cdf0e10cSrcweir 167cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_DATE SQL_TOKEN_DATEVALUE SQL_TOKEN_DAY SQL_TOKEN_DEC SQL_TOKEN_DECIMAL SQL_TOKEN_DECLARE SQL_TOKEN_DEFAULT SQL_TOKEN_DELETE SQL_TOKEN_DESC 168cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_DISTINCT SQL_TOKEN_DOUBLE SQL_TOKEN_DROP 169cdf0e10cSrcweir 170cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_ESCAPE SQL_TOKEN_EXCEPT SQL_TOKEN_EXISTS SQL_TOKEN_FALSE SQL_TOKEN_FETCH SQL_TOKEN_FLOAT SQL_TOKEN_FOR SQL_TOKEN_FOREIGN SQL_TOKEN_FOUND SQL_TOKEN_FROM SQL_TOKEN_FULL 171cdf0e10cSrcweir 172cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_GRANT SQL_TOKEN_GROUP SQL_TOKEN_HAVING SQL_TOKEN_IN SQL_TOKEN_INDICATOR SQL_TOKEN_INNER SQL_TOKEN_INTEGER SQL_TOKEN_INTO SQL_TOKEN_IS SQL_TOKEN_INTERSECT 173cdf0e10cSrcweir 174cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_JOIN SQL_TOKEN_KEY SQL_TOKEN_LEADING SQL_TOKEN_LIKE SQL_TOKEN_LOCAL SQL_TOKEN_LOWER 175cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_MAX SQL_TOKEN_MIN SQL_TOKEN_NATURAL SQL_TOKEN_NCHAR SQL_TOKEN_NULL SQL_TOKEN_NUMERIC 176cdf0e10cSrcweir 177cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_OCTET_LENGTH SQL_TOKEN_OF SQL_TOKEN_ON SQL_TOKEN_OPTION SQL_TOKEN_ORDER SQL_TOKEN_OUTER 178cdf0e10cSrcweir 179cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_PRECISION SQL_TOKEN_PRIMARY SQL_TOKEN_PRIVILEGES SQL_TOKEN_PROCEDURE SQL_TOKEN_PUBLIC 180cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_REAL SQL_TOKEN_REFERENCES SQL_TOKEN_ROLLBACK 181cdf0e10cSrcweir 182cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_SCHEMA SQL_TOKEN_SELECT SQL_TOKEN_SET SQL_TOKEN_SIZE SQL_TOKEN_SMALLINT SQL_TOKEN_SOME SQL_TOKEN_SQLCODE SQL_TOKEN_SQLERROR SQL_TOKEN_SUM 183cdf0e10cSrcweir 184cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_TABLE SQL_TOKEN_TIME SQL_TOKEN_TIMESTAMP SQL_TOKEN_TIMEZONE_HOUR SQL_TOKEN_TIMEZONE_MINUTE SQL_TOKEN_TO SQL_TOKEN_TRAILING SQL_TOKEN_TRANSLATE SQL_TOKEN_TRIM SQL_TOKEN_TRUE SQL_TOKEN_UNION 185cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_UNIQUE SQL_TOKEN_UNKNOWN SQL_TOKEN_UPDATE SQL_TOKEN_UPPER SQL_TOKEN_USAGE SQL_TOKEN_USER SQL_TOKEN_USING SQL_TOKEN_VALUES SQL_TOKEN_VIEW 186cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_WHERE SQL_TOKEN_WITH SQL_TOKEN_WORK SQL_TOKEN_ZONE 187cdf0e10cSrcweir 188cdf0e10cSrcweir /* ODBC KEYWORDS */ 189cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_CALL SQL_TOKEN_D SQL_TOKEN_FN SQL_TOKEN_T SQL_TOKEN_TS SQL_TOKEN_OJ 190cdf0e10cSrcweir /* string functions */ 191cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_ASCII SQL_TOKEN_BIT_LENGTH SQL_TOKEN_CHAR SQL_TOKEN_CHAR_LENGTH SQL_TOKEN_SQL_TOKEN_INTNUM 192cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_CONCAT 193cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_DIFFERENCE SQL_TOKEN_INSERT SQL_TOKEN_LCASE SQL_TOKEN_LEFT SQL_TOKEN_LENGTH SQL_TOKEN_LOCATE 194cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_LOCATE_2 SQL_TOKEN_LTRIM SQL_TOKEN_POSITION SQL_TOKEN_REPEAT SQL_TOKEN_REPLACE 195cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_RIGHT SQL_TOKEN_RTRIM SQL_TOKEN_SOUNDEX SQL_TOKEN_SPACE SQL_TOKEN_SUBSTRING SQL_TOKEN_UCASE 196cdf0e10cSrcweir 197cdf0e10cSrcweir /* time and date functions */ 198cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_CURRENT_DATE SQL_TOKEN_CURRENT_TIME SQL_TOKEN_CURRENT_TIMESTAMP SQL_TOKEN_CURDATE SQL_TOKEN_CURTIME 199cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_DAYNAME SQL_TOKEN_DAYOFMONTH SQL_TOKEN_DAYOFWEEK SQL_TOKEN_DAYOFYEAR SQL_TOKEN_EXTRACT 200cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_HOUR SQL_TOKEN_MINUTE SQL_TOKEN_MONTH SQL_TOKEN_MONTHNAME SQL_TOKEN_NOW SQL_TOKEN_QUARTER SQL_TOKEN_DATEDIFF 201cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_SECOND SQL_TOKEN_TIMESTAMPADD SQL_TOKEN_TIMESTAMPDIFF SQL_TOKEN_TIMEVALUE SQL_TOKEN_WEEK SQL_TOKEN_YEAR 202cdf0e10cSrcweir 203cdf0e10cSrcweir /* numeric functions */ 204cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_ABS SQL_TOKEN_ACOS SQL_TOKEN_ASIN SQL_TOKEN_ATAN SQL_TOKEN_ATAN2 SQL_TOKEN_CEILING 205cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_COS SQL_TOKEN_COT SQL_TOKEN_DEGREES SQL_TOKEN_EXP SQL_TOKEN_FLOOR SQL_TOKEN_LOGF SQL_TOKEN_LOG SQL_TOKEN_LN 206cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_LOG10 SQL_TOKEN_MOD SQL_TOKEN_PI SQL_TOKEN_POWER SQL_TOKEN_RADIANS SQL_TOKEN_RAND SQL_TOKEN_ROUNDMAGIC 207cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_ROUND SQL_TOKEN_SIGN SQL_TOKEN_SIN SQL_TOKEN_SQRT SQL_TOKEN_TAN SQL_TOKEN_TRUNCATE 208cdf0e10cSrcweir 209cdf0e10cSrcweir // computational operation 210cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_EVERY SQL_TOKEN_INTERSECTION SQL_TOKEN_FUSION SQL_TOKEN_COLLECT SQL_TOKEN_VAR_POP SQL_TOKEN_VAR_SAMP 211cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_STDDEV_SAMP SQL_TOKEN_STDDEV_POP 212cdf0e10cSrcweir 213cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_RANK SQL_TOKEN_DENSE_RANK SQL_TOKEN_PERCENT_RANK SQL_TOKEN_CUME_DIST SQL_TOKEN_PERCENTILE_CONT SQL_TOKEN_PERCENTILE_DISC SQL_TOKEN_WITHIN SQL_TOKEN_ARRAY_AGG 214cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_CASE SQL_TOKEN_THEN SQL_TOKEN_END SQL_TOKEN_NULLIF SQL_TOKEN_COALESCE SQL_TOKEN_WHEN SQL_TOKEN_ELSE 215cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_BEFORE SQL_TOKEN_AFTER SQL_TOKEN_INSTEAD SQL_TOKEN_EACH SQL_TOKEN_REFERENCING SQL_TOKEN_BEGIN SQL_TOKEN_ATOMIC SQL_TOKEN_TRIGGER SQL_TOKEN_ROW SQL_TOKEN_STATEMENT 216cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_NEW SQL_TOKEN_OLD 217cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_VALUE SQL_TOKEN_CURRENT_CATALOG SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP SQL_TOKEN_CURRENT_PATH SQL_TOKEN_CURRENT_ROLE SQL_TOKEN_CURRENT_SCHEMA SQL_TOKEN_CURRENT_USER 218cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_SESSION_USER SQL_TOKEN_SYSTEM_USER SQL_TOKEN_VARCHAR SQL_TOKEN_VARBINARY SQL_TOKEN_VARYING SQL_TOKEN_OBJECT SQL_TOKEN_NCLOB SQL_TOKEN_NATIONAL 219cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_LARGE SQL_TOKEN_CLOB SQL_TOKEN_BLOB SQL_TOKEN_BIGINT SQL_TOKEN_BINARY SQL_TOKEN_WITHOUT SQL_TOKEN_BOOLEAN SQL_TOKEN_INTERVAL 220cdf0e10cSrcweir // window function 221cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_OVER SQL_TOKEN_ROW_NUMBER SQL_TOKEN_NTILE SQL_TOKEN_LEAD SQL_TOKEN_LAG SQL_TOKEN_RESPECT SQL_TOKEN_IGNORE SQL_TOKEN_NULLS 222cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_FIRST_VALUE SQL_TOKEN_LAST_VALUE SQL_TOKEN_NTH_VALUE SQL_TOKEN_FIRST SQL_TOKEN_LAST 223cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_EXCLUDE SQL_TOKEN_OTHERS SQL_TOKEN_TIES SQL_TOKEN_FOLLOWING SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING SQL_TOKEN_RANGE SQL_TOKEN_ROWS 224cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_PARTITION SQL_TOKEN_WINDOW SQL_TOKEN_NO 225cdf0e10cSrcweir // LIMIT and OFFSEt 226cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_LIMIT SQL_TOKEN_OFFSET SQL_TOKEN_NEXT SQL_TOKEN_ONLY 227cdf0e10cSrcweir 228cdf0e10cSrcweir /* operators */ 229cdf0e10cSrcweir %left SQL_TOKEN_NAME 230cdf0e10cSrcweir %left <pParseNode> SQL_TOKEN_OR 231cdf0e10cSrcweir %left <pParseNode> SQL_TOKEN_AND 232cdf0e10cSrcweir 233cdf0e10cSrcweir %left <pParseNode> SQL_LESSEQ SQL_GREATEQ SQL_NOTEQUAL SQL_LESS SQL_GREAT SQL_EQUAL /* '<' '>' = <> < > <= >= != */ 234cdf0e10cSrcweir %left <pParseNode> '+' '-' SQL_CONCAT 235cdf0e10cSrcweir %left <pParseNode> '*' '/' 236cdf0e10cSrcweir %left SQL_TOKEN_NATURAL SQL_TOKEN_CROSS SQL_TOKEN_FULL SQL_TOKEN_LEFT SQL_TOKEN_RIGHT 237cdf0e10cSrcweir %left ')' 238cdf0e10cSrcweir %right '=' 239cdf0e10cSrcweir %right '.' 240cdf0e10cSrcweir %right '(' 241cdf0e10cSrcweir 242cdf0e10cSrcweir 243cdf0e10cSrcweir %token <pParseNode> SQL_TOKEN_INVALIDSYMBOL 244cdf0e10cSrcweir 245cdf0e10cSrcweir /*%type <pParseNode> sql_single_statement */ 246cdf0e10cSrcweir 247cdf0e10cSrcweir %type <pParseNode> sql /*schema */ 248cdf0e10cSrcweir %type <pParseNode> column_def_opt_list column_def_opt table_constraint_def column_commalist 249cdf0e10cSrcweir %type <pParseNode> view_def opt_with_check_option opt_column_commalist privilege_def 250cdf0e10cSrcweir %type <pParseNode> opt_with_grant_option privileges operation_commalist operation 251cdf0e10cSrcweir %type <pParseNode> grantee_commalist grantee opt_order_by_clause ordering_spec_commalist 252cdf0e10cSrcweir %type <pParseNode> ordering_spec opt_asc_desc manipulative_statement commit_statement 253cdf0e10cSrcweir %type <pParseNode> /*delete_statement_positioned*/ delete_statement_searched fetch_statement 254cdf0e10cSrcweir %type <pParseNode> insert_statement values_or_query_spec 255cdf0e10cSrcweir %type <pParseNode> rollback_statement select_statement_into opt_all_distinct 256cdf0e10cSrcweir %type <pParseNode> /*update_statement_positioned*/ assignment_commalist assignment 257cdf0e10cSrcweir %type <pParseNode> update_statement_searched target_commalist target opt_where_clause 258cdf0e10cSrcweir %type <pParseNode> select_statement selection table_exp from_clause table_ref_commalist table_ref 259cdf0e10cSrcweir %type <pParseNode> where_clause opt_group_by_clause column_ref_commalist opt_having_clause 260cdf0e10cSrcweir %type <pParseNode> search_condition predicate comparison_predicate comparison_predicate_part_2 between_predicate between_predicate_part_2 261cdf0e10cSrcweir %type <pParseNode> like_predicate opt_escape test_for_null null_predicate_part_2 in_predicate in_predicate_part_2 character_like_predicate_part_2 other_like_predicate_part_2 262cdf0e10cSrcweir %type <pParseNode> all_or_any_predicate any_all_some existence_test subquery quantified_comparison_predicate_part_2 263cdf0e10cSrcweir %type <pParseNode> scalar_exp_commalist parameter_ref literal parenthesized_boolean_value_expression 264cdf0e10cSrcweir %type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/ 265cdf0e10cSrcweir /* neue Regeln bei OJ */ 266cdf0e10cSrcweir %type <pParseNode> derived_column as_clause table_name num_primary term num_value_exp 267cdf0e10cSrcweir %type <pParseNode> value_exp_primary num_value_fct unsigned_value_spec cast_spec set_fct_spec scalar_subquery 268cdf0e10cSrcweir %type <pParseNode> position_exp extract_exp length_exp general_value_spec 269cdf0e10cSrcweir %type <pParseNode> general_set_fct set_fct_type query_exp non_join_query_exp joined_table 270cdf0e10cSrcweir %type <pParseNode> non_join_query_term non_join_query_primary simple_table 271cdf0e10cSrcweir %type <pParseNode> table_value_const_list row_value_constructor row_value_const_list row_value_constructor_elem 272cdf0e10cSrcweir %type <pParseNode> qualified_join value_exp query_term join_type outer_join_type join_condition boolean_term 273cdf0e10cSrcweir %type <pParseNode> boolean_factor truth_value boolean_test boolean_primary named_columns_join join_spec 274cdf0e10cSrcweir %type <pParseNode> cast_operand cast_target factor datetime_value_exp /*interval_value_exp*/ datetime_term datetime_factor 275cdf0e10cSrcweir %type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ interval_qualifier 276cdf0e10cSrcweir %type <pParseNode> start_field non_second_datetime_field end_field single_datetime_field extract_field datetime_field time_zone_field 277cdf0e10cSrcweir %type <pParseNode> extract_source char_length_exp octet_length_exp bit_length_exp select_sublist string_value_exp 278cdf0e10cSrcweir %type <pParseNode> char_value_exp concatenation char_factor char_primary string_value_fct char_substring_fct fold 279cdf0e10cSrcweir %type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist 280cdf0e10cSrcweir %type <pParseNode> /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source 281cdf0e10cSrcweir %type <pParseNode> function_arg_commalist3 string_function_3Argument function_arg_commalist4 string_function_4Argument function_arg_commalist2 string_function_1Argument string_function_2Argument 282cdf0e10cSrcweir %type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument 283cdf0e10cSrcweir %type <pParseNode> all query_primary sql_not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/ 284cdf0e10cSrcweir %type <pParseNode> /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist 285cdf0e10cSrcweir %type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement 286cdf0e10cSrcweir %type <pParseNode> op_odbc_call_parameter odbc_parameter_commalist odbc_parameter function_args_commalist function_arg 287cdf0e10cSrcweir %type <pParseNode> catalog_name schema_name table_node numeric_function string_function function_name date_function table_primary_as_range_column opt_as 288cdf0e10cSrcweir %type <pParseNode> ordered_set_function inverse_distribution_function hypothetical_set_function hypothetical_set_function_value_expression_list rank_function_type within_group_specification inverse_distribution_function_type array_aggregate_function inverse_distribution_function_argument 289cdf0e10cSrcweir %type <pParseNode> case_expression else_clause result_expression result case_abbreviation case_specification searched_when_clause simple_when_clause searched_case simple_case 290cdf0e10cSrcweir %type <pParseNode> when_operand_list when_operand case_operand 291cdf0e10cSrcweir %type <pParseNode> trigger_definition trigger_name trigger_action_time trigger_event transition_table_or_variable_list triggered_action trigger_column_list triggered_when_clause triggered_SQL_statement SQL_procedure_statement old_transition_variable_name new_transition_variable_name 292cdf0e10cSrcweir %type <pParseNode> op_referencing op_trigger_columnlist op_triggered_action_for opt_row trigger_for SQL_procedure_statement_list transition_table_or_variable old_transition_table_name new_transition_table_name transition_table_name 293cdf0e10cSrcweir %type <pParseNode> searched_when_clause_list simple_when_clause_list predefined_type opt_char_set_spec opt_collate_clause character_string_type national_character_string_type 294cdf0e10cSrcweir %type <pParseNode> binary_string_type numeric_type boolean_type datetime_type interval_type opt_paren_precision paren_char_length opt_paren_char_large_length paren_character_large_object_length 295cdf0e10cSrcweir %type <pParseNode> large_object_length opt_multiplier character_large_object_type national_character_large_object_type binary_large_object_string_type opt_with_or_without_time_zone 296cdf0e10cSrcweir %type <pParseNode> approximate_numeric_type exact_numeric_type opt_paren_precision_scale 297cdf0e10cSrcweir /* window function rules */ 298cdf0e10cSrcweir %type <pParseNode> window_function window_function_type ntile_function number_of_tiles lead_or_lag_function lead_or_lag lead_or_lag_extent offset default_expression null_treatment 299cdf0e10cSrcweir %type <pParseNode> first_or_last_value_function first_or_last_value nth_value_function nth_row from_first_or_last window_name_or_specification in_line_window_specification opt_lead_or_lag_function 300cdf0e10cSrcweir %type <pParseNode> opt_null_treatment opt_from_first_or_last simple_value_specification dynamic_parameter_specification window_name window_clause window_definition_list window_definition 301cdf0e10cSrcweir %type <pParseNode> new_window_name window_specification_details existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause 302cdf0e10cSrcweir %type <pParseNode> window_frame_units window_frame_extent window_frame_start window_frame_preceding window_frame_between window_frame_bound_1 window_frame_bound_2 window_frame_bound window_frame_following window_frame_exclusion 303cdf0e10cSrcweir %type <pParseNode> opt_window_frame_clause opt_window_partition_clause opt_existing_window_name window_specification opt_window_frame_exclusion opt_window_clause opt_offset 304cdf0e10cSrcweir %type <pParseNode> opt_fetch_first_row_count fetch_first_clause offset_row_count fetch_first_row_count first_or_next row_or_rows opt_result_offset_clause result_offset_clause 305cdf0e10cSrcweir /* LIMIT and OFFSET */ 306cdf0e10cSrcweir %type <pParseNode> opt_limit_offset_clause limit_offset_clause opt_fetch_first_clause 307cdf0e10cSrcweir %% 308cdf0e10cSrcweir 309cdf0e10cSrcweir /* Parse Tree an OSQLParser zurueckliefern 310cdf0e10cSrcweir * (der Zugriff ueber yyval nach Aufruf des Parsers scheitert, 311cdf0e10cSrcweir * 312cdf0e10cSrcweir */ 313cdf0e10cSrcweir sql_single_statement: 314cdf0e10cSrcweir sql 315cdf0e10cSrcweir { xxx_pGLOBAL_SQLPARSER->setParseTree( $1 ); } 316cdf0e10cSrcweir | sql ';' 317cdf0e10cSrcweir { xxx_pGLOBAL_SQLPARSER->setParseTree( $1 ); } 318cdf0e10cSrcweir ; 319cdf0e10cSrcweir 320cdf0e10cSrcweir /* schema definition language */ 321cdf0e10cSrcweir /* Note: other ``sql:sal_Unicode() rules appear later in the grammar */ 322cdf0e10cSrcweir 323cdf0e10cSrcweir sql: 324cdf0e10cSrcweir manipulative_statement 325cdf0e10cSrcweir | schema_element 326cdf0e10cSrcweir { 327cdf0e10cSrcweir $$ = SQL_NEW_RULE; 328cdf0e10cSrcweir $$->append($1); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir ; 331cdf0e10cSrcweir 332cdf0e10cSrcweir /*** 333cdf0e10cSrcweir 334cdf0e10cSrcweir op_authorization: 335cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 336cdf0e10cSrcweir | SQL_TOKEN_AUTHORIZATION user 337cdf0e10cSrcweir { 338cdf0e10cSrcweir $$ = SQL_NEW_RULE; 339cdf0e10cSrcweir $$->append($1); 340cdf0e10cSrcweir $$->append($2); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir ; 343cdf0e10cSrcweir op_schema: 344cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 345cdf0e10cSrcweir | SQL_TOKEN_NAME 346cdf0e10cSrcweir | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME 347cdf0e10cSrcweir { 348cdf0e10cSrcweir $$ = SQL_NEW_RULE; 349cdf0e10cSrcweir $$->append($1); 350cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 351cdf0e10cSrcweir $$->append($3); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir ; 354cdf0e10cSrcweir 355cdf0e10cSrcweir schema: 356cdf0e10cSrcweir SQL_TOKEN_CREATE SQL_TOKEN_SCHEMA op_schema op_authorization opt_schema_element_list 357cdf0e10cSrcweir { 358cdf0e10cSrcweir $$ = SQL_NEW_RULE; 359cdf0e10cSrcweir $$->append($1); 360cdf0e10cSrcweir $$->append($2); 361cdf0e10cSrcweir $$->append($3); 362cdf0e10cSrcweir $$->append($4); 363cdf0e10cSrcweir $$->append($5); 364cdf0e10cSrcweir } 365cdf0e10cSrcweir ; 366cdf0e10cSrcweir 367cdf0e10cSrcweir opt_schema_element_list: 368cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 369cdf0e10cSrcweir | schema_glement_list 370cdf0e10cSrcweir ; 371cdf0e10cSrcweir 372cdf0e10cSrcweir schema_element_list: 373cdf0e10cSrcweir schema_element 374cdf0e10cSrcweir {$$ = SQL_NEW_LISTRULE; 375cdf0e10cSrcweir $$->append($1);} 376cdf0e10cSrcweir | schema_element_list schema_element 377cdf0e10cSrcweir {$1->append($2); 378cdf0e10cSrcweir $$ = $1;} 379cdf0e10cSrcweir ; 380cdf0e10cSrcweir */ 381cdf0e10cSrcweir 382cdf0e10cSrcweir schema_element: 383cdf0e10cSrcweir base_table_def 384cdf0e10cSrcweir | view_def 385cdf0e10cSrcweir | privilege_def 386cdf0e10cSrcweir | trigger_definition 387cdf0e10cSrcweir ; 388cdf0e10cSrcweir 389cdf0e10cSrcweir base_table_def: 390cdf0e10cSrcweir SQL_TOKEN_CREATE SQL_TOKEN_TABLE table_node '(' base_table_element_commalist ')' 391cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 392cdf0e10cSrcweir $$->append($1); 393cdf0e10cSrcweir $$->append($2); 394cdf0e10cSrcweir $$->append($3); 395cdf0e10cSrcweir $$->append($4 = newNode("(", SQL_NODE_PUNCTUATION)); 396cdf0e10cSrcweir $$->append($5); 397cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} 398cdf0e10cSrcweir ; 399cdf0e10cSrcweir 400cdf0e10cSrcweir base_table_element_commalist: 401cdf0e10cSrcweir base_table_element 402cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 403cdf0e10cSrcweir $$->append($1);} 404cdf0e10cSrcweir | base_table_element_commalist ',' base_table_element 405cdf0e10cSrcweir {$1->append($3); 406cdf0e10cSrcweir $$ = $1;} 407cdf0e10cSrcweir ; 408cdf0e10cSrcweir 409cdf0e10cSrcweir base_table_element: 410cdf0e10cSrcweir column_def 411cdf0e10cSrcweir | table_constraint_def 412cdf0e10cSrcweir ; 413cdf0e10cSrcweir 414cdf0e10cSrcweir column_def: 415cdf0e10cSrcweir column data_type column_def_opt_list 416cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 417cdf0e10cSrcweir $$->append($1); 418cdf0e10cSrcweir $$->append($2); 419cdf0e10cSrcweir $$->append($3); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir ; 422cdf0e10cSrcweir 423cdf0e10cSrcweir column_def_opt_list: 424cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_LISTRULE;} 425cdf0e10cSrcweir | column_def_opt_list column_def_opt 426cdf0e10cSrcweir {$1->append($2); 427cdf0e10cSrcweir $$ = $1;} 428cdf0e10cSrcweir ; 429cdf0e10cSrcweir 430cdf0e10cSrcweir nil_fkt: 431cdf0e10cSrcweir datetime_value_fct 432cdf0e10cSrcweir ; 433cdf0e10cSrcweir unique_spec: 434cdf0e10cSrcweir SQL_TOKEN_UNIQUE 435cdf0e10cSrcweir | SQL_TOKEN_PRIMARY SQL_TOKEN_KEY 436cdf0e10cSrcweir { 437cdf0e10cSrcweir $$ = SQL_NEW_RULE; 438cdf0e10cSrcweir $$->append($1); 439cdf0e10cSrcweir $$->append($2); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir ; 442cdf0e10cSrcweir column_def_opt: 443cdf0e10cSrcweir SQL_TOKEN_NOT SQL_TOKEN_NULL 444cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 445cdf0e10cSrcweir $$->append($1); 446cdf0e10cSrcweir $$->append($2);} 447cdf0e10cSrcweir | unique_spec 448cdf0e10cSrcweir | SQL_TOKEN_DEFAULT literal 449cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 450cdf0e10cSrcweir $$->append($1); 451cdf0e10cSrcweir $$->append($2);} 452cdf0e10cSrcweir | SQL_TOKEN_DEFAULT SQL_TOKEN_NULL 453cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 454cdf0e10cSrcweir $$->append($1); 455cdf0e10cSrcweir $$->append($2);} 456cdf0e10cSrcweir | SQL_TOKEN_DEFAULT SQL_TOKEN_USER 457cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 458cdf0e10cSrcweir $$->append($1); 459cdf0e10cSrcweir $$->append($2);} 460cdf0e10cSrcweir | SQL_TOKEN_DEFAULT nil_fkt 461cdf0e10cSrcweir { 462cdf0e10cSrcweir $$ = SQL_NEW_RULE; 463cdf0e10cSrcweir $$->append($1); 464cdf0e10cSrcweir $$->append($2); 465cdf0e10cSrcweir } 466cdf0e10cSrcweir | SQL_TOKEN_CHECK 467cdf0e10cSrcweir | SQL_TOKEN_CHECK '(' search_condition ')' 468cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 469cdf0e10cSrcweir $$->append($1); 470cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 471cdf0e10cSrcweir $$->append($3); 472cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} 473cdf0e10cSrcweir | SQL_TOKEN_REFERENCES table_node 474cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 475cdf0e10cSrcweir $$->append($1); 476cdf0e10cSrcweir $$->append($2);} 477cdf0e10cSrcweir | SQL_TOKEN_REFERENCES table_node '(' column_commalist ')' 478cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 479cdf0e10cSrcweir $$->append($1); 480cdf0e10cSrcweir $$->append($2); 481cdf0e10cSrcweir $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); 482cdf0e10cSrcweir $$->append($4); 483cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION));} 484cdf0e10cSrcweir ; 485cdf0e10cSrcweir 486cdf0e10cSrcweir table_constraint_def: 487cdf0e10cSrcweir unique_spec '(' column_commalist ')' 488cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 489cdf0e10cSrcweir $$->append($1); 490cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 491cdf0e10cSrcweir $$->append($3); 492cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} 493cdf0e10cSrcweir | SQL_TOKEN_FOREIGN SQL_TOKEN_KEY '(' column_commalist ')' SQL_TOKEN_REFERENCES table_node 494cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 495cdf0e10cSrcweir $$->append($1); 496cdf0e10cSrcweir $$->append($2); 497cdf0e10cSrcweir $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); 498cdf0e10cSrcweir $$->append($4); 499cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 500cdf0e10cSrcweir $$->append($6); 501cdf0e10cSrcweir $$->append($7);} 502cdf0e10cSrcweir | SQL_TOKEN_FOREIGN SQL_TOKEN_KEY '(' column_commalist ')' SQL_TOKEN_REFERENCES table_node '(' column_commalist ')' 503cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 504cdf0e10cSrcweir $$->append($1); 505cdf0e10cSrcweir $$->append($2); 506cdf0e10cSrcweir $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); 507cdf0e10cSrcweir $$->append($4); 508cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 509cdf0e10cSrcweir $$->append($6); 510cdf0e10cSrcweir $$->append($7); 511cdf0e10cSrcweir $$->append($8 = newNode("(", SQL_NODE_PUNCTUATION)); 512cdf0e10cSrcweir $$->append($9); 513cdf0e10cSrcweir $$->append($10 = newNode(")", SQL_NODE_PUNCTUATION));} 514cdf0e10cSrcweir | SQL_TOKEN_CHECK '(' search_condition ')' 515cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 516cdf0e10cSrcweir $$->append($1); 517cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 518cdf0e10cSrcweir $$->append($3); 519cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} 520cdf0e10cSrcweir ; 521cdf0e10cSrcweir op_column_commalist: 522cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 523cdf0e10cSrcweir | '(' column_commalist ')' 524cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 525cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 526cdf0e10cSrcweir $$->append($2); 527cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 528cdf0e10cSrcweir } 529cdf0e10cSrcweir ; 530cdf0e10cSrcweir column_commalist: 531cdf0e10cSrcweir column_commalist ',' column 532cdf0e10cSrcweir {$1->append($3); 533cdf0e10cSrcweir $$ = $1;} 534cdf0e10cSrcweir | column 535cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 536cdf0e10cSrcweir $$->append($1);} 537cdf0e10cSrcweir ; 538cdf0e10cSrcweir 539cdf0e10cSrcweir view_def: 540cdf0e10cSrcweir SQL_TOKEN_CREATE SQL_TOKEN_VIEW table_node opt_column_commalist SQL_TOKEN_AS select_statement opt_with_check_option 541cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 542cdf0e10cSrcweir $$->append($1); 543cdf0e10cSrcweir $$->append($2); 544cdf0e10cSrcweir $$->append($3); 545cdf0e10cSrcweir $$->append($4); 546cdf0e10cSrcweir $$->append($5); 547cdf0e10cSrcweir $$->append($6); 548cdf0e10cSrcweir $$->append($7);} 549cdf0e10cSrcweir ; 550cdf0e10cSrcweir 551cdf0e10cSrcweir opt_with_check_option: 552cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 553cdf0e10cSrcweir | SQL_TOKEN_WITH SQL_TOKEN_CHECK SQL_TOKEN_OPTION 554cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 555cdf0e10cSrcweir $$->append($1); 556cdf0e10cSrcweir $$->append($2); 557cdf0e10cSrcweir $$->append($3);} 558cdf0e10cSrcweir ; 559cdf0e10cSrcweir 560cdf0e10cSrcweir opt_column_commalist: 561cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 562cdf0e10cSrcweir | '(' column_commalist ')' 563cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 564cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 565cdf0e10cSrcweir $$->append($2); 566cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));} 567cdf0e10cSrcweir ; 568cdf0e10cSrcweir 569cdf0e10cSrcweir privilege_def: 570cdf0e10cSrcweir SQL_TOKEN_GRANT privileges SQL_TOKEN_ON table_node SQL_TOKEN_TO grantee_commalist 571cdf0e10cSrcweir opt_with_grant_option 572cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 573cdf0e10cSrcweir $$->append($1); 574cdf0e10cSrcweir $$->append($2); 575cdf0e10cSrcweir $$->append($3); 576cdf0e10cSrcweir $$->append($4); 577cdf0e10cSrcweir $$->append($5); 578cdf0e10cSrcweir $$->append($6); 579cdf0e10cSrcweir $$->append($7);} 580cdf0e10cSrcweir ; 581cdf0e10cSrcweir 582cdf0e10cSrcweir opt_with_grant_option: 583cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 584cdf0e10cSrcweir | SQL_TOKEN_WITH SQL_TOKEN_GRANT SQL_TOKEN_OPTION 585cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 586cdf0e10cSrcweir $$->append($1); 587cdf0e10cSrcweir $$->append($2); 588cdf0e10cSrcweir $$->append($3);} 589cdf0e10cSrcweir ; 590cdf0e10cSrcweir 591cdf0e10cSrcweir privileges: 592cdf0e10cSrcweir SQL_TOKEN_ALL SQL_TOKEN_PRIVILEGES 593cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 594cdf0e10cSrcweir $$->append($1); 595cdf0e10cSrcweir $$->append($2);} 596cdf0e10cSrcweir | operation_commalist 597cdf0e10cSrcweir ; 598cdf0e10cSrcweir 599cdf0e10cSrcweir operation_commalist: 600cdf0e10cSrcweir operation 601cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 602cdf0e10cSrcweir $$->append($1);} 603cdf0e10cSrcweir | operation_commalist ',' operation 604cdf0e10cSrcweir {$1->append($3); 605cdf0e10cSrcweir $$ = $1;} 606cdf0e10cSrcweir ; 607cdf0e10cSrcweir 608cdf0e10cSrcweir operation: 609cdf0e10cSrcweir SQL_TOKEN_SELECT 610cdf0e10cSrcweir | SQL_TOKEN_INSERT opt_column_commalist 611cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 612cdf0e10cSrcweir $$->append($1); 613cdf0e10cSrcweir $$->append($2);} 614cdf0e10cSrcweir | SQL_TOKEN_DELETE 615cdf0e10cSrcweir | SQL_TOKEN_UPDATE opt_column_commalist 616cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 617cdf0e10cSrcweir $$->append($1); 618cdf0e10cSrcweir $$->append($2);} 619cdf0e10cSrcweir | SQL_TOKEN_REFERENCES opt_column_commalist 620cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 621cdf0e10cSrcweir $$->append($1); 622cdf0e10cSrcweir $$->append($2);} 623cdf0e10cSrcweir | SQL_TOKEN_USAGE 624cdf0e10cSrcweir ; 625cdf0e10cSrcweir 626cdf0e10cSrcweir 627cdf0e10cSrcweir grantee_commalist: 628cdf0e10cSrcweir grantee 629cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 630cdf0e10cSrcweir $$->append($1);} 631cdf0e10cSrcweir | grantee_commalist ',' grantee 632cdf0e10cSrcweir {$1->append($3); 633cdf0e10cSrcweir $$ = $1;} 634cdf0e10cSrcweir ; 635cdf0e10cSrcweir 636cdf0e10cSrcweir grantee: 637cdf0e10cSrcweir SQL_TOKEN_PUBLIC 638cdf0e10cSrcweir | user 639cdf0e10cSrcweir ; 640cdf0e10cSrcweir 641cdf0e10cSrcweir /* module language */ 642cdf0e10cSrcweir 643cdf0e10cSrcweir opt_order_by_clause: 644cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 645cdf0e10cSrcweir | SQL_TOKEN_ORDER SQL_TOKEN_BY ordering_spec_commalist 646cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 647cdf0e10cSrcweir $$->append($1); 648cdf0e10cSrcweir $$->append($2); 649cdf0e10cSrcweir $$->append($3);} 650cdf0e10cSrcweir ; 651cdf0e10cSrcweir 652cdf0e10cSrcweir ordering_spec_commalist: 653cdf0e10cSrcweir ordering_spec 654cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 655cdf0e10cSrcweir $$->append($1);} 656cdf0e10cSrcweir | ordering_spec_commalist ',' ordering_spec 657cdf0e10cSrcweir {$1->append($3); 658cdf0e10cSrcweir $$ = $1;} 659cdf0e10cSrcweir ; 660cdf0e10cSrcweir 661cdf0e10cSrcweir ordering_spec: 662cdf0e10cSrcweir /* SQL_TOKEN_INTNUM opt_asc_desc 663cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 664cdf0e10cSrcweir $$->append($1); 665cdf0e10cSrcweir $$->append($2);} 666cdf0e10cSrcweir */ 667cdf0e10cSrcweir predicate opt_asc_desc 668cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 669cdf0e10cSrcweir $$->append($1); 670cdf0e10cSrcweir $$->append($2);} 671cdf0e10cSrcweir 672cdf0e10cSrcweir | row_value_constructor_elem opt_asc_desc 673cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 674cdf0e10cSrcweir $$->append($1); 675cdf0e10cSrcweir $$->append($2);} 676cdf0e10cSrcweir ; 677cdf0e10cSrcweir 678cdf0e10cSrcweir opt_asc_desc: 679cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 680cdf0e10cSrcweir | SQL_TOKEN_ASC 681cdf0e10cSrcweir | SQL_TOKEN_DESC 682cdf0e10cSrcweir ; 683cdf0e10cSrcweir 684cdf0e10cSrcweir 685cdf0e10cSrcweir /*** 686cdf0e10cSrcweir manipulative_statement_list: 687cdf0e10cSrcweir manipulative_statement 688cdf0e10cSrcweir {$$ = SQL_NEW_LISTRULE; 689cdf0e10cSrcweir $$->append($1);} 690cdf0e10cSrcweir | manipulative_statement_list manipulative_statement 691cdf0e10cSrcweir {$1->append($2); 692cdf0e10cSrcweir $$ = $1;} 693cdf0e10cSrcweir ; 694cdf0e10cSrcweir ***/ 695cdf0e10cSrcweir 696cdf0e10cSrcweir sql_not: 697cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 698cdf0e10cSrcweir | SQL_TOKEN_NOT 699cdf0e10cSrcweir ; 700cdf0e10cSrcweir 701cdf0e10cSrcweir /* manipulative statements */ 702cdf0e10cSrcweir 703cdf0e10cSrcweir manipulative_statement: 704cdf0e10cSrcweir commit_statement 705cdf0e10cSrcweir /* | delete_statement_positioned*/ 706cdf0e10cSrcweir | delete_statement_searched 707cdf0e10cSrcweir | fetch_statement 708cdf0e10cSrcweir | insert_statement 709cdf0e10cSrcweir | rollback_statement 710cdf0e10cSrcweir | select_statement_into 711cdf0e10cSrcweir /* | update_statement_positioned*/ 712cdf0e10cSrcweir | update_statement_searched 713cdf0e10cSrcweir | union_statement 714cdf0e10cSrcweir | '{' odbc_call_spec '}' 715cdf0e10cSrcweir { 716cdf0e10cSrcweir $$ = SQL_NEW_RULE; 717cdf0e10cSrcweir $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); 718cdf0e10cSrcweir $$->append($2); 719cdf0e10cSrcweir $$->append($3 = newNode("}", SQL_NODE_PUNCTUATION)); 720cdf0e10cSrcweir } 721cdf0e10cSrcweir ; 722cdf0e10cSrcweir 723cdf0e10cSrcweir union_statement: 724cdf0e10cSrcweir select_statement 725cdf0e10cSrcweir | union_statement SQL_TOKEN_UNION all select_statement 726cdf0e10cSrcweir { 727cdf0e10cSrcweir $$ = SQL_NEW_RULE; 728cdf0e10cSrcweir $$->append($1); 729cdf0e10cSrcweir $$->append($2); 730cdf0e10cSrcweir $$->append($3); 731cdf0e10cSrcweir $$->append($4); 732cdf0e10cSrcweir } 733cdf0e10cSrcweir ; 734cdf0e10cSrcweir commit_statement: 735cdf0e10cSrcweir SQL_TOKEN_COMMIT SQL_TOKEN_WORK 736cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 737cdf0e10cSrcweir $$->append($1); 738cdf0e10cSrcweir $$->append($2);} 739cdf0e10cSrcweir ; 740cdf0e10cSrcweir /* 741cdf0e10cSrcweir delete_statement_positioned: 742cdf0e10cSrcweir SQL_TOKEN_DELETE SQL_TOKEN_FROM table_node SQL_TOKEN_WHERE SQL_TOKEN_CURRENT SQL_TOKEN_OF cursor 743cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 744cdf0e10cSrcweir $$->append($1); 745cdf0e10cSrcweir $$->append($2); 746cdf0e10cSrcweir $$->append($3); 747cdf0e10cSrcweir $$->append($4); 748cdf0e10cSrcweir $$->append($5); 749cdf0e10cSrcweir $$->append($6); 750cdf0e10cSrcweir $$->append($7);} 751cdf0e10cSrcweir ; 752cdf0e10cSrcweir */ 753cdf0e10cSrcweir delete_statement_searched: 754cdf0e10cSrcweir SQL_TOKEN_DELETE SQL_TOKEN_FROM table_node opt_where_clause 755cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 756cdf0e10cSrcweir $$->append($1); 757cdf0e10cSrcweir $$->append($2); 758cdf0e10cSrcweir $$->append($3); 759cdf0e10cSrcweir $$->append($4);} 760cdf0e10cSrcweir ; 761cdf0e10cSrcweir 762cdf0e10cSrcweir fetch_statement: 763cdf0e10cSrcweir SQL_TOKEN_FETCH cursor SQL_TOKEN_INTO target_commalist 764cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 765cdf0e10cSrcweir $$->append($1); 766cdf0e10cSrcweir $$->append($2); 767cdf0e10cSrcweir $$->append($3); 768cdf0e10cSrcweir $$->append($4);} 769cdf0e10cSrcweir ; 770cdf0e10cSrcweir 771cdf0e10cSrcweir insert_statement: 772cdf0e10cSrcweir SQL_TOKEN_INSERT SQL_TOKEN_INTO table_node opt_column_commalist values_or_query_spec 773cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 774cdf0e10cSrcweir $$->append($1); 775cdf0e10cSrcweir $$->append($2); 776cdf0e10cSrcweir $$->append($3); 777cdf0e10cSrcweir $$->append($4); 778cdf0e10cSrcweir $$->append($5);} 779cdf0e10cSrcweir ; 780cdf0e10cSrcweir values_or_query_spec: 781cdf0e10cSrcweir SQL_TOKEN_VALUES '(' table_value_const_list ')' 782cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 783cdf0e10cSrcweir $$->append($1); 784cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 785cdf0e10cSrcweir $$->append($3); 786cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 787cdf0e10cSrcweir } 788cdf0e10cSrcweir ; 789cdf0e10cSrcweir 790cdf0e10cSrcweir table_value_const_list: 791cdf0e10cSrcweir row_value_constructor 792cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 793cdf0e10cSrcweir $$->append($1);} 794cdf0e10cSrcweir | table_value_const_list ',' row_value_constructor 795cdf0e10cSrcweir {$1->append($3); 796cdf0e10cSrcweir $$ = $1;} 797cdf0e10cSrcweir ; 798cdf0e10cSrcweir row_value_const_list: 799cdf0e10cSrcweir row_value_constructor_elem 800cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 801cdf0e10cSrcweir $$->append($1);} 802cdf0e10cSrcweir | row_value_const_list ',' row_value_constructor_elem 803cdf0e10cSrcweir {$1->append($3); 804cdf0e10cSrcweir $$ = $1;} 805cdf0e10cSrcweir ; 806cdf0e10cSrcweir row_value_constructor: 807cdf0e10cSrcweir row_value_constructor_elem 808cdf0e10cSrcweir /* | '(' row_value_const_list ')' 809cdf0e10cSrcweir { 810cdf0e10cSrcweir $$ = SQL_NEW_RULE; 811cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 812cdf0e10cSrcweir $$->append($2); 813cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 814cdf0e10cSrcweir } 815cdf0e10cSrcweir */ 816cdf0e10cSrcweir ; 817cdf0e10cSrcweir row_value_constructor_elem: 818cdf0e10cSrcweir value_exp /*[^')']*/ 819cdf0e10cSrcweir | SQL_TOKEN_DEFAULT 820cdf0e10cSrcweir ; 821cdf0e10cSrcweir 822cdf0e10cSrcweir 823cdf0e10cSrcweir rollback_statement: 824cdf0e10cSrcweir SQL_TOKEN_ROLLBACK SQL_TOKEN_WORK 825cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 826cdf0e10cSrcweir $$->append($1); 827cdf0e10cSrcweir $$->append($2);} 828cdf0e10cSrcweir ; 829cdf0e10cSrcweir 830cdf0e10cSrcweir 831cdf0e10cSrcweir /* INTO target_commalist herausgenommen */ 832cdf0e10cSrcweir select_statement_into: 833cdf0e10cSrcweir SQL_TOKEN_SELECT opt_all_distinct selection SQL_TOKEN_INTO target_commalist table_exp 834cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 835cdf0e10cSrcweir $$->append($1); 836cdf0e10cSrcweir $$->append($2); 837cdf0e10cSrcweir $$->append($3); 838cdf0e10cSrcweir $$->append($4); 839cdf0e10cSrcweir $$->append($5); 840cdf0e10cSrcweir $$->append($6); } 841cdf0e10cSrcweir ; 842cdf0e10cSrcweir 843cdf0e10cSrcweir opt_all_distinct: 844cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 845cdf0e10cSrcweir | SQL_TOKEN_ALL 846cdf0e10cSrcweir | SQL_TOKEN_DISTINCT 847cdf0e10cSrcweir 848cdf0e10cSrcweir ; 849cdf0e10cSrcweir /* 850cdf0e10cSrcweir update_statement_positioned: 851cdf0e10cSrcweir SQL_TOKEN_UPDATE table_node SQL_TOKEN_SET assignment_commalist 852cdf0e10cSrcweir SQL_TOKEN_WHERE SQL_TOKEN_CURRENT SQL_TOKEN_OF cursor 853cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 854cdf0e10cSrcweir $$->append($1); 855cdf0e10cSrcweir $$->append($2); 856cdf0e10cSrcweir $$->append($3); 857cdf0e10cSrcweir $$->append($4); 858cdf0e10cSrcweir $$->append($5); 859cdf0e10cSrcweir $$->append($6); 860cdf0e10cSrcweir $$->append($7); 861cdf0e10cSrcweir $$->append($8);} 862cdf0e10cSrcweir ; 863cdf0e10cSrcweir */ 864cdf0e10cSrcweir assignment_commalist: 865cdf0e10cSrcweir assignment 866cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 867cdf0e10cSrcweir $$->append($1);} 868cdf0e10cSrcweir | assignment_commalist ',' assignment 869cdf0e10cSrcweir {$1->append($3); 870cdf0e10cSrcweir $$ = $1;} 871cdf0e10cSrcweir ; 872cdf0e10cSrcweir 873cdf0e10cSrcweir assignment: 874cdf0e10cSrcweir column SQL_EQUAL update_source 875cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 876cdf0e10cSrcweir $$->append($1); 877cdf0e10cSrcweir $$->append($2); 878cdf0e10cSrcweir $$->append($3);} 879cdf0e10cSrcweir ; 880cdf0e10cSrcweir update_source: 881cdf0e10cSrcweir value_exp 882cdf0e10cSrcweir | SQL_TOKEN_DEFAULT 883cdf0e10cSrcweir ; 884cdf0e10cSrcweir update_statement_searched: 885cdf0e10cSrcweir SQL_TOKEN_UPDATE table_node SQL_TOKEN_SET assignment_commalist opt_where_clause 886cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 887cdf0e10cSrcweir $$->append($1); 888cdf0e10cSrcweir $$->append($2); 889cdf0e10cSrcweir $$->append($3); 890cdf0e10cSrcweir $$->append($4); 891cdf0e10cSrcweir $$->append($5);} 892cdf0e10cSrcweir ; 893cdf0e10cSrcweir 894cdf0e10cSrcweir target_commalist: 895cdf0e10cSrcweir target 896cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 897cdf0e10cSrcweir $$->append($1);} 898cdf0e10cSrcweir | target_commalist ',' target 899cdf0e10cSrcweir {$1->append($3); 900cdf0e10cSrcweir $$ = $1;} 901cdf0e10cSrcweir ; 902cdf0e10cSrcweir 903cdf0e10cSrcweir target: 904cdf0e10cSrcweir parameter_ref 905cdf0e10cSrcweir ; 906cdf0e10cSrcweir 907cdf0e10cSrcweir opt_where_clause: 908cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 909cdf0e10cSrcweir | where_clause 910cdf0e10cSrcweir ; 911cdf0e10cSrcweir 912cdf0e10cSrcweir /* query expressions */ 913cdf0e10cSrcweir 914cdf0e10cSrcweir query_term: 915cdf0e10cSrcweir non_join_query_term 916cdf0e10cSrcweir { 917cdf0e10cSrcweir $$ = SQL_NEW_RULE; 918cdf0e10cSrcweir $$->append($1); 919cdf0e10cSrcweir } 920cdf0e10cSrcweir ; 921cdf0e10cSrcweir /* SELECT STATEMENT */ 922cdf0e10cSrcweir select_statement: 923cdf0e10cSrcweir SQL_TOKEN_SELECT opt_all_distinct selection table_exp 924cdf0e10cSrcweir { 925cdf0e10cSrcweir $$ = SQL_NEW_RULE; 926cdf0e10cSrcweir $$->append($1); 927cdf0e10cSrcweir $$->append($2); 928cdf0e10cSrcweir $$->append($3); 929cdf0e10cSrcweir $$->append($4); 930cdf0e10cSrcweir } 931cdf0e10cSrcweir ; 932cdf0e10cSrcweir 933cdf0e10cSrcweir selection: 934cdf0e10cSrcweir '*' 935cdf0e10cSrcweir { 936cdf0e10cSrcweir $$ = SQL_NEW_RULE; 937cdf0e10cSrcweir $$->append($1 = newNode("*", SQL_NODE_PUNCTUATION)); 938cdf0e10cSrcweir } 939cdf0e10cSrcweir | scalar_exp_commalist 940cdf0e10cSrcweir ; 941cdf0e10cSrcweir opt_result_offset_clause: 942cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 943cdf0e10cSrcweir | result_offset_clause 944cdf0e10cSrcweir ; 945cdf0e10cSrcweir result_offset_clause: 946cdf0e10cSrcweir SQL_TOKEN_OFFSET offset_row_count row_or_rows 947cdf0e10cSrcweir { 948cdf0e10cSrcweir $$ = SQL_NEW_RULE; 949cdf0e10cSrcweir $$->append($1); 950cdf0e10cSrcweir $$->append($2); 951cdf0e10cSrcweir $$->append($3); 952cdf0e10cSrcweir } 953cdf0e10cSrcweir ; 954cdf0e10cSrcweir opt_fetch_first_row_count: 955cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 956cdf0e10cSrcweir | fetch_first_row_count 957cdf0e10cSrcweir ; 958cdf0e10cSrcweir first_or_next: 959cdf0e10cSrcweir SQL_TOKEN_FIRST 960cdf0e10cSrcweir | SQL_TOKEN_NEXT 961cdf0e10cSrcweir ; 962cdf0e10cSrcweir row_or_rows: 963cdf0e10cSrcweir SQL_TOKEN_ROW 964cdf0e10cSrcweir | SQL_TOKEN_ROWS 965cdf0e10cSrcweir ; 966cdf0e10cSrcweir opt_fetch_first_clause: 967cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 968cdf0e10cSrcweir | fetch_first_clause 969cdf0e10cSrcweir ; 970cdf0e10cSrcweir fetch_first_clause: 971cdf0e10cSrcweir SQL_TOKEN_FETCH first_or_next opt_fetch_first_row_count row_or_rows SQL_TOKEN_ONLY 972cdf0e10cSrcweir { 973cdf0e10cSrcweir $$ = SQL_NEW_RULE; 974cdf0e10cSrcweir $$->append($1); 975cdf0e10cSrcweir $$->append($2); 976cdf0e10cSrcweir $$->append($3); 977cdf0e10cSrcweir $$->append($4); 978cdf0e10cSrcweir $$->append($5); 979cdf0e10cSrcweir } 980cdf0e10cSrcweir ; 981cdf0e10cSrcweir offset_row_count: 982cdf0e10cSrcweir literal 983cdf0e10cSrcweir ; 984cdf0e10cSrcweir fetch_first_row_count: 985cdf0e10cSrcweir literal 986cdf0e10cSrcweir ; 987cdf0e10cSrcweir 988cdf0e10cSrcweir opt_limit_offset_clause: 989cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 990cdf0e10cSrcweir | limit_offset_clause 991cdf0e10cSrcweir ; 992cdf0e10cSrcweir opt_offset: 993cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 994cdf0e10cSrcweir | SQL_TOKEN_OFFSET SQL_TOKEN_INTNUM 995cdf0e10cSrcweir { 996cdf0e10cSrcweir $$ = SQL_NEW_RULE; 997cdf0e10cSrcweir $$->append($1); 998cdf0e10cSrcweir $$->append($2); 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir ; 1001cdf0e10cSrcweir limit_offset_clause: 1002cdf0e10cSrcweir SQL_TOKEN_LIMIT SQL_TOKEN_INTNUM opt_offset 1003cdf0e10cSrcweir { 1004cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1005cdf0e10cSrcweir $$->append($1); 1006cdf0e10cSrcweir $$->append($2); 1007cdf0e10cSrcweir $$->append($3); 1008cdf0e10cSrcweir } 1009cdf0e10cSrcweir ; 1010cdf0e10cSrcweir table_exp: 1011cdf0e10cSrcweir from_clause opt_where_clause opt_group_by_clause opt_having_clause opt_window_clause opt_order_by_clause opt_limit_offset_clause opt_result_offset_clause opt_fetch_first_clause 1012cdf0e10cSrcweir { 1013cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1014cdf0e10cSrcweir $$->append($1); 1015cdf0e10cSrcweir $$->append($2); 1016cdf0e10cSrcweir $$->append($3); 1017cdf0e10cSrcweir $$->append($4); 1018cdf0e10cSrcweir $$->append($5); 1019cdf0e10cSrcweir $$->append($6); 1020cdf0e10cSrcweir $$->append($7); 1021cdf0e10cSrcweir $$->append($8); 1022cdf0e10cSrcweir $$->append($9); 1023cdf0e10cSrcweir } 1024cdf0e10cSrcweir ; 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir from_clause: 1027cdf0e10cSrcweir SQL_TOKEN_FROM table_ref_commalist 1028cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1029cdf0e10cSrcweir $$->append($1); 1030cdf0e10cSrcweir $$->append($2);} 1031cdf0e10cSrcweir ; 1032cdf0e10cSrcweir 1033cdf0e10cSrcweir table_ref_commalist: 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir table_ref 1036cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 1037cdf0e10cSrcweir $$->append($1);} 1038cdf0e10cSrcweir | table_ref_commalist ',' table_ref 1039cdf0e10cSrcweir {$1->append($3); 1040cdf0e10cSrcweir $$ = $1;} 1041cdf0e10cSrcweir ; 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir opt_as: 1044cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 1045cdf0e10cSrcweir | SQL_TOKEN_AS 1046cdf0e10cSrcweir ; 1047cdf0e10cSrcweir opt_row: 1048cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 1049cdf0e10cSrcweir | SQL_TOKEN_ROW 1050cdf0e10cSrcweir ; 1051cdf0e10cSrcweir table_primary_as_range_column: 1052cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 1053cdf0e10cSrcweir | opt_as SQL_TOKEN_NAME op_column_commalist 1054cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1055cdf0e10cSrcweir $$->append($1); 1056cdf0e10cSrcweir $$->append($2); 1057cdf0e10cSrcweir $$->append($3); 1058cdf0e10cSrcweir } 1059cdf0e10cSrcweir ; 1060cdf0e10cSrcweir table_ref: 1061cdf0e10cSrcweir table_node table_primary_as_range_column 1062cdf0e10cSrcweir { 1063cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1064cdf0e10cSrcweir $$->append($1); 1065cdf0e10cSrcweir $$->append($2); 1066cdf0e10cSrcweir } 1067cdf0e10cSrcweir | subquery range_variable op_column_commalist 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1070cdf0e10cSrcweir $$->append($1); 1071cdf0e10cSrcweir $$->append($2); 1072cdf0e10cSrcweir $$->append($3); 1073cdf0e10cSrcweir } 1074cdf0e10cSrcweir | joined_table 1075cdf0e10cSrcweir | '{' SQL_TOKEN_OJ joined_table '}' 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1078cdf0e10cSrcweir $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); 1079cdf0e10cSrcweir $$->append($2); 1080cdf0e10cSrcweir $$->append($3); 1081cdf0e10cSrcweir $$->append($4 = newNode("}", SQL_NODE_PUNCTUATION)); 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir | '(' joined_table ')' 1084cdf0e10cSrcweir { 1085cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1086cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 1087cdf0e10cSrcweir $$->append($2); 1088cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 1089cdf0e10cSrcweir } 1090cdf0e10cSrcweir ; 1091cdf0e10cSrcweir where_clause: 1092cdf0e10cSrcweir SQL_TOKEN_WHERE search_condition 1093cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1094cdf0e10cSrcweir $$->append($1); 1095cdf0e10cSrcweir $$->append($2);} 1096cdf0e10cSrcweir ; 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir opt_group_by_clause: 1099cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 1100cdf0e10cSrcweir | SQL_TOKEN_GROUP SQL_TOKEN_BY column_ref_commalist 1101cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1102cdf0e10cSrcweir $$->append($1); 1103cdf0e10cSrcweir $$->append($2); 1104cdf0e10cSrcweir $$->append($3);} 1105cdf0e10cSrcweir ; 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir column_ref_commalist: 1108cdf0e10cSrcweir column_ref 1109cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 1110cdf0e10cSrcweir $$->append($1);} 1111cdf0e10cSrcweir | set_fct_spec 1112cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 1113cdf0e10cSrcweir $$->append($1);} 1114cdf0e10cSrcweir | column_ref_commalist ',' column_ref 1115cdf0e10cSrcweir {$1->append($3); 1116cdf0e10cSrcweir $$ = $1;} 1117cdf0e10cSrcweir | column_ref_commalist ',' set_fct_spec 1118cdf0e10cSrcweir {$1->append($3); 1119cdf0e10cSrcweir $$ = $1;} 1120cdf0e10cSrcweir ; 1121cdf0e10cSrcweir 1122cdf0e10cSrcweir opt_having_clause: 1123cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 1124cdf0e10cSrcweir | SQL_TOKEN_HAVING search_condition 1125cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1126cdf0e10cSrcweir $$->append($1); 1127cdf0e10cSrcweir $$->append($2);} 1128cdf0e10cSrcweir ; 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir /* search conditions */ 1131cdf0e10cSrcweir truth_value: 1132cdf0e10cSrcweir SQL_TOKEN_TRUE 1133cdf0e10cSrcweir | SQL_TOKEN_FALSE 1134cdf0e10cSrcweir | SQL_TOKEN_UNKNOWN 1135cdf0e10cSrcweir | SQL_TOKEN_NULL 1136cdf0e10cSrcweir ; 1137cdf0e10cSrcweir boolean_primary: 1138cdf0e10cSrcweir predicate 1139cdf0e10cSrcweir | '(' search_condition ')' 1140cdf0e10cSrcweir { // boolean_primary: rule 2 1141cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1142cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 1143cdf0e10cSrcweir $$->append($2); 1144cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 1145cdf0e10cSrcweir } 1146cdf0e10cSrcweir | row_value_constructor_elem /*[^')' ',']*/ 1147cdf0e10cSrcweir { 1148cdf0e10cSrcweir if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// boolean_primary: rule 3 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1151cdf0e10cSrcweir sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1); 1152cdf0e10cSrcweir if(nErg == 1) 1153cdf0e10cSrcweir { 1154cdf0e10cSrcweir OSQLParseNode* pTemp = $$; 1155cdf0e10cSrcweir $$ = pTemp->removeAt((sal_uInt32)0); 1156cdf0e10cSrcweir delete pTemp; 1157cdf0e10cSrcweir } 1158cdf0e10cSrcweir else 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir delete $$; 1161cdf0e10cSrcweir if(nErg) 1162cdf0e10cSrcweir YYERROR; 1163cdf0e10cSrcweir else 1164cdf0e10cSrcweir YYABORT; 1165cdf0e10cSrcweir } 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir else 1168cdf0e10cSrcweir YYERROR; 1169cdf0e10cSrcweir } 1170cdf0e10cSrcweir ; 1171cdf0e10cSrcweir parenthesized_boolean_value_expression: 1172cdf0e10cSrcweir '(' search_condition ')' 1173cdf0e10cSrcweir { // boolean_primary: rule 2 1174cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1175cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 1176cdf0e10cSrcweir $$->append($2); 1177cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 1178cdf0e10cSrcweir } 1179cdf0e10cSrcweir ; 1180cdf0e10cSrcweir boolean_test: 1181cdf0e10cSrcweir boolean_primary 1182cdf0e10cSrcweir | boolean_primary SQL_TOKEN_IS sql_not truth_value 1183cdf0e10cSrcweir { 1184cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1185cdf0e10cSrcweir $$->append($1); 1186cdf0e10cSrcweir $$->append($2); 1187cdf0e10cSrcweir $$->append($3); 1188cdf0e10cSrcweir $$->append($4); 1189cdf0e10cSrcweir } 1190cdf0e10cSrcweir ; 1191cdf0e10cSrcweir boolean_factor: 1192cdf0e10cSrcweir boolean_test 1193cdf0e10cSrcweir | SQL_TOKEN_NOT boolean_test 1194cdf0e10cSrcweir { // boolean_factor: rule 1 1195cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1196cdf0e10cSrcweir $$->append($1); 1197cdf0e10cSrcweir $$->append($2); 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir ; 1200cdf0e10cSrcweir boolean_term: 1201cdf0e10cSrcweir boolean_factor 1202cdf0e10cSrcweir | boolean_term SQL_TOKEN_AND boolean_factor 1203cdf0e10cSrcweir { 1204cdf0e10cSrcweir $$ = SQL_NEW_RULE; // boolean_term: rule 1 1205cdf0e10cSrcweir $$->append($1); 1206cdf0e10cSrcweir $$->append($2); 1207cdf0e10cSrcweir $$->append($3); 1208cdf0e10cSrcweir } 1209cdf0e10cSrcweir ; 1210cdf0e10cSrcweir search_condition: 1211cdf0e10cSrcweir boolean_term 1212cdf0e10cSrcweir | search_condition SQL_TOKEN_OR boolean_term 1213cdf0e10cSrcweir { 1214cdf0e10cSrcweir $$ = SQL_NEW_RULE; // search_condition 1215cdf0e10cSrcweir $$->append($1); 1216cdf0e10cSrcweir $$->append($2); 1217cdf0e10cSrcweir $$->append($3); 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir ; 1220cdf0e10cSrcweir predicate: 1221cdf0e10cSrcweir comparison_predicate 1222cdf0e10cSrcweir | between_predicate 1223cdf0e10cSrcweir | all_or_any_predicate 1224cdf0e10cSrcweir | existence_test 1225cdf0e10cSrcweir | unique_test 1226cdf0e10cSrcweir | test_for_null 1227cdf0e10cSrcweir | in_predicate 1228cdf0e10cSrcweir | like_predicate 1229cdf0e10cSrcweir ; 1230cdf0e10cSrcweir comparison_predicate_part_2: 1231cdf0e10cSrcweir comparison row_value_constructor 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir $$ = SQL_NEW_RULE; // comparison_predicate: rule 1 1234cdf0e10cSrcweir $$->append($1); 1235cdf0e10cSrcweir $$->append($2); 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir comparison_predicate: 1238cdf0e10cSrcweir row_value_constructor comparison row_value_constructor 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir $$ = SQL_NEW_RULE; // comparison_predicate: rule 1 1241cdf0e10cSrcweir $$->append($1); 1242cdf0e10cSrcweir $$->append($2); 1243cdf0e10cSrcweir $$->append($3); 1244cdf0e10cSrcweir } 1245cdf0e10cSrcweir | comparison row_value_constructor 1246cdf0e10cSrcweir { 1247cdf0e10cSrcweir if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // comparison_predicate: rule 2 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1250cdf0e10cSrcweir sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildPredicateRule($$,$2,$1); 1251cdf0e10cSrcweir if(nErg == 1) 1252cdf0e10cSrcweir { 1253cdf0e10cSrcweir OSQLParseNode* pTemp = $$; 1254cdf0e10cSrcweir $$ = pTemp->removeAt((sal_uInt32)0); 1255cdf0e10cSrcweir delete pTemp; 1256cdf0e10cSrcweir } 1257cdf0e10cSrcweir else 1258cdf0e10cSrcweir { 1259cdf0e10cSrcweir delete $$; 1260cdf0e10cSrcweir YYABORT; 1261cdf0e10cSrcweir } 1262cdf0e10cSrcweir } 1263cdf0e10cSrcweir else 1264cdf0e10cSrcweir { 1265cdf0e10cSrcweir YYERROR; 1266cdf0e10cSrcweir } 1267cdf0e10cSrcweir } 1268cdf0e10cSrcweir ; 1269cdf0e10cSrcweir comparison: 1270cdf0e10cSrcweir SQL_LESS 1271cdf0e10cSrcweir | SQL_NOTEQUAL 1272cdf0e10cSrcweir | SQL_EQUAL 1273cdf0e10cSrcweir | SQL_GREAT 1274cdf0e10cSrcweir | SQL_LESSEQ 1275cdf0e10cSrcweir | SQL_GREATEQ 1276cdf0e10cSrcweir ; 1277cdf0e10cSrcweir between_predicate_part_2: 1278cdf0e10cSrcweir sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor 1279cdf0e10cSrcweir { 1280cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // between_predicate: rule 2 1281cdf0e10cSrcweir { 1282cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1283cdf0e10cSrcweir 1284cdf0e10cSrcweir sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildPredicateRule($$,$3,$2,$5); 1285cdf0e10cSrcweir if(nErg == 1) 1286cdf0e10cSrcweir { 1287cdf0e10cSrcweir OSQLParseNode* pTemp = $$; 1288cdf0e10cSrcweir $$ = pTemp->removeAt((sal_uInt32)0); 1289cdf0e10cSrcweir OSQLParseNode* pColumnRef = $$->removeAt((sal_uInt32)0); 1290cdf0e10cSrcweir $$->insert(0,$1); 1291cdf0e10cSrcweir OSQLParseNode* pBetween_predicate = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::between_predicate)); 1292cdf0e10cSrcweir pBetween_predicate->append(pColumnRef); 1293cdf0e10cSrcweir pBetween_predicate->append($$); 1294cdf0e10cSrcweir $$ = pBetween_predicate; 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir delete pTemp; 1297cdf0e10cSrcweir delete $4; 1298cdf0e10cSrcweir } 1299cdf0e10cSrcweir else 1300cdf0e10cSrcweir { 1301cdf0e10cSrcweir delete $$; 1302cdf0e10cSrcweir YYABORT; 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir } 1305cdf0e10cSrcweir else 1306cdf0e10cSrcweir { 1307cdf0e10cSrcweir $$ = SQL_NEW_RULE; // between_predicate: rule 1 1308cdf0e10cSrcweir $$->append($1); 1309cdf0e10cSrcweir $$->append($2); 1310cdf0e10cSrcweir $$->append($3); 1311cdf0e10cSrcweir $$->append($4); 1312cdf0e10cSrcweir $$->append($5); 1313cdf0e10cSrcweir } 1314cdf0e10cSrcweir } 1315cdf0e10cSrcweir between_predicate: 1316cdf0e10cSrcweir row_value_constructor between_predicate_part_2 1317cdf0e10cSrcweir { 1318cdf0e10cSrcweir $$ = SQL_NEW_RULE; // between_predicate: rule 1 1319cdf0e10cSrcweir $$->append($1); 1320cdf0e10cSrcweir $$->append($2); 1321cdf0e10cSrcweir } 1322cdf0e10cSrcweir | between_predicate_part_2 1323cdf0e10cSrcweir ; 1324cdf0e10cSrcweir character_like_predicate_part_2: 1325cdf0e10cSrcweir sql_not SQL_TOKEN_LIKE string_value_exp opt_escape 1326cdf0e10cSrcweir { 1327cdf0e10cSrcweir $$ = SQL_NEW_RULE; // like_predicate: rule 1 1328cdf0e10cSrcweir $$->append($1); 1329cdf0e10cSrcweir $$->append($2); 1330cdf0e10cSrcweir $$->append($3); 1331cdf0e10cSrcweir $$->append($4); 1332cdf0e10cSrcweir } 1333cdf0e10cSrcweir ; 1334cdf0e10cSrcweir other_like_predicate_part_2: 1335cdf0e10cSrcweir sql_not SQL_TOKEN_LIKE value_exp_primary opt_escape 1336cdf0e10cSrcweir { 1337cdf0e10cSrcweir $$ = SQL_NEW_RULE; // like_predicate: rule 1 1338cdf0e10cSrcweir $$->append($1); 1339cdf0e10cSrcweir $$->append($2); 1340cdf0e10cSrcweir $$->append($3); 1341cdf0e10cSrcweir $$->append($4); 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir ; 1344cdf0e10cSrcweir like_predicate: 1345cdf0e10cSrcweir row_value_constructor character_like_predicate_part_2 1346cdf0e10cSrcweir { 1347cdf0e10cSrcweir $$ = SQL_NEW_RULE; // like_predicate: rule 1 1348cdf0e10cSrcweir $$->append($1); 1349cdf0e10cSrcweir $$->append($2); 1350cdf0e10cSrcweir } 1351cdf0e10cSrcweir | row_value_constructor other_like_predicate_part_2 1352cdf0e10cSrcweir { 1353cdf0e10cSrcweir $$ = SQL_NEW_RULE; // like_predicate: rule 3 1354cdf0e10cSrcweir $$->append($1); 1355cdf0e10cSrcweir $$->append($2); 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir | character_like_predicate_part_2 1358cdf0e10cSrcweir { 1359cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 5 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); 1362cdf0e10cSrcweir pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1365cdf0e10cSrcweir $$->append(pColumnRef); 1366cdf0e10cSrcweir $$->append($1); 1367cdf0e10cSrcweir OSQLParseNode* p2nd = $1->removeAt(2); 1368cdf0e10cSrcweir OSQLParseNode* p3rd = $1->removeAt(2); 1369cdf0e10cSrcweir if ( !xxx_pGLOBAL_SQLPARSER->buildLikeRule($1,p2nd,p3rd) ) 1370cdf0e10cSrcweir { 1371cdf0e10cSrcweir delete $$; 1372cdf0e10cSrcweir YYABORT; 1373cdf0e10cSrcweir } 1374cdf0e10cSrcweir $1->append(p3rd); 1375cdf0e10cSrcweir } 1376cdf0e10cSrcweir else 1377cdf0e10cSrcweir YYERROR; 1378cdf0e10cSrcweir } 1379cdf0e10cSrcweir | other_like_predicate_part_2 1380cdf0e10cSrcweir { 1381cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 6 1382cdf0e10cSrcweir { 1383cdf0e10cSrcweir OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); 1384cdf0e10cSrcweir pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1387cdf0e10cSrcweir $$->append(pColumnRef); 1388cdf0e10cSrcweir $$->append($1); 1389cdf0e10cSrcweir OSQLParseNode* p2nd = $1->removeAt(2); 1390cdf0e10cSrcweir OSQLParseNode* p3rd = $1->removeAt(2); 1391cdf0e10cSrcweir if ( !xxx_pGLOBAL_SQLPARSER->buildLikeRule($1,p2nd,p3rd) ) 1392cdf0e10cSrcweir { 1393cdf0e10cSrcweir delete $$; 1394cdf0e10cSrcweir YYABORT; 1395cdf0e10cSrcweir } 1396cdf0e10cSrcweir $1->append(p3rd); 1397cdf0e10cSrcweir } 1398cdf0e10cSrcweir else 1399cdf0e10cSrcweir YYERROR; 1400cdf0e10cSrcweir } 1401cdf0e10cSrcweir ; 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir opt_escape: 1404cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 1405cdf0e10cSrcweir | SQL_TOKEN_ESCAPE string_value_exp 1406cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1407cdf0e10cSrcweir $$->append($1); 1408cdf0e10cSrcweir $$->append($2);} 1409cdf0e10cSrcweir | '{' SQL_TOKEN_ESCAPE SQL_TOKEN_STRING '}' 1410cdf0e10cSrcweir { 1411cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1412cdf0e10cSrcweir $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); 1413cdf0e10cSrcweir $$->append($2); 1414cdf0e10cSrcweir $$->append($3); 1415cdf0e10cSrcweir $$->append($4 = newNode("}", SQL_NODE_PUNCTUATION)); 1416cdf0e10cSrcweir } 1417cdf0e10cSrcweir ; 1418cdf0e10cSrcweir 1419cdf0e10cSrcweir null_predicate_part_2: 1420cdf0e10cSrcweir SQL_TOKEN_IS sql_not SQL_TOKEN_NULL 1421cdf0e10cSrcweir { 1422cdf0e10cSrcweir $$ = SQL_NEW_RULE; // test_for_null: rule 1 1423cdf0e10cSrcweir $$->append($1); 1424cdf0e10cSrcweir $$->append($2); 1425cdf0e10cSrcweir $$->append($3); 1426cdf0e10cSrcweir } 1427cdf0e10cSrcweir ; 1428cdf0e10cSrcweir test_for_null: 1429cdf0e10cSrcweir row_value_constructor null_predicate_part_2 1430cdf0e10cSrcweir { 1431cdf0e10cSrcweir $$ = SQL_NEW_RULE; // test_for_null: rule 1 1432cdf0e10cSrcweir $$->append($1); 1433cdf0e10cSrcweir $$->append($2); 1434cdf0e10cSrcweir } 1435cdf0e10cSrcweir | null_predicate_part_2 1436cdf0e10cSrcweir { 1437cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// test_for_null: rule 2 1438cdf0e10cSrcweir { 1439cdf0e10cSrcweir OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); 1440cdf0e10cSrcweir pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1443cdf0e10cSrcweir $$->append(pColumnRef); 1444cdf0e10cSrcweir $$->append($1); 1445cdf0e10cSrcweir } 1446cdf0e10cSrcweir else 1447cdf0e10cSrcweir YYERROR; 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir ; 1450cdf0e10cSrcweir in_predicate_value: 1451cdf0e10cSrcweir subquery 1452cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1453cdf0e10cSrcweir $$->append($1); 1454cdf0e10cSrcweir } 1455cdf0e10cSrcweir | '(' value_exp_commalist ')' 1456cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1457cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 1458cdf0e10cSrcweir $$->append($2); 1459cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 1460cdf0e10cSrcweir } 1461cdf0e10cSrcweir ; 1462cdf0e10cSrcweir in_predicate_part_2: 1463cdf0e10cSrcweir sql_not SQL_TOKEN_IN in_predicate_value 1464cdf0e10cSrcweir { 1465cdf0e10cSrcweir $$ = SQL_NEW_RULE;// in_predicate: rule 1 1466cdf0e10cSrcweir $$->append($1); 1467cdf0e10cSrcweir $$->append($2); 1468cdf0e10cSrcweir $$->append($3); 1469cdf0e10cSrcweir } 1470cdf0e10cSrcweir ; 1471cdf0e10cSrcweir in_predicate: 1472cdf0e10cSrcweir row_value_constructor in_predicate_part_2 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir $$ = SQL_NEW_RULE;// in_predicate: rule 1 1475cdf0e10cSrcweir $$->append($1); 1476cdf0e10cSrcweir $$->append($2); 1477cdf0e10cSrcweir } 1478cdf0e10cSrcweir | in_predicate_part_2 1479cdf0e10cSrcweir { 1480cdf0e10cSrcweir if ( xxx_pGLOBAL_SQLPARSER->inPredicateCheck() )// in_predicate: rule 2 1481cdf0e10cSrcweir { 1482cdf0e10cSrcweir OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); 1483cdf0e10cSrcweir pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); 1484cdf0e10cSrcweir 1485cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1486cdf0e10cSrcweir $$->append(pColumnRef); 1487cdf0e10cSrcweir $$->append($1); 1488cdf0e10cSrcweir } 1489cdf0e10cSrcweir else 1490cdf0e10cSrcweir YYERROR; 1491cdf0e10cSrcweir } 1492cdf0e10cSrcweir ; 1493cdf0e10cSrcweir quantified_comparison_predicate_part_2: 1494cdf0e10cSrcweir comparison any_all_some subquery 1495cdf0e10cSrcweir { 1496cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1497cdf0e10cSrcweir $$->append($1); 1498cdf0e10cSrcweir $$->append($2); 1499cdf0e10cSrcweir $$->append($3); 1500cdf0e10cSrcweir } 1501cdf0e10cSrcweir ; 1502cdf0e10cSrcweir all_or_any_predicate: 1503cdf0e10cSrcweir row_value_constructor quantified_comparison_predicate_part_2 1504cdf0e10cSrcweir { 1505cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1506cdf0e10cSrcweir $$->append($1); 1507cdf0e10cSrcweir $$->append($2); 1508cdf0e10cSrcweir } 1509cdf0e10cSrcweir | quantified_comparison_predicate_part_2 1510cdf0e10cSrcweir { 1511cdf0e10cSrcweir if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 1512cdf0e10cSrcweir { 1513cdf0e10cSrcweir OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); 1514cdf0e10cSrcweir pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); 1515cdf0e10cSrcweir 1516cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1517cdf0e10cSrcweir $$->append(pColumnRef); 1518cdf0e10cSrcweir $$->append($1); 1519cdf0e10cSrcweir } 1520cdf0e10cSrcweir else 1521cdf0e10cSrcweir YYERROR; 1522cdf0e10cSrcweir } 1523cdf0e10cSrcweir ; 1524cdf0e10cSrcweir 1525cdf0e10cSrcweir any_all_some: 1526cdf0e10cSrcweir SQL_TOKEN_ANY 1527cdf0e10cSrcweir | SQL_TOKEN_ALL 1528cdf0e10cSrcweir | SQL_TOKEN_SOME 1529cdf0e10cSrcweir ; 1530cdf0e10cSrcweir 1531cdf0e10cSrcweir existence_test: 1532cdf0e10cSrcweir SQL_TOKEN_EXISTS subquery 1533cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1534cdf0e10cSrcweir $$->append($1); 1535cdf0e10cSrcweir $$->append($2);} 1536cdf0e10cSrcweir ; 1537cdf0e10cSrcweir unique_test: 1538cdf0e10cSrcweir SQL_TOKEN_UNIQUE subquery 1539cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1540cdf0e10cSrcweir $$->append($1); 1541cdf0e10cSrcweir $$->append($2);} 1542cdf0e10cSrcweir ; 1543cdf0e10cSrcweir subquery: 1544cdf0e10cSrcweir '(' query_exp ')' 1545cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 1546cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 1547cdf0e10cSrcweir $$->append($2); 1548cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));} 1549cdf0e10cSrcweir ; 1550cdf0e10cSrcweir 1551cdf0e10cSrcweir /* scalar expressions */ 1552cdf0e10cSrcweir scalar_exp_commalist: 1553cdf0e10cSrcweir select_sublist 1554cdf0e10cSrcweir { 1555cdf0e10cSrcweir $$ = SQL_NEW_COMMALISTRULE; 1556cdf0e10cSrcweir $$->append($1); 1557cdf0e10cSrcweir } 1558cdf0e10cSrcweir | scalar_exp_commalist ',' select_sublist 1559cdf0e10cSrcweir { 1560cdf0e10cSrcweir $1->append($3); 1561cdf0e10cSrcweir $$ = $1; 1562cdf0e10cSrcweir } 1563cdf0e10cSrcweir ; 1564cdf0e10cSrcweir select_sublist: 1565cdf0e10cSrcweir /* table_node '.' '*' 1566cdf0e10cSrcweir { 1567cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1568cdf0e10cSrcweir $$->append($1); 1569cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 1570cdf0e10cSrcweir $$->append($3 = newNode("*", SQL_NODE_PUNCTUATION)); 1571cdf0e10cSrcweir } 1572cdf0e10cSrcweir */ 1573cdf0e10cSrcweir derived_column 1574cdf0e10cSrcweir 1575cdf0e10cSrcweir ; 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir parameter_ref: 1578cdf0e10cSrcweir parameter 1579cdf0e10cSrcweir ; 1580cdf0e10cSrcweir 1581cdf0e10cSrcweir /* 1582cdf0e10cSrcweir op_like: 1583cdf0e10cSrcweir '*' 1584cdf0e10cSrcweir { 1585cdf0e10cSrcweir $$ = newNode("*", SQL_NODE_PUNCTUATION); 1586cdf0e10cSrcweir } 1587cdf0e10cSrcweir | '?' 1588cdf0e10cSrcweir { 1589cdf0e10cSrcweir $$ = newNode("?", SQL_NODE_PUNCTUATION); 1590cdf0e10cSrcweir } 1591cdf0e10cSrcweir | op_like '*' 1592cdf0e10cSrcweir { 1593cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1594cdf0e10cSrcweir $$->append($1); 1595cdf0e10cSrcweir $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); 1596cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_False); 1597cdf0e10cSrcweir } 1598cdf0e10cSrcweir | op_like '?' 1599cdf0e10cSrcweir { 1600cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1601cdf0e10cSrcweir $$->append($1); 1602cdf0e10cSrcweir $$->append($2 = newNode("?", SQL_NODE_PUNCTUATION)); 1603cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_False); 1604cdf0e10cSrcweir } 1605cdf0e10cSrcweir ; 1606cdf0e10cSrcweir */ 1607cdf0e10cSrcweir 1608cdf0e10cSrcweir literal: 1609cdf0e10cSrcweir /* SQL_TOKEN_STRING 1610cdf0e10cSrcweir | */SQL_TOKEN_INT 1611cdf0e10cSrcweir | SQL_TOKEN_REAL_NUM 1612cdf0e10cSrcweir | SQL_TOKEN_INTNUM 1613cdf0e10cSrcweir | SQL_TOKEN_APPROXNUM 1614cdf0e10cSrcweir | SQL_TOKEN_ACCESS_DATE 1615cdf0e10cSrcweir /* rules for predicate check */ 1616cdf0e10cSrcweir | literal SQL_TOKEN_STRING 1617cdf0e10cSrcweir { 1618cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 1619cdf0e10cSrcweir { 1620cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1621cdf0e10cSrcweir $$->append($1); 1622cdf0e10cSrcweir $$->append($2); 1623cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir else 1626cdf0e10cSrcweir YYERROR; 1627cdf0e10cSrcweir } 1628cdf0e10cSrcweir | literal SQL_TOKEN_INT 1629cdf0e10cSrcweir { 1630cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 1631cdf0e10cSrcweir { 1632cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1633cdf0e10cSrcweir $$->append($1); 1634cdf0e10cSrcweir $$->append($2); 1635cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); 1636cdf0e10cSrcweir } 1637cdf0e10cSrcweir else 1638cdf0e10cSrcweir YYERROR; 1639cdf0e10cSrcweir } 1640cdf0e10cSrcweir | literal SQL_TOKEN_REAL_NUM 1641cdf0e10cSrcweir { 1642cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 1643cdf0e10cSrcweir { 1644cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1645cdf0e10cSrcweir $$->append($1); 1646cdf0e10cSrcweir $$->append($2); 1647cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); 1648cdf0e10cSrcweir } 1649cdf0e10cSrcweir else 1650cdf0e10cSrcweir YYERROR; 1651cdf0e10cSrcweir } 1652cdf0e10cSrcweir | literal SQL_TOKEN_APPROXNUM 1653cdf0e10cSrcweir { 1654cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 1655cdf0e10cSrcweir { 1656cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1657cdf0e10cSrcweir $$->append($1); 1658cdf0e10cSrcweir $$->append($2); 1659cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); 1660cdf0e10cSrcweir } 1661cdf0e10cSrcweir else 1662cdf0e10cSrcweir YYERROR; 1663cdf0e10cSrcweir } 1664cdf0e10cSrcweir ; 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir /* miscellaneous */ 1667cdf0e10cSrcweir as_clause: 1668cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 1669cdf0e10cSrcweir | SQL_TOKEN_AS column 1670cdf0e10cSrcweir { 1671cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1672cdf0e10cSrcweir $$->append($1); 1673cdf0e10cSrcweir $$->append($2); 1674cdf0e10cSrcweir } 1675cdf0e10cSrcweir | column 1676cdf0e10cSrcweir ; 1677cdf0e10cSrcweir position_exp: 1678cdf0e10cSrcweir SQL_TOKEN_POSITION '(' value_exp SQL_TOKEN_IN value_exp ')' 1679cdf0e10cSrcweir { 1680cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1681cdf0e10cSrcweir $$->append($1); 1682cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1683cdf0e10cSrcweir $$->append($3); 1684cdf0e10cSrcweir $$->append($4); 1685cdf0e10cSrcweir $$->append($5); 1686cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 1687cdf0e10cSrcweir } 1688cdf0e10cSrcweir | SQL_TOKEN_POSITION '(' value_exp_commalist ')' 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1691cdf0e10cSrcweir $$->append($1); 1692cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1693cdf0e10cSrcweir $$->append($3); 1694cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1695cdf0e10cSrcweir } 1696cdf0e10cSrcweir ; 1697cdf0e10cSrcweir num_value_fct: 1698cdf0e10cSrcweir position_exp 1699cdf0e10cSrcweir | extract_exp 1700cdf0e10cSrcweir | length_exp 1701cdf0e10cSrcweir ; 1702cdf0e10cSrcweir char_length_exp: 1703cdf0e10cSrcweir SQL_TOKEN_CHAR_LENGTH '(' value_exp ')' 1704cdf0e10cSrcweir { 1705cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1706cdf0e10cSrcweir $$->append($1); 1707cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1708cdf0e10cSrcweir $$->append($3); 1709cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1710cdf0e10cSrcweir } 1711cdf0e10cSrcweir | SQL_TOKEN_SQL_TOKEN_INTNUM '(' value_exp ')' 1712cdf0e10cSrcweir { 1713cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1714cdf0e10cSrcweir $$->append($1); 1715cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1716cdf0e10cSrcweir $$->append($3); 1717cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1718cdf0e10cSrcweir } 1719cdf0e10cSrcweir 1720cdf0e10cSrcweir ; 1721cdf0e10cSrcweir octet_length_exp: 1722cdf0e10cSrcweir SQL_TOKEN_OCTET_LENGTH '(' value_exp ')' 1723cdf0e10cSrcweir { 1724cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1725cdf0e10cSrcweir $$->append($1); 1726cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1727cdf0e10cSrcweir $$->append($3); 1728cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1729cdf0e10cSrcweir } 1730cdf0e10cSrcweir ; 1731cdf0e10cSrcweir bit_length_exp: 1732cdf0e10cSrcweir SQL_TOKEN_BIT_LENGTH '(' value_exp ')' 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1735cdf0e10cSrcweir $$->append($1); 1736cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1737cdf0e10cSrcweir $$->append($3); 1738cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1739cdf0e10cSrcweir } 1740cdf0e10cSrcweir ; 1741cdf0e10cSrcweir length_exp: 1742cdf0e10cSrcweir char_length_exp 1743cdf0e10cSrcweir { 1744cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1745cdf0e10cSrcweir $$->append($1); 1746cdf0e10cSrcweir } 1747cdf0e10cSrcweir | octet_length_exp 1748cdf0e10cSrcweir { 1749cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1750cdf0e10cSrcweir $$->append($1); 1751cdf0e10cSrcweir } 1752cdf0e10cSrcweir | bit_length_exp 1753cdf0e10cSrcweir { 1754cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1755cdf0e10cSrcweir $$->append($1); 1756cdf0e10cSrcweir } 1757cdf0e10cSrcweir ; 1758cdf0e10cSrcweir datetime_field: 1759cdf0e10cSrcweir non_second_datetime_field 1760cdf0e10cSrcweir { 1761cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1762cdf0e10cSrcweir $$->append($1); 1763cdf0e10cSrcweir } 1764cdf0e10cSrcweir | SQL_TOKEN_SECOND 1765cdf0e10cSrcweir { 1766cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1767cdf0e10cSrcweir $$->append($1); 1768cdf0e10cSrcweir } 1769cdf0e10cSrcweir ; 1770cdf0e10cSrcweir extract_field: 1771cdf0e10cSrcweir time_zone_field 1772cdf0e10cSrcweir | datetime_field 1773cdf0e10cSrcweir | value_exp 1774cdf0e10cSrcweir ; 1775cdf0e10cSrcweir time_zone_field: 1776cdf0e10cSrcweir SQL_TOKEN_TIMEZONE_HOUR 1777cdf0e10cSrcweir { 1778cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1779cdf0e10cSrcweir $$->append($1); 1780cdf0e10cSrcweir } 1781cdf0e10cSrcweir | SQL_TOKEN_TIMEZONE_MINUTE 1782cdf0e10cSrcweir { 1783cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1784cdf0e10cSrcweir $$->append($1); 1785cdf0e10cSrcweir } 1786cdf0e10cSrcweir ; 1787cdf0e10cSrcweir extract_source: 1788cdf0e10cSrcweir datetime_value_exp 1789cdf0e10cSrcweir { 1790cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1791cdf0e10cSrcweir $$->append($1); 1792cdf0e10cSrcweir } 1793cdf0e10cSrcweir /* | interval_value_exp 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1796cdf0e10cSrcweir $$->append($1); 1797cdf0e10cSrcweir } */ 1798cdf0e10cSrcweir ; 1799cdf0e10cSrcweir extract_exp: 1800cdf0e10cSrcweir SQL_TOKEN_EXTRACT '(' extract_field SQL_TOKEN_FROM value_exp ')' 1801cdf0e10cSrcweir { 1802cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1803cdf0e10cSrcweir $$->append($1); 1804cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1805cdf0e10cSrcweir $$->append($3); 1806cdf0e10cSrcweir $$->append($4); 1807cdf0e10cSrcweir $$->append($5); 1808cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 1809cdf0e10cSrcweir } 1810cdf0e10cSrcweir ; 1811cdf0e10cSrcweir unsigned_value_spec: 1812cdf0e10cSrcweir general_value_spec 1813cdf0e10cSrcweir | literal 1814cdf0e10cSrcweir ; 1815cdf0e10cSrcweir general_value_spec: 1816cdf0e10cSrcweir parameter 1817cdf0e10cSrcweir | SQL_TOKEN_USER 1818cdf0e10cSrcweir /* | SQL_TOKEN_NULL*/ 1819cdf0e10cSrcweir | SQL_TOKEN_FALSE 1820cdf0e10cSrcweir | SQL_TOKEN_TRUE 1821cdf0e10cSrcweir | SQL_TOKEN_VALUE 1822cdf0e10cSrcweir | SQL_TOKEN_CURRENT_CATALOG 1823cdf0e10cSrcweir | SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP 1824cdf0e10cSrcweir | SQL_TOKEN_CURRENT_PATH 1825cdf0e10cSrcweir | SQL_TOKEN_CURRENT_ROLE 1826cdf0e10cSrcweir | SQL_TOKEN_CURRENT_SCHEMA 1827cdf0e10cSrcweir | SQL_TOKEN_CURRENT_USER 1828cdf0e10cSrcweir | SQL_TOKEN_SESSION_USER 1829cdf0e10cSrcweir | SQL_TOKEN_SYSTEM_USER 1830cdf0e10cSrcweir ; 1831cdf0e10cSrcweir set_fct_spec: 1832cdf0e10cSrcweir general_set_fct 1833cdf0e10cSrcweir | '{' odbc_fct_spec '}' 1834cdf0e10cSrcweir { 1835cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1836cdf0e10cSrcweir $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); 1837cdf0e10cSrcweir $$->append($2); 1838cdf0e10cSrcweir $$->append($3 = newNode("}", SQL_NODE_PUNCTUATION)); 1839cdf0e10cSrcweir } 1840cdf0e10cSrcweir | function_name '(' ')' 1841cdf0e10cSrcweir { 1842cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1843cdf0e10cSrcweir $$->append($1); 1844cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1845cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 1846cdf0e10cSrcweir } 1847cdf0e10cSrcweir | function_name0 '(' ')' 1848cdf0e10cSrcweir { 1849cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1850cdf0e10cSrcweir $$->append($1); 1851cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1852cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 1853cdf0e10cSrcweir } 1854cdf0e10cSrcweir | function_name1 '(' function_arg ')' 1855cdf0e10cSrcweir { 1856cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1857cdf0e10cSrcweir $$->append($1); 1858cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1859cdf0e10cSrcweir $$->append($3); 1860cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1861cdf0e10cSrcweir } 1862cdf0e10cSrcweir | function_name2 '(' function_arg_commalist2 ')' 1863cdf0e10cSrcweir { 1864cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1865cdf0e10cSrcweir $$->append($1); 1866cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1867cdf0e10cSrcweir $$->append($3); 1868cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1869cdf0e10cSrcweir } 1870cdf0e10cSrcweir | function_name3 '(' function_arg_commalist3 ')' 1871cdf0e10cSrcweir { 1872cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1873cdf0e10cSrcweir $$->append($1); 1874cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1875cdf0e10cSrcweir $$->append($3); 1876cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1877cdf0e10cSrcweir } 1878cdf0e10cSrcweir | string_function_4Argument '(' function_arg_commalist4 ')' 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1881cdf0e10cSrcweir $$->append($1); 1882cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1883cdf0e10cSrcweir $$->append($3); 1884cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1885cdf0e10cSrcweir } 1886cdf0e10cSrcweir | function_name '(' function_args_commalist ')' 1887cdf0e10cSrcweir { 1888cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1889cdf0e10cSrcweir $$->append($1); 1890cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1891cdf0e10cSrcweir $$->append($3); 1892cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1893cdf0e10cSrcweir } 1894cdf0e10cSrcweir | function_name12 '(' function_args_commalist ')' 1895cdf0e10cSrcweir { 1896cdf0e10cSrcweir if ( $3->count() == 1 || $3->count() == 2 ) 1897cdf0e10cSrcweir { 1898cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1899cdf0e10cSrcweir $$->append($1); 1900cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1901cdf0e10cSrcweir $$->append($3); 1902cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1903cdf0e10cSrcweir } 1904cdf0e10cSrcweir else 1905cdf0e10cSrcweir YYERROR; 1906cdf0e10cSrcweir } 1907cdf0e10cSrcweir | function_name23 '(' function_args_commalist ')' 1908cdf0e10cSrcweir { 1909cdf0e10cSrcweir if ( $3->count() == 2 || $3->count() == 3) 1910cdf0e10cSrcweir { 1911cdf0e10cSrcweir $$ = SQL_NEW_RULE; 1912cdf0e10cSrcweir $$->append($1); 1913cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 1914cdf0e10cSrcweir $$->append($3); 1915cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 1916cdf0e10cSrcweir } 1917cdf0e10cSrcweir else 1918cdf0e10cSrcweir YYERROR; 1919cdf0e10cSrcweir } 1920cdf0e10cSrcweir ; 1921cdf0e10cSrcweir function_name0: 1922cdf0e10cSrcweir date_function_0Argument 1923cdf0e10cSrcweir | numeric_function_0Argument 1924cdf0e10cSrcweir ; 1925cdf0e10cSrcweir function_name1: 1926cdf0e10cSrcweir string_function_1Argument 1927cdf0e10cSrcweir | date_function_1Argument 1928cdf0e10cSrcweir | numeric_function_1Argument 1929cdf0e10cSrcweir ; 1930cdf0e10cSrcweir function_name2: 1931cdf0e10cSrcweir string_function_2Argument 1932cdf0e10cSrcweir | numeric_function_2Argument 1933cdf0e10cSrcweir ; 1934cdf0e10cSrcweir function_name12: 1935cdf0e10cSrcweir SQL_TOKEN_ROUND 1936cdf0e10cSrcweir | SQL_TOKEN_WEEK 1937cdf0e10cSrcweir | SQL_TOKEN_LOGF 1938cdf0e10cSrcweir | SQL_TOKEN_LOG 1939cdf0e10cSrcweir ; 1940cdf0e10cSrcweir function_name23: 1941cdf0e10cSrcweir SQL_TOKEN_LOCATE 1942cdf0e10cSrcweir | SQL_TOKEN_DATEDIFF 1943cdf0e10cSrcweir ; 1944cdf0e10cSrcweir function_name3: 1945cdf0e10cSrcweir string_function_3Argument 1946cdf0e10cSrcweir ; 1947cdf0e10cSrcweir function_name: 1948cdf0e10cSrcweir string_function 1949cdf0e10cSrcweir | date_function 1950cdf0e10cSrcweir | numeric_function 1951cdf0e10cSrcweir | SQL_TOKEN_NAME 1952cdf0e10cSrcweir ; 1953cdf0e10cSrcweir string_function_1Argument: 1954cdf0e10cSrcweir SQL_TOKEN_LENGTH 1955cdf0e10cSrcweir | SQL_TOKEN_ASCII 1956cdf0e10cSrcweir | SQL_TOKEN_LCASE 1957cdf0e10cSrcweir | SQL_TOKEN_LTRIM 1958cdf0e10cSrcweir | SQL_TOKEN_RTRIM 1959cdf0e10cSrcweir | SQL_TOKEN_SPACE 1960cdf0e10cSrcweir | SQL_TOKEN_UCASE 1961cdf0e10cSrcweir ; 1962cdf0e10cSrcweir 1963cdf0e10cSrcweir string_function_2Argument: 1964cdf0e10cSrcweir SQL_TOKEN_REPEAT 1965cdf0e10cSrcweir | SQL_TOKEN_LEFT 1966cdf0e10cSrcweir | SQL_TOKEN_RIGHT 1967cdf0e10cSrcweir ; 1968cdf0e10cSrcweir string_function_3Argument: 1969cdf0e10cSrcweir SQL_TOKEN_REPLACE 1970cdf0e10cSrcweir ; 1971cdf0e10cSrcweir string_function_4Argument: 1972cdf0e10cSrcweir SQL_TOKEN_INSERT 1973cdf0e10cSrcweir ; 1974cdf0e10cSrcweir 1975cdf0e10cSrcweir string_function: 1976cdf0e10cSrcweir SQL_TOKEN_CHAR 1977cdf0e10cSrcweir | SQL_TOKEN_CONCAT 1978cdf0e10cSrcweir | SQL_TOKEN_DIFFERENCE 1979cdf0e10cSrcweir | SQL_TOKEN_LOCATE_2 1980cdf0e10cSrcweir | SQL_TOKEN_SOUNDEX 1981cdf0e10cSrcweir ; 1982cdf0e10cSrcweir date_function_0Argument: 1983cdf0e10cSrcweir SQL_TOKEN_CURDATE 1984cdf0e10cSrcweir | SQL_TOKEN_CURTIME 1985cdf0e10cSrcweir | SQL_TOKEN_NOW 1986cdf0e10cSrcweir ; 1987cdf0e10cSrcweir date_function_1Argument: 1988cdf0e10cSrcweir SQL_TOKEN_DAYOFWEEK 1989cdf0e10cSrcweir | SQL_TOKEN_DAYOFMONTH 1990cdf0e10cSrcweir | SQL_TOKEN_DAYOFYEAR 1991cdf0e10cSrcweir | SQL_TOKEN_MONTH 1992cdf0e10cSrcweir | SQL_TOKEN_DAYNAME 1993cdf0e10cSrcweir | SQL_TOKEN_MONTHNAME 1994cdf0e10cSrcweir | SQL_TOKEN_QUARTER 1995cdf0e10cSrcweir | SQL_TOKEN_HOUR 1996cdf0e10cSrcweir | SQL_TOKEN_MINUTE 1997cdf0e10cSrcweir | SQL_TOKEN_SECOND 1998cdf0e10cSrcweir | SQL_TOKEN_YEAR 1999cdf0e10cSrcweir | SQL_TOKEN_DAY 2000cdf0e10cSrcweir | SQL_TOKEN_TIMEVALUE 2001cdf0e10cSrcweir | SQL_TOKEN_DATEVALUE 2002cdf0e10cSrcweir ; 2003cdf0e10cSrcweir 2004cdf0e10cSrcweir date_function: 2005cdf0e10cSrcweir SQL_TOKEN_TIMESTAMPADD 2006cdf0e10cSrcweir | SQL_TOKEN_TIMESTAMPDIFF 2007cdf0e10cSrcweir ; 2008cdf0e10cSrcweir numeric_function_0Argument: 2009cdf0e10cSrcweir SQL_TOKEN_PI 2010cdf0e10cSrcweir ; 2011cdf0e10cSrcweir numeric_function_1Argument: 2012cdf0e10cSrcweir SQL_TOKEN_ABS 2013cdf0e10cSrcweir | SQL_TOKEN_ACOS 2014cdf0e10cSrcweir | SQL_TOKEN_ASIN 2015cdf0e10cSrcweir | SQL_TOKEN_ATAN 2016cdf0e10cSrcweir | SQL_TOKEN_CEILING 2017cdf0e10cSrcweir | SQL_TOKEN_COS 2018cdf0e10cSrcweir | SQL_TOKEN_COT 2019cdf0e10cSrcweir | SQL_TOKEN_DEGREES 2020cdf0e10cSrcweir | SQL_TOKEN_FLOOR 2021cdf0e10cSrcweir | SQL_TOKEN_SIGN 2022cdf0e10cSrcweir | SQL_TOKEN_SIN 2023cdf0e10cSrcweir | SQL_TOKEN_SQRT 2024cdf0e10cSrcweir | SQL_TOKEN_TAN 2025cdf0e10cSrcweir | SQL_TOKEN_EXP 2026cdf0e10cSrcweir | SQL_TOKEN_LOG10 2027cdf0e10cSrcweir | SQL_TOKEN_LN 2028cdf0e10cSrcweir | SQL_TOKEN_RADIANS 2029cdf0e10cSrcweir | SQL_TOKEN_ROUNDMAGIC 2030cdf0e10cSrcweir ; 2031cdf0e10cSrcweir numeric_function_2Argument: 2032cdf0e10cSrcweir SQL_TOKEN_ATAN2 2033cdf0e10cSrcweir | SQL_TOKEN_MOD 2034cdf0e10cSrcweir | SQL_TOKEN_POWER 2035cdf0e10cSrcweir ; 2036cdf0e10cSrcweir numeric_function: 2037cdf0e10cSrcweir SQL_TOKEN_RAND 2038cdf0e10cSrcweir | SQL_TOKEN_TRUNCATE 2039cdf0e10cSrcweir ; 2040cdf0e10cSrcweir 2041cdf0e10cSrcweir window_function: 2042cdf0e10cSrcweir window_function_type SQL_TOKEN_OVER window_name_or_specification 2043cdf0e10cSrcweir { 2044cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2045cdf0e10cSrcweir $$->append($1); 2046cdf0e10cSrcweir $$->append($2); 2047cdf0e10cSrcweir $$->append($3); 2048cdf0e10cSrcweir } 2049cdf0e10cSrcweir ; 2050cdf0e10cSrcweir window_function_type : 2051cdf0e10cSrcweir rank_function_type '(' ')' 2052cdf0e10cSrcweir { 2053cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2054cdf0e10cSrcweir $$->append($1); 2055cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2056cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 2057cdf0e10cSrcweir } 2058cdf0e10cSrcweir | SQL_TOKEN_ROW_NUMBER '(' ')' 2059cdf0e10cSrcweir { 2060cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2061cdf0e10cSrcweir $$->append($1); 2062cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2063cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 2064cdf0e10cSrcweir } 2065cdf0e10cSrcweir | general_set_fct 2066cdf0e10cSrcweir | ntile_function 2067cdf0e10cSrcweir | lead_or_lag_function 2068cdf0e10cSrcweir | first_or_last_value_function 2069cdf0e10cSrcweir | nth_value_function 2070cdf0e10cSrcweir ; 2071cdf0e10cSrcweir ntile_function : 2072cdf0e10cSrcweir SQL_TOKEN_NTILE '(' number_of_tiles ')' 2073cdf0e10cSrcweir { 2074cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2075cdf0e10cSrcweir $$->append($1); 2076cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2077cdf0e10cSrcweir $$->append($3); 2078cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 2079cdf0e10cSrcweir } 2080cdf0e10cSrcweir ; 2081cdf0e10cSrcweir dynamic_parameter_specification: 2082cdf0e10cSrcweir parameter 2083cdf0e10cSrcweir ; 2084cdf0e10cSrcweir simple_value_specification: 2085cdf0e10cSrcweir literal 2086cdf0e10cSrcweir ; 2087cdf0e10cSrcweir number_of_tiles : 2088cdf0e10cSrcweir simple_value_specification 2089cdf0e10cSrcweir | dynamic_parameter_specification 2090cdf0e10cSrcweir ; 2091cdf0e10cSrcweir opt_lead_or_lag_function: 2092cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2093cdf0e10cSrcweir | ',' offset 2094cdf0e10cSrcweir { 2095cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2096cdf0e10cSrcweir $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION)); 2097cdf0e10cSrcweir $$->append($2); 2098cdf0e10cSrcweir } 2099cdf0e10cSrcweir | ',' offset ',' default_expression 2100cdf0e10cSrcweir { 2101cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2102cdf0e10cSrcweir $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION)); 2103cdf0e10cSrcweir $$->append($2); 2104cdf0e10cSrcweir $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION)); 2105cdf0e10cSrcweir $$->append($4); 2106cdf0e10cSrcweir } 2107cdf0e10cSrcweir ; 2108cdf0e10cSrcweir opt_null_treatment: 2109cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2110cdf0e10cSrcweir | null_treatment 2111cdf0e10cSrcweir ; 2112cdf0e10cSrcweir 2113cdf0e10cSrcweir lead_or_lag_function: 2114cdf0e10cSrcweir lead_or_lag '(' lead_or_lag_extent opt_lead_or_lag_function ')' opt_null_treatment 2115cdf0e10cSrcweir { 2116cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2117cdf0e10cSrcweir $$->append($1); 2118cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2119cdf0e10cSrcweir $$->append($3); 2120cdf0e10cSrcweir $$->append($4); 2121cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 2122cdf0e10cSrcweir $$->append($6); 2123cdf0e10cSrcweir } 2124cdf0e10cSrcweir ; 2125cdf0e10cSrcweir lead_or_lag: 2126cdf0e10cSrcweir SQL_TOKEN_LEAD 2127cdf0e10cSrcweir | SQL_TOKEN_LAG 2128cdf0e10cSrcweir ; 2129cdf0e10cSrcweir lead_or_lag_extent: 2130cdf0e10cSrcweir value_exp 2131cdf0e10cSrcweir ; 2132cdf0e10cSrcweir offset: 2133cdf0e10cSrcweir SQL_TOKEN_INTNUM 2134cdf0e10cSrcweir ; 2135cdf0e10cSrcweir default_expression: 2136cdf0e10cSrcweir value_exp 2137cdf0e10cSrcweir ; 2138cdf0e10cSrcweir null_treatment: 2139cdf0e10cSrcweir SQL_TOKEN_RESPECT SQL_TOKEN_NULLS 2140cdf0e10cSrcweir | SQL_TOKEN_IGNORE SQL_TOKEN_NULLS 2141cdf0e10cSrcweir ; 2142cdf0e10cSrcweir first_or_last_value_function: 2143cdf0e10cSrcweir first_or_last_value '(' value_exp ')' opt_null_treatment 2144cdf0e10cSrcweir { 2145cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2146cdf0e10cSrcweir $$->append($1); 2147cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2148cdf0e10cSrcweir $$->append($3); 2149cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 2150cdf0e10cSrcweir $$->append($5); 2151cdf0e10cSrcweir } 2152cdf0e10cSrcweir ; 2153cdf0e10cSrcweir first_or_last_value : 2154cdf0e10cSrcweir SQL_TOKEN_FIRST_VALUE 2155cdf0e10cSrcweir | SQL_TOKEN_LAST_VALUE 2156cdf0e10cSrcweir ; 2157cdf0e10cSrcweir opt_from_first_or_last: 2158cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2159cdf0e10cSrcweir | from_first_or_last 2160cdf0e10cSrcweir ; 2161cdf0e10cSrcweir nth_value_function: 2162cdf0e10cSrcweir SQL_TOKEN_NTH_VALUE '(' value_exp ',' nth_row ')' opt_from_first_or_last opt_null_treatment 2163cdf0e10cSrcweir { 2164cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2165cdf0e10cSrcweir $$->append($1); 2166cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2167cdf0e10cSrcweir $$->append($3); 2168cdf0e10cSrcweir $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); 2169cdf0e10cSrcweir $$->append($5); 2170cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 2171cdf0e10cSrcweir $$->append($7); 2172cdf0e10cSrcweir $$->append($8); 2173cdf0e10cSrcweir } 2174cdf0e10cSrcweir ; 2175cdf0e10cSrcweir nth_row: 2176cdf0e10cSrcweir simple_value_specification 2177cdf0e10cSrcweir | dynamic_parameter_specification 2178cdf0e10cSrcweir ; 2179cdf0e10cSrcweir from_first_or_last: 2180cdf0e10cSrcweir SQL_TOKEN_FROM SQL_TOKEN_FIRST 2181cdf0e10cSrcweir { 2182cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2183cdf0e10cSrcweir $$->append($1); 2184cdf0e10cSrcweir $$->append($2); 2185cdf0e10cSrcweir } 2186cdf0e10cSrcweir | SQL_TOKEN_FROM SQL_TOKEN_LAST 2187cdf0e10cSrcweir { 2188cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2189cdf0e10cSrcweir $$->append($1); 2190cdf0e10cSrcweir $$->append($2); 2191cdf0e10cSrcweir } 2192cdf0e10cSrcweir ; 2193cdf0e10cSrcweir window_name: 2194cdf0e10cSrcweir SQL_TOKEN_NAME 2195cdf0e10cSrcweir ; 2196cdf0e10cSrcweir window_name_or_specification: 2197cdf0e10cSrcweir window_name 2198cdf0e10cSrcweir | in_line_window_specification 2199cdf0e10cSrcweir ; 2200cdf0e10cSrcweir in_line_window_specification: 2201cdf0e10cSrcweir window_specification 2202cdf0e10cSrcweir ; 2203cdf0e10cSrcweir opt_window_clause: 2204cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2205cdf0e10cSrcweir | window_clause 2206cdf0e10cSrcweir ; 2207cdf0e10cSrcweir window_clause: 2208cdf0e10cSrcweir SQL_TOKEN_WINDOW window_definition_list 2209cdf0e10cSrcweir { 2210cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2211cdf0e10cSrcweir $$->append($1); 2212cdf0e10cSrcweir $$->append($2); 2213cdf0e10cSrcweir } 2214cdf0e10cSrcweir ; 2215cdf0e10cSrcweir window_definition_list: 2216cdf0e10cSrcweir window_definition_list ',' window_definition 2217cdf0e10cSrcweir {$1->append($3); 2218cdf0e10cSrcweir $$ = $1;} 2219cdf0e10cSrcweir | window_definition 2220cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 2221cdf0e10cSrcweir $$->append($1);} 2222cdf0e10cSrcweir ; 2223cdf0e10cSrcweir window_definition: 2224cdf0e10cSrcweir new_window_name SQL_TOKEN_AS window_specification 2225cdf0e10cSrcweir { 2226cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2227cdf0e10cSrcweir $$->append($1); 2228cdf0e10cSrcweir $$->append($2); 2229cdf0e10cSrcweir $$->append($3); 2230cdf0e10cSrcweir } 2231cdf0e10cSrcweir ; 2232cdf0e10cSrcweir new_window_name: 2233cdf0e10cSrcweir window_name 2234cdf0e10cSrcweir ; 2235cdf0e10cSrcweir window_specification: 2236cdf0e10cSrcweir '(' window_specification_details ')' 2237cdf0e10cSrcweir { 2238cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2239cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 2240cdf0e10cSrcweir $$->append($2); 2241cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 2242cdf0e10cSrcweir } 2243cdf0e10cSrcweir ; 2244cdf0e10cSrcweir opt_existing_window_name: 2245cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2246cdf0e10cSrcweir | existing_window_name 2247cdf0e10cSrcweir ; 2248cdf0e10cSrcweir opt_window_partition_clause: 2249cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2250cdf0e10cSrcweir | window_partition_clause 2251cdf0e10cSrcweir ; 2252cdf0e10cSrcweir opt_window_frame_clause: 2253cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2254cdf0e10cSrcweir | window_frame_clause 2255cdf0e10cSrcweir ; 2256cdf0e10cSrcweir window_specification_details: 2257cdf0e10cSrcweir opt_existing_window_name 2258cdf0e10cSrcweir opt_window_partition_clause 2259cdf0e10cSrcweir opt_order_by_clause 2260cdf0e10cSrcweir opt_window_frame_clause 2261cdf0e10cSrcweir ; 2262cdf0e10cSrcweir existing_window_name: 2263cdf0e10cSrcweir window_name 2264cdf0e10cSrcweir ; 2265cdf0e10cSrcweir window_partition_clause: 2266cdf0e10cSrcweir SQL_TOKEN_PARTITION SQL_TOKEN_BY window_partition_column_reference_list 2267cdf0e10cSrcweir { 2268cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2269cdf0e10cSrcweir $$->append($1); 2270cdf0e10cSrcweir $$->append($2); 2271cdf0e10cSrcweir $$->append($3); 2272cdf0e10cSrcweir } 2273cdf0e10cSrcweir ; 2274cdf0e10cSrcweir window_partition_column_reference_list: 2275cdf0e10cSrcweir window_partition_column_reference_list ',' window_partition_column_reference 2276cdf0e10cSrcweir {$1->append($3); 2277cdf0e10cSrcweir $$ = $1;} 2278cdf0e10cSrcweir | window_partition_column_reference 2279cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 2280cdf0e10cSrcweir $$->append($1);} 2281cdf0e10cSrcweir ; 2282cdf0e10cSrcweir window_partition_column_reference: 2283cdf0e10cSrcweir column_ref opt_collate_clause 2284cdf0e10cSrcweir { 2285cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2286cdf0e10cSrcweir $$->append($1); 2287cdf0e10cSrcweir $$->append($2); 2288cdf0e10cSrcweir } 2289cdf0e10cSrcweir ; 2290cdf0e10cSrcweir opt_window_frame_exclusion: 2291cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2292cdf0e10cSrcweir | window_frame_exclusion 2293cdf0e10cSrcweir ; 2294cdf0e10cSrcweir window_frame_clause: 2295cdf0e10cSrcweir window_frame_units window_frame_extent opt_window_frame_exclusion 2296cdf0e10cSrcweir { 2297cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2298cdf0e10cSrcweir $$->append($1); 2299cdf0e10cSrcweir $$->append($2); 2300cdf0e10cSrcweir $$->append($3); 2301cdf0e10cSrcweir } 2302cdf0e10cSrcweir ; 2303cdf0e10cSrcweir window_frame_units: 2304cdf0e10cSrcweir SQL_TOKEN_ROWS 2305cdf0e10cSrcweir | SQL_TOKEN_RANGE 2306cdf0e10cSrcweir ; 2307cdf0e10cSrcweir window_frame_extent: 2308cdf0e10cSrcweir window_frame_start 2309cdf0e10cSrcweir | window_frame_between 2310cdf0e10cSrcweir ; 2311cdf0e10cSrcweir window_frame_start: 2312cdf0e10cSrcweir SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING 2313cdf0e10cSrcweir { 2314cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2315cdf0e10cSrcweir $$->append($1); 2316cdf0e10cSrcweir $$->append($2); 2317cdf0e10cSrcweir } 2318cdf0e10cSrcweir | window_frame_preceding 2319cdf0e10cSrcweir | SQL_TOKEN_CURRENT SQL_TOKEN_ROW 2320cdf0e10cSrcweir { 2321cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2322cdf0e10cSrcweir $$->append($1); 2323cdf0e10cSrcweir $$->append($2); 2324cdf0e10cSrcweir } 2325cdf0e10cSrcweir ; 2326cdf0e10cSrcweir window_frame_preceding: 2327cdf0e10cSrcweir unsigned_value_spec SQL_TOKEN_PRECEDING 2328cdf0e10cSrcweir { 2329cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2330cdf0e10cSrcweir $$->append($1); 2331cdf0e10cSrcweir $$->append($2); 2332cdf0e10cSrcweir } 2333cdf0e10cSrcweir ; 2334cdf0e10cSrcweir window_frame_between: 2335cdf0e10cSrcweir SQL_TOKEN_BETWEEN window_frame_bound_1 SQL_TOKEN_AND window_frame_bound_2 2336cdf0e10cSrcweir { 2337cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2338cdf0e10cSrcweir $$->append($1); 2339cdf0e10cSrcweir $$->append($2); 2340cdf0e10cSrcweir $$->append($3); 2341cdf0e10cSrcweir $$->append($4); 2342cdf0e10cSrcweir } 2343cdf0e10cSrcweir ; 2344cdf0e10cSrcweir window_frame_bound_1: 2345cdf0e10cSrcweir window_frame_bound 2346cdf0e10cSrcweir ; 2347cdf0e10cSrcweir window_frame_bound_2: 2348cdf0e10cSrcweir window_frame_bound 2349cdf0e10cSrcweir ; 2350cdf0e10cSrcweir window_frame_bound: 2351cdf0e10cSrcweir window_frame_start 2352cdf0e10cSrcweir | SQL_TOKEN_UNBOUNDED SQL_TOKEN_FOLLOWING 2353cdf0e10cSrcweir { 2354cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2355cdf0e10cSrcweir $$->append($1); 2356cdf0e10cSrcweir $$->append($2); 2357cdf0e10cSrcweir } 2358cdf0e10cSrcweir | window_frame_following 2359cdf0e10cSrcweir ; 2360cdf0e10cSrcweir window_frame_following: 2361cdf0e10cSrcweir unsigned_value_spec SQL_TOKEN_FOLLOWING 2362cdf0e10cSrcweir { 2363cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2364cdf0e10cSrcweir $$->append($1); 2365cdf0e10cSrcweir $$->append($2); 2366cdf0e10cSrcweir } 2367cdf0e10cSrcweir ; 2368cdf0e10cSrcweir window_frame_exclusion: 2369cdf0e10cSrcweir SQL_TOKEN_EXCLUDE SQL_TOKEN_CURRENT SQL_TOKEN_ROW 2370cdf0e10cSrcweir { 2371cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2372cdf0e10cSrcweir $$->append($1); 2373cdf0e10cSrcweir $$->append($2); 2374cdf0e10cSrcweir $$->append($3); 2375cdf0e10cSrcweir } 2376cdf0e10cSrcweir | SQL_TOKEN_EXCLUDE SQL_TOKEN_GROUP 2377cdf0e10cSrcweir { 2378cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2379cdf0e10cSrcweir $$->append($1); 2380cdf0e10cSrcweir $$->append($2); 2381cdf0e10cSrcweir } 2382cdf0e10cSrcweir | SQL_TOKEN_EXCLUDE SQL_TOKEN_TIES 2383cdf0e10cSrcweir { 2384cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2385cdf0e10cSrcweir $$->append($1); 2386cdf0e10cSrcweir $$->append($2); 2387cdf0e10cSrcweir } 2388cdf0e10cSrcweir | SQL_TOKEN_EXCLUDE SQL_TOKEN_NO SQL_TOKEN_OTHERS 2389cdf0e10cSrcweir { 2390cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2391cdf0e10cSrcweir $$->append($1); 2392cdf0e10cSrcweir $$->append($2); 2393cdf0e10cSrcweir $$->append($3); 2394cdf0e10cSrcweir } 2395cdf0e10cSrcweir ; 2396cdf0e10cSrcweir op_parameter: 2397cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 2398cdf0e10cSrcweir | '?' SQL_EQUAL 2399cdf0e10cSrcweir { 2400cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2401cdf0e10cSrcweir $$->append($1 = newNode("?", SQL_NODE_PUNCTUATION)); 2402cdf0e10cSrcweir $$->append($2); 2403cdf0e10cSrcweir } 2404cdf0e10cSrcweir ; 2405cdf0e10cSrcweir odbc_call_spec: 2406cdf0e10cSrcweir op_parameter SQL_TOKEN_CALL table_node op_odbc_call_parameter 2407cdf0e10cSrcweir { 2408cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2409cdf0e10cSrcweir $$->append($1); 2410cdf0e10cSrcweir $$->append($2); 2411cdf0e10cSrcweir $$->append($3); 2412cdf0e10cSrcweir $$->append($4); 2413cdf0e10cSrcweir } 2414cdf0e10cSrcweir ; 2415cdf0e10cSrcweir 2416cdf0e10cSrcweir op_odbc_call_parameter: 2417cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 2418cdf0e10cSrcweir | '(' odbc_parameter_commalist ')' 2419cdf0e10cSrcweir { 2420cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2421cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 2422cdf0e10cSrcweir $$->append($2); 2423cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir ; 2426cdf0e10cSrcweir 2427cdf0e10cSrcweir odbc_parameter_commalist: 2428cdf0e10cSrcweir odbc_parameter 2429cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 2430cdf0e10cSrcweir $$->append($1);} 2431cdf0e10cSrcweir | odbc_parameter_commalist ',' odbc_parameter 2432cdf0e10cSrcweir { 2433cdf0e10cSrcweir $1->append($3); 2434cdf0e10cSrcweir $$ = $1; 2435cdf0e10cSrcweir } 2436cdf0e10cSrcweir ; 2437cdf0e10cSrcweir odbc_parameter: 2438cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2439cdf0e10cSrcweir | literal 2440cdf0e10cSrcweir | parameter 2441cdf0e10cSrcweir ; 2442cdf0e10cSrcweir 2443cdf0e10cSrcweir odbc_fct_spec: 2444cdf0e10cSrcweir odbc_fct_type SQL_TOKEN_STRING 2445cdf0e10cSrcweir { 2446cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2447cdf0e10cSrcweir $$->append($1); 2448cdf0e10cSrcweir $$->append($2); 2449cdf0e10cSrcweir } 2450cdf0e10cSrcweir | SQL_TOKEN_FN set_fct_spec 2451cdf0e10cSrcweir { 2452cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2453cdf0e10cSrcweir $$->append($1); 2454cdf0e10cSrcweir $$->append($2); 2455cdf0e10cSrcweir } 2456cdf0e10cSrcweir ; 2457cdf0e10cSrcweir 2458cdf0e10cSrcweir odbc_fct_type: 2459cdf0e10cSrcweir SQL_TOKEN_D 2460cdf0e10cSrcweir | SQL_TOKEN_T 2461cdf0e10cSrcweir | SQL_TOKEN_TS 2462cdf0e10cSrcweir ; 2463cdf0e10cSrcweir 2464cdf0e10cSrcweir general_set_fct: 2465cdf0e10cSrcweir set_fct_type '(' opt_all_distinct function_arg ')' 2466cdf0e10cSrcweir { 2467cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2468cdf0e10cSrcweir $$->append($1); 2469cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2470cdf0e10cSrcweir $$->append($3); 2471cdf0e10cSrcweir $$->append($4); 2472cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 2473cdf0e10cSrcweir } 2474cdf0e10cSrcweir | SQL_TOKEN_COUNT '(' '*' ')' 2475cdf0e10cSrcweir { 2476cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2477cdf0e10cSrcweir $$->append($1); 2478cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2479cdf0e10cSrcweir $$->append($3 = newNode("*", SQL_NODE_PUNCTUATION)); 2480cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 2481cdf0e10cSrcweir } 2482cdf0e10cSrcweir | SQL_TOKEN_COUNT '(' opt_all_distinct function_arg ')' 2483cdf0e10cSrcweir { 2484cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2485cdf0e10cSrcweir $$->append($1); 2486cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2487cdf0e10cSrcweir $$->append($3); 2488cdf0e10cSrcweir $$->append($4); 2489cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 2490cdf0e10cSrcweir } 2491cdf0e10cSrcweir | ordered_set_function 2492cdf0e10cSrcweir | array_aggregate_function 2493cdf0e10cSrcweir ; 2494cdf0e10cSrcweir set_fct_type: 2495cdf0e10cSrcweir SQL_TOKEN_AVG 2496cdf0e10cSrcweir | SQL_TOKEN_MAX 2497cdf0e10cSrcweir | SQL_TOKEN_MIN 2498cdf0e10cSrcweir | SQL_TOKEN_SUM 2499cdf0e10cSrcweir | SQL_TOKEN_EVERY 2500cdf0e10cSrcweir | SQL_TOKEN_ANY 2501cdf0e10cSrcweir | SQL_TOKEN_SOME 2502cdf0e10cSrcweir | SQL_TOKEN_STDDEV_POP 2503cdf0e10cSrcweir | SQL_TOKEN_STDDEV_SAMP 2504cdf0e10cSrcweir | SQL_TOKEN_VAR_SAMP 2505cdf0e10cSrcweir | SQL_TOKEN_VAR_POP 2506cdf0e10cSrcweir | SQL_TOKEN_COLLECT 2507cdf0e10cSrcweir | SQL_TOKEN_FUSION 2508cdf0e10cSrcweir | SQL_TOKEN_INTERSECTION 2509cdf0e10cSrcweir ; 2510cdf0e10cSrcweir 2511cdf0e10cSrcweir ordered_set_function: 2512cdf0e10cSrcweir hypothetical_set_function 2513cdf0e10cSrcweir | inverse_distribution_function 2514cdf0e10cSrcweir ; 2515cdf0e10cSrcweir hypothetical_set_function: 2516cdf0e10cSrcweir rank_function_type '(' hypothetical_set_function_value_expression_list ')' within_group_specification 2517cdf0e10cSrcweir { 2518cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2519cdf0e10cSrcweir $$->append($1); 2520cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2521cdf0e10cSrcweir $$->append($3); 2522cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 2523cdf0e10cSrcweir $$->append($5); 2524cdf0e10cSrcweir } 2525cdf0e10cSrcweir | rank_function_type '(' hypothetical_set_function_value_expression_list SQL_TOKEN_BY value_exp_commalist ')' within_group_specification 2526cdf0e10cSrcweir { 2527cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2528cdf0e10cSrcweir $$->append($1); 2529cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2530cdf0e10cSrcweir $$->append($3); 2531cdf0e10cSrcweir $$->append($4); 2532cdf0e10cSrcweir $$->append($5); 2533cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 2534cdf0e10cSrcweir $$->append($7); 2535cdf0e10cSrcweir } 2536cdf0e10cSrcweir ; 2537cdf0e10cSrcweir 2538cdf0e10cSrcweir within_group_specification: 2539cdf0e10cSrcweir { 2540cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2541cdf0e10cSrcweir } 2542cdf0e10cSrcweir | SQL_TOKEN_WITHIN SQL_TOKEN_GROUP '(' opt_order_by_clause ')' 2543cdf0e10cSrcweir { 2544cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2545cdf0e10cSrcweir $$->append($1); 2546cdf0e10cSrcweir $$->append($2); 2547cdf0e10cSrcweir $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); 2548cdf0e10cSrcweir $$->append($4); 2549cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 2550cdf0e10cSrcweir } 2551cdf0e10cSrcweir ; 2552cdf0e10cSrcweir hypothetical_set_function_value_expression_list: 2553cdf0e10cSrcweir value_exp_commalist 2554cdf0e10cSrcweir ; 2555cdf0e10cSrcweir 2556cdf0e10cSrcweir inverse_distribution_function: 2557cdf0e10cSrcweir inverse_distribution_function_type '('inverse_distribution_function_argument ')' within_group_specification 2558cdf0e10cSrcweir { 2559cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2560cdf0e10cSrcweir $$->append($1); 2561cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2562cdf0e10cSrcweir $$->append($3); 2563cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 2564cdf0e10cSrcweir } 2565cdf0e10cSrcweir ; 2566cdf0e10cSrcweir inverse_distribution_function_argument: 2567cdf0e10cSrcweir num_value_exp 2568cdf0e10cSrcweir ; 2569cdf0e10cSrcweir inverse_distribution_function_type: 2570cdf0e10cSrcweir SQL_TOKEN_PERCENTILE_CONT 2571cdf0e10cSrcweir | SQL_TOKEN_PERCENTILE_DISC 2572cdf0e10cSrcweir ; 2573cdf0e10cSrcweir 2574cdf0e10cSrcweir array_aggregate_function: 2575cdf0e10cSrcweir SQL_TOKEN_ARRAY_AGG '(' value_exp opt_order_by_clause ')' 2576cdf0e10cSrcweir { 2577cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2578cdf0e10cSrcweir $$->append($1); 2579cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2580cdf0e10cSrcweir $$->append($3); 2581cdf0e10cSrcweir $$->append($4); 2582cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 2583cdf0e10cSrcweir } 2584cdf0e10cSrcweir ; 2585cdf0e10cSrcweir 2586cdf0e10cSrcweir rank_function_type: 2587cdf0e10cSrcweir SQL_TOKEN_RANK 2588cdf0e10cSrcweir | SQL_TOKEN_DENSE_RANK 2589cdf0e10cSrcweir | SQL_TOKEN_PERCENT_RANK 2590cdf0e10cSrcweir | SQL_TOKEN_CUME_DIST 2591cdf0e10cSrcweir ; 2592cdf0e10cSrcweir outer_join_type: 2593cdf0e10cSrcweir SQL_TOKEN_LEFT %prec SQL_TOKEN_LEFT 2594cdf0e10cSrcweir { 2595cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2596cdf0e10cSrcweir $$->append($1); 2597cdf0e10cSrcweir } 2598cdf0e10cSrcweir | SQL_TOKEN_RIGHT %prec SQL_TOKEN_RIGHT 2599cdf0e10cSrcweir { 2600cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2601cdf0e10cSrcweir $$->append($1); 2602cdf0e10cSrcweir } 2603cdf0e10cSrcweir | SQL_TOKEN_FULL %prec SQL_TOKEN_FULL 2604cdf0e10cSrcweir { 2605cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2606cdf0e10cSrcweir $$->append($1); 2607cdf0e10cSrcweir } 2608cdf0e10cSrcweir ; 2609cdf0e10cSrcweir join_condition: 2610cdf0e10cSrcweir SQL_TOKEN_ON search_condition 2611cdf0e10cSrcweir { 2612cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2613cdf0e10cSrcweir $$->append($1); 2614cdf0e10cSrcweir $$->append($2); 2615cdf0e10cSrcweir } 2616cdf0e10cSrcweir ; 2617cdf0e10cSrcweir join_spec: 2618cdf0e10cSrcweir join_condition 2619cdf0e10cSrcweir | named_columns_join 2620cdf0e10cSrcweir ; 2621cdf0e10cSrcweir join_type: 2622cdf0e10cSrcweir /* empty */ {$$ = SQL_NEW_RULE;} 2623cdf0e10cSrcweir | SQL_TOKEN_INNER 2624cdf0e10cSrcweir { 2625cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2626cdf0e10cSrcweir $$->append($1); 2627cdf0e10cSrcweir } 2628cdf0e10cSrcweir | outer_join_type 2629cdf0e10cSrcweir | outer_join_type SQL_TOKEN_OUTER 2630cdf0e10cSrcweir { 2631cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2632cdf0e10cSrcweir $$->append($1); 2633cdf0e10cSrcweir $$->append($2); 2634cdf0e10cSrcweir } 2635cdf0e10cSrcweir ; 2636cdf0e10cSrcweir cross_union: 2637cdf0e10cSrcweir table_ref SQL_TOKEN_CROSS SQL_TOKEN_JOIN table_ref 2638cdf0e10cSrcweir { 2639cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2640cdf0e10cSrcweir $$->append($1); 2641cdf0e10cSrcweir $$->append($2); 2642cdf0e10cSrcweir $$->append($3); 2643cdf0e10cSrcweir $$->append($4); 2644cdf0e10cSrcweir } 2645cdf0e10cSrcweir ; 2646cdf0e10cSrcweir 2647cdf0e10cSrcweir qualified_join: 2648cdf0e10cSrcweir /* wenn SQL_TOKEN_NATURAL, dann keine join_spec */ 2649cdf0e10cSrcweir table_ref SQL_TOKEN_NATURAL join_type SQL_TOKEN_JOIN table_ref 2650cdf0e10cSrcweir { 2651cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2652cdf0e10cSrcweir $$->append($1); 2653cdf0e10cSrcweir $$->append($2); 2654cdf0e10cSrcweir $$->append($3); 2655cdf0e10cSrcweir $$->append($4); 2656cdf0e10cSrcweir $$->append($5); 2657cdf0e10cSrcweir } 2658cdf0e10cSrcweir | table_ref join_type SQL_TOKEN_JOIN table_ref join_spec 2659cdf0e10cSrcweir { 2660cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2661cdf0e10cSrcweir $$->append($1); 2662cdf0e10cSrcweir $$->append($2); 2663cdf0e10cSrcweir $$->append($3); 2664cdf0e10cSrcweir $$->append($4); 2665cdf0e10cSrcweir $$->append($5); 2666cdf0e10cSrcweir } 2667cdf0e10cSrcweir | cross_union 2668cdf0e10cSrcweir ; 2669cdf0e10cSrcweir joined_table: 2670cdf0e10cSrcweir qualified_join 2671cdf0e10cSrcweir ; 2672cdf0e10cSrcweir named_columns_join: 2673cdf0e10cSrcweir SQL_TOKEN_USING '(' column_commalist ')' 2674cdf0e10cSrcweir { 2675cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2676cdf0e10cSrcweir $$->append($1); 2677cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2678cdf0e10cSrcweir $$->append($3); 2679cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 2680cdf0e10cSrcweir } 2681cdf0e10cSrcweir ; 2682cdf0e10cSrcweir simple_table: 2683cdf0e10cSrcweir select_statement 2684cdf0e10cSrcweir | values_or_query_spec 2685cdf0e10cSrcweir ; 2686cdf0e10cSrcweir 2687cdf0e10cSrcweir non_join_query_primary: 2688cdf0e10cSrcweir simple_table 2689cdf0e10cSrcweir | '(' non_join_query_exp ')' 2690cdf0e10cSrcweir { 2691cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2692cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 2693cdf0e10cSrcweir $$->append($2); 2694cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 2695cdf0e10cSrcweir } 2696cdf0e10cSrcweir ; 2697cdf0e10cSrcweir non_join_query_term: 2698cdf0e10cSrcweir non_join_query_primary 2699cdf0e10cSrcweir | query_term SQL_TOKEN_INTERSECT all query_primary 2700cdf0e10cSrcweir { 2701cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2702cdf0e10cSrcweir $$->append($1); 2703cdf0e10cSrcweir $$->append($2); 2704cdf0e10cSrcweir $$->append($3); 2705cdf0e10cSrcweir $$->append($4); 2706cdf0e10cSrcweir } 2707cdf0e10cSrcweir ; 2708cdf0e10cSrcweir query_primary: 2709cdf0e10cSrcweir non_join_query_primary 2710cdf0e10cSrcweir ; 2711cdf0e10cSrcweir non_join_query_exp: 2712cdf0e10cSrcweir non_join_query_term 2713cdf0e10cSrcweir | query_exp SQL_TOKEN_UNION all query_term 2714cdf0e10cSrcweir { 2715cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2716cdf0e10cSrcweir $$->append($1); 2717cdf0e10cSrcweir $$->append($2); 2718cdf0e10cSrcweir $$->append($3); 2719cdf0e10cSrcweir $$->append($4); 2720cdf0e10cSrcweir } 2721cdf0e10cSrcweir | query_exp SQL_TOKEN_EXCEPT all query_term 2722cdf0e10cSrcweir { 2723cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2724cdf0e10cSrcweir $$->append($1); 2725cdf0e10cSrcweir $$->append($2); 2726cdf0e10cSrcweir $$->append($3); 2727cdf0e10cSrcweir $$->append($4); 2728cdf0e10cSrcweir } 2729cdf0e10cSrcweir ; 2730cdf0e10cSrcweir all: 2731cdf0e10cSrcweir /* empty*/ {$$ = SQL_NEW_RULE;} 2732cdf0e10cSrcweir | SQL_TOKEN_ALL 2733cdf0e10cSrcweir ; 2734cdf0e10cSrcweir query_exp: 2735cdf0e10cSrcweir non_join_query_exp /*[^')']*/ 2736cdf0e10cSrcweir ; 2737cdf0e10cSrcweir scalar_subquery: 2738cdf0e10cSrcweir subquery 2739cdf0e10cSrcweir ; 2740cdf0e10cSrcweir cast_operand: 2741cdf0e10cSrcweir value_exp 2742cdf0e10cSrcweir ; 2743cdf0e10cSrcweir cast_target: 2744cdf0e10cSrcweir table_node 2745cdf0e10cSrcweir | data_type 2746cdf0e10cSrcweir ; 2747cdf0e10cSrcweir cast_spec: 2748cdf0e10cSrcweir SQL_TOKEN_CAST '(' cast_operand SQL_TOKEN_AS cast_target ')' 2749cdf0e10cSrcweir { 2750cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2751cdf0e10cSrcweir $$->append($1); 2752cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 2753cdf0e10cSrcweir $$->append($3); 2754cdf0e10cSrcweir $$->append($4); 2755cdf0e10cSrcweir $$->append($5); 2756cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 2757cdf0e10cSrcweir } 2758cdf0e10cSrcweir ; 2759cdf0e10cSrcweir value_exp_primary: 2760cdf0e10cSrcweir unsigned_value_spec 2761cdf0e10cSrcweir | column_ref 2762cdf0e10cSrcweir | set_fct_spec 2763cdf0e10cSrcweir | scalar_subquery 2764cdf0e10cSrcweir | case_expression 2765cdf0e10cSrcweir | window_function 2766cdf0e10cSrcweir | '(' value_exp ')' 2767cdf0e10cSrcweir { 2768cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2769cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 2770cdf0e10cSrcweir $$->append($2); 2771cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 2772cdf0e10cSrcweir } 2773cdf0e10cSrcweir | cast_spec 2774cdf0e10cSrcweir ; 2775cdf0e10cSrcweir 2776cdf0e10cSrcweir num_primary: 2777cdf0e10cSrcweir value_exp_primary 2778cdf0e10cSrcweir | num_value_fct 2779cdf0e10cSrcweir ; 2780cdf0e10cSrcweir factor: 2781cdf0e10cSrcweir num_primary 2782cdf0e10cSrcweir | '-' num_primary %prec SQL_TOKEN_UMINUS 2783cdf0e10cSrcweir { 2784cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2785cdf0e10cSrcweir $$->append($1 = newNode("-", SQL_NODE_PUNCTUATION)); 2786cdf0e10cSrcweir $$->append($2); 2787cdf0e10cSrcweir } 2788cdf0e10cSrcweir | '+' num_primary %prec SQL_TOKEN_UMINUS 2789cdf0e10cSrcweir { 2790cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2791cdf0e10cSrcweir $$->append($1 = newNode("+", SQL_NODE_PUNCTUATION)); 2792cdf0e10cSrcweir $$->append($2); 2793cdf0e10cSrcweir } 2794cdf0e10cSrcweir ; 2795cdf0e10cSrcweir 2796cdf0e10cSrcweir term: 2797cdf0e10cSrcweir factor 2798cdf0e10cSrcweir | term '*' factor 2799cdf0e10cSrcweir { 2800cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2801cdf0e10cSrcweir $$->append($1); 2802cdf0e10cSrcweir $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); 2803cdf0e10cSrcweir $$->append($3); 2804cdf0e10cSrcweir } 2805cdf0e10cSrcweir | term '/' factor 2806cdf0e10cSrcweir { 2807cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2808cdf0e10cSrcweir $$->append($1); 2809cdf0e10cSrcweir $$->append($2 = newNode("/", SQL_NODE_PUNCTUATION)); 2810cdf0e10cSrcweir $$->append($3); 2811cdf0e10cSrcweir } 2812cdf0e10cSrcweir ; 2813cdf0e10cSrcweir 2814cdf0e10cSrcweir num_value_exp: 2815cdf0e10cSrcweir term 2816cdf0e10cSrcweir | num_value_exp '+' term 2817cdf0e10cSrcweir { 2818cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2819cdf0e10cSrcweir $$->append($1); 2820cdf0e10cSrcweir $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); 2821cdf0e10cSrcweir $$->append($3); 2822cdf0e10cSrcweir } 2823cdf0e10cSrcweir | num_value_exp '-' term 2824cdf0e10cSrcweir { 2825cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2826cdf0e10cSrcweir $$->append($1); 2827cdf0e10cSrcweir $$->append($2 = newNode("-", SQL_NODE_PUNCTUATION)); 2828cdf0e10cSrcweir $$->append($3); 2829cdf0e10cSrcweir } 2830cdf0e10cSrcweir ; 2831cdf0e10cSrcweir datetime_primary: 2832cdf0e10cSrcweir /* value_exp_primary 2833cdf0e10cSrcweir { 2834cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2835cdf0e10cSrcweir $$->append($1); 2836cdf0e10cSrcweir } 2837cdf0e10cSrcweir |*/ datetime_value_fct 2838cdf0e10cSrcweir { 2839cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2840cdf0e10cSrcweir $$->append($1); 2841cdf0e10cSrcweir } 2842cdf0e10cSrcweir ; 2843cdf0e10cSrcweir datetime_value_fct: 2844cdf0e10cSrcweir SQL_TOKEN_CURRENT_DATE 2845cdf0e10cSrcweir { 2846cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2847cdf0e10cSrcweir $$->append($1); 2848cdf0e10cSrcweir } 2849cdf0e10cSrcweir | SQL_TOKEN_CURRENT_TIME 2850cdf0e10cSrcweir { 2851cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2852cdf0e10cSrcweir $$->append($1); 2853cdf0e10cSrcweir } 2854cdf0e10cSrcweir | SQL_TOKEN_CURRENT_TIMESTAMP 2855cdf0e10cSrcweir { 2856cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2857cdf0e10cSrcweir $$->append($1); 2858cdf0e10cSrcweir } 2859cdf0e10cSrcweir ; 2860cdf0e10cSrcweir time_zone: 2861cdf0e10cSrcweir SQL_TOKEN_AT time_zone_specifier 2862cdf0e10cSrcweir { 2863cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2864cdf0e10cSrcweir $$->append($1); 2865cdf0e10cSrcweir $$->append($2); 2866cdf0e10cSrcweir } 2867cdf0e10cSrcweir ; 2868cdf0e10cSrcweir time_zone_specifier: 2869cdf0e10cSrcweir SQL_TOKEN_LOCAL 2870cdf0e10cSrcweir { 2871cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2872cdf0e10cSrcweir $$->append($1); 2873cdf0e10cSrcweir } 2874cdf0e10cSrcweir /* | SQL_TOKEN_TIME SQL_TOKEN_ZONE interval_value_exp 2875cdf0e10cSrcweir { 2876cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2877cdf0e10cSrcweir $$->append($1); 2878cdf0e10cSrcweir $$->append($2); 2879cdf0e10cSrcweir $$->append($3); 2880cdf0e10cSrcweir }*/ 2881cdf0e10cSrcweir ; 2882cdf0e10cSrcweir datetime_factor: 2883cdf0e10cSrcweir datetime_primary 2884cdf0e10cSrcweir { 2885cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2886cdf0e10cSrcweir $$->append($1); 2887cdf0e10cSrcweir } 2888cdf0e10cSrcweir | datetime_primary time_zone 2889cdf0e10cSrcweir { 2890cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2891cdf0e10cSrcweir $$->append($1); 2892cdf0e10cSrcweir $$->append($2); 2893cdf0e10cSrcweir } 2894cdf0e10cSrcweir ; 2895cdf0e10cSrcweir datetime_term: 2896cdf0e10cSrcweir datetime_factor 2897cdf0e10cSrcweir { 2898cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2899cdf0e10cSrcweir $$->append($1); 2900cdf0e10cSrcweir } 2901cdf0e10cSrcweir ; 2902cdf0e10cSrcweir /* 2903cdf0e10cSrcweir interval_term: 2904cdf0e10cSrcweir literal 2905cdf0e10cSrcweir | interval_term '*' factor 2906cdf0e10cSrcweir { 2907cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2908cdf0e10cSrcweir $$->append($1); 2909cdf0e10cSrcweir $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); 2910cdf0e10cSrcweir $$->append($3); 2911cdf0e10cSrcweir } 2912cdf0e10cSrcweir | interval_term '/' factor 2913cdf0e10cSrcweir { 2914cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2915cdf0e10cSrcweir $$->append($1); 2916cdf0e10cSrcweir $$->append($2 = newNode("/", SQL_NODE_PUNCTUATION)); 2917cdf0e10cSrcweir $$->append($3); 2918cdf0e10cSrcweir } 2919cdf0e10cSrcweir ; 2920cdf0e10cSrcweir */ 2921cdf0e10cSrcweir datetime_value_exp: 2922cdf0e10cSrcweir datetime_term 2923cdf0e10cSrcweir { 2924cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2925cdf0e10cSrcweir $$->append($1); 2926cdf0e10cSrcweir } 2927cdf0e10cSrcweir /* | interval_value_exp '+' datetime_term 2928cdf0e10cSrcweir { 2929cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2930cdf0e10cSrcweir $$->append($1); 2931cdf0e10cSrcweir $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); 2932cdf0e10cSrcweir $$->append($3); 2933cdf0e10cSrcweir } 2934cdf0e10cSrcweir | datetime_value_exp '+' interval_term 2935cdf0e10cSrcweir { 2936cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2937cdf0e10cSrcweir $$->append($1); 2938cdf0e10cSrcweir $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); 2939cdf0e10cSrcweir $$->append($3); 2940cdf0e10cSrcweir } 2941cdf0e10cSrcweir | datetime_value_exp '-' interval_term 2942cdf0e10cSrcweir { 2943cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2944cdf0e10cSrcweir $$->append($1); 2945cdf0e10cSrcweir $$->append($2 = newNode("-", SQL_NODE_PUNCTUATION)); 2946cdf0e10cSrcweir $$->append($3); 2947cdf0e10cSrcweir } 2948cdf0e10cSrcweir */ ; 2949cdf0e10cSrcweir /* 2950cdf0e10cSrcweir interval_value_exp: 2951cdf0e10cSrcweir interval_term 2952cdf0e10cSrcweir { 2953cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2954cdf0e10cSrcweir $$->append($1); 2955cdf0e10cSrcweir } 2956cdf0e10cSrcweir | interval_value_exp '+' interval_term 2957cdf0e10cSrcweir { 2958cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2959cdf0e10cSrcweir $$->append($1); 2960cdf0e10cSrcweir $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); 2961cdf0e10cSrcweir $$->append($3); 2962cdf0e10cSrcweir } 2963cdf0e10cSrcweir | interval_value_exp '-' interval_term 2964cdf0e10cSrcweir { 2965cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2966cdf0e10cSrcweir $$->append($1); 2967cdf0e10cSrcweir $$->append($2 = newNode("-", SQL_NODE_PUNCTUATION)); 2968cdf0e10cSrcweir $$->append($3); 2969cdf0e10cSrcweir } 2970cdf0e10cSrcweir | '(' datetime_value_exp '-' datetime_term ')' interval_qualifier 2971cdf0e10cSrcweir { 2972cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2973cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 2974cdf0e10cSrcweir $$->append($2); 2975cdf0e10cSrcweir $$->append($3 = newNode("-", SQL_NODE_PUNCTUATION)); 2976cdf0e10cSrcweir $$->append($4); 2977cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 2978cdf0e10cSrcweir $$->append($6); 2979cdf0e10cSrcweir } 2980cdf0e10cSrcweir ; 2981cdf0e10cSrcweir */ 2982cdf0e10cSrcweir non_second_datetime_field: 2983cdf0e10cSrcweir SQL_TOKEN_YEAR 2984cdf0e10cSrcweir | SQL_TOKEN_MONTH 2985cdf0e10cSrcweir | SQL_TOKEN_DAY 2986cdf0e10cSrcweir | SQL_TOKEN_HOUR 2987cdf0e10cSrcweir | SQL_TOKEN_MINUTE 2988cdf0e10cSrcweir ; 2989cdf0e10cSrcweir start_field: 2990cdf0e10cSrcweir non_second_datetime_field opt_paren_precision 2991cdf0e10cSrcweir { 2992cdf0e10cSrcweir $$ = SQL_NEW_RULE; 2993cdf0e10cSrcweir $$->append($1); 2994cdf0e10cSrcweir $$->append($2); 2995cdf0e10cSrcweir } 2996cdf0e10cSrcweir ; 2997cdf0e10cSrcweir end_field: 2998cdf0e10cSrcweir non_second_datetime_field 2999cdf0e10cSrcweir | SQL_TOKEN_SECOND opt_paren_precision 3000cdf0e10cSrcweir { 3001cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3002cdf0e10cSrcweir $$->append($1); 3003cdf0e10cSrcweir $$->append($2); 3004cdf0e10cSrcweir } 3005cdf0e10cSrcweir ; 3006cdf0e10cSrcweir 3007cdf0e10cSrcweir single_datetime_field: 3008cdf0e10cSrcweir non_second_datetime_field opt_paren_precision 3009cdf0e10cSrcweir { 3010cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3011cdf0e10cSrcweir $$->append($1); 3012cdf0e10cSrcweir $$->append($2); 3013cdf0e10cSrcweir } 3014cdf0e10cSrcweir | SQL_TOKEN_SECOND opt_paren_precision_scale 3015cdf0e10cSrcweir { 3016cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3017cdf0e10cSrcweir $$->append($1); 3018cdf0e10cSrcweir $$->append($2); 3019cdf0e10cSrcweir } 3020cdf0e10cSrcweir ; 3021cdf0e10cSrcweir 3022cdf0e10cSrcweir interval_qualifier: 3023cdf0e10cSrcweir start_field SQL_TOKEN_TO end_field 3024cdf0e10cSrcweir { 3025cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3026cdf0e10cSrcweir $$->append($1); 3027cdf0e10cSrcweir $$->append($2); 3028cdf0e10cSrcweir $$->append($3); 3029cdf0e10cSrcweir } 3030cdf0e10cSrcweir | single_datetime_field 3031cdf0e10cSrcweir ; 3032cdf0e10cSrcweir 3033cdf0e10cSrcweir function_arg_commalist2: 3034cdf0e10cSrcweir function_arg ',' function_arg 3035cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 3036cdf0e10cSrcweir $$->append($1); 3037cdf0e10cSrcweir $$->append($3);} 3038cdf0e10cSrcweir ; 3039cdf0e10cSrcweir function_arg_commalist3: 3040cdf0e10cSrcweir function_arg ',' function_arg ',' function_arg 3041cdf0e10cSrcweir { 3042cdf0e10cSrcweir $$ = SQL_NEW_COMMALISTRULE; 3043cdf0e10cSrcweir $$->append($1); 3044cdf0e10cSrcweir $$->append($3); 3045cdf0e10cSrcweir $$->append($5); 3046cdf0e10cSrcweir } 3047cdf0e10cSrcweir ; 3048cdf0e10cSrcweir function_arg_commalist4: 3049cdf0e10cSrcweir function_arg ',' function_arg ',' function_arg ',' function_arg 3050cdf0e10cSrcweir { 3051cdf0e10cSrcweir $$ = SQL_NEW_COMMALISTRULE; 3052cdf0e10cSrcweir $$->append($1); 3053cdf0e10cSrcweir $$->append($3); 3054cdf0e10cSrcweir $$->append($5); 3055cdf0e10cSrcweir $$->append($7); 3056cdf0e10cSrcweir } 3057cdf0e10cSrcweir ; 3058cdf0e10cSrcweir value_exp_commalist: 3059cdf0e10cSrcweir value_exp 3060cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 3061cdf0e10cSrcweir $$->append($1);} 3062cdf0e10cSrcweir | value_exp_commalist ',' value_exp 3063cdf0e10cSrcweir {$1->append($3); 3064cdf0e10cSrcweir $$ = $1;} 3065cdf0e10cSrcweir /* this rule is only valid if we check predicates */ 3066cdf0e10cSrcweir | value_exp_commalist ';' value_exp 3067cdf0e10cSrcweir { 3068cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 3069cdf0e10cSrcweir { 3070cdf0e10cSrcweir $1->append($3); 3071cdf0e10cSrcweir $$ = $1; 3072cdf0e10cSrcweir } 3073cdf0e10cSrcweir else 3074cdf0e10cSrcweir YYERROR; 3075cdf0e10cSrcweir } 3076cdf0e10cSrcweir ; 3077cdf0e10cSrcweir function_arg: 3078cdf0e10cSrcweir result 3079cdf0e10cSrcweir | value_exp comparison value_exp 3080cdf0e10cSrcweir { 3081cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3082cdf0e10cSrcweir $$->append($1); 3083cdf0e10cSrcweir $$->append($2); 3084cdf0e10cSrcweir $$->append($3); 3085cdf0e10cSrcweir } 3086cdf0e10cSrcweir | value_exp SQL_TOKEN_USING value_exp comparison value_exp 3087cdf0e10cSrcweir { 3088cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3089cdf0e10cSrcweir $$->append($1); 3090cdf0e10cSrcweir $$->append($2); 3091cdf0e10cSrcweir $$->append($3); 3092cdf0e10cSrcweir $$->append($4); 3093cdf0e10cSrcweir } 3094cdf0e10cSrcweir | value_exp SQL_TOKEN_BY value_exp_commalist 3095cdf0e10cSrcweir { 3096cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3097cdf0e10cSrcweir $$->append($1); 3098cdf0e10cSrcweir $$->append($2); 3099cdf0e10cSrcweir $$->append($3); 3100cdf0e10cSrcweir } 3101cdf0e10cSrcweir ; 3102cdf0e10cSrcweir function_args_commalist: 3103cdf0e10cSrcweir function_arg 3104cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 3105cdf0e10cSrcweir $$->append($1);} 3106cdf0e10cSrcweir | function_args_commalist ',' function_arg 3107cdf0e10cSrcweir {$1->append($3); 3108cdf0e10cSrcweir $$ = $1;} 3109cdf0e10cSrcweir /* this rule is only valid if we check predicates */ 3110cdf0e10cSrcweir | function_args_commalist ';' function_arg 3111cdf0e10cSrcweir { 3112cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) 3113cdf0e10cSrcweir { 3114cdf0e10cSrcweir $1->append($3); 3115cdf0e10cSrcweir $$ = $1; 3116cdf0e10cSrcweir } 3117cdf0e10cSrcweir else 3118cdf0e10cSrcweir YYERROR; 3119cdf0e10cSrcweir } 3120cdf0e10cSrcweir ; 3121cdf0e10cSrcweir 3122cdf0e10cSrcweir value_exp: 3123cdf0e10cSrcweir num_value_exp /*[^')']*/ 3124cdf0e10cSrcweir | string_value_exp 3125cdf0e10cSrcweir | datetime_value_exp 3126cdf0e10cSrcweir { 3127cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3128cdf0e10cSrcweir $$->append($1); 3129cdf0e10cSrcweir } 3130cdf0e10cSrcweir ; 3131cdf0e10cSrcweir string_value_exp: 3132cdf0e10cSrcweir char_value_exp 3133cdf0e10cSrcweir /* | bit_value_exp 3134cdf0e10cSrcweir { 3135cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3136cdf0e10cSrcweir $$->append($1); 3137cdf0e10cSrcweir } 3138cdf0e10cSrcweir */ ; 3139cdf0e10cSrcweir char_value_exp: 3140cdf0e10cSrcweir char_factor 3141cdf0e10cSrcweir | concatenation 3142cdf0e10cSrcweir ; 3143cdf0e10cSrcweir concatenation: 3144cdf0e10cSrcweir char_value_exp '+' char_factor 3145cdf0e10cSrcweir { 3146cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3147cdf0e10cSrcweir $$->append($1); 3148cdf0e10cSrcweir $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); 3149cdf0e10cSrcweir $$->append($3); 3150cdf0e10cSrcweir } 3151cdf0e10cSrcweir | value_exp SQL_CONCAT value_exp 3152cdf0e10cSrcweir { 3153cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3154cdf0e10cSrcweir $$->append($1); 3155cdf0e10cSrcweir $$->append($2); 3156cdf0e10cSrcweir $$->append($3); 3157cdf0e10cSrcweir } 3158cdf0e10cSrcweir ; 3159cdf0e10cSrcweir 3160cdf0e10cSrcweir char_primary: 3161cdf0e10cSrcweir SQL_TOKEN_STRING 3162cdf0e10cSrcweir | string_value_fct 3163cdf0e10cSrcweir ; 3164cdf0e10cSrcweir collate_clause: 3165cdf0e10cSrcweir SQL_TOKEN_COLLATE table_node 3166cdf0e10cSrcweir { 3167cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3168cdf0e10cSrcweir $$->append($1); 3169cdf0e10cSrcweir $$->append($2); 3170cdf0e10cSrcweir } 3171cdf0e10cSrcweir ; 3172cdf0e10cSrcweir char_factor: 3173cdf0e10cSrcweir char_primary 3174cdf0e10cSrcweir | char_primary collate_clause 3175cdf0e10cSrcweir { 3176cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3177cdf0e10cSrcweir $$->append($1); 3178cdf0e10cSrcweir $$->append($2); 3179cdf0e10cSrcweir } 3180cdf0e10cSrcweir ; 3181cdf0e10cSrcweir string_value_fct: 3182cdf0e10cSrcweir char_value_fct 3183cdf0e10cSrcweir | bit_value_fct 3184cdf0e10cSrcweir ; 3185cdf0e10cSrcweir bit_value_fct: 3186cdf0e10cSrcweir bit_substring_fct 3187cdf0e10cSrcweir { 3188cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3189cdf0e10cSrcweir $$->append($1); 3190cdf0e10cSrcweir } 3191cdf0e10cSrcweir ; 3192cdf0e10cSrcweir bit_substring_fct: 3193cdf0e10cSrcweir SQL_TOKEN_SUBSTRING '(' bit_value_exp SQL_TOKEN_FROM string_value_exp for_length ')' 3194cdf0e10cSrcweir { 3195cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3196cdf0e10cSrcweir $$->append($1); 3197cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3198cdf0e10cSrcweir $$->append($3); 3199cdf0e10cSrcweir $$->append($4); 3200cdf0e10cSrcweir $$->append($5); 3201cdf0e10cSrcweir $$->append($6); 3202cdf0e10cSrcweir $$->append($7 = newNode(")", SQL_NODE_PUNCTUATION)); 3203cdf0e10cSrcweir } 3204cdf0e10cSrcweir ; 3205cdf0e10cSrcweir bit_value_exp: 3206cdf0e10cSrcweir bit_factor 3207cdf0e10cSrcweir { 3208cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3209cdf0e10cSrcweir $$->append($1); 3210cdf0e10cSrcweir } 3211cdf0e10cSrcweir ; 3212cdf0e10cSrcweir /* 3213cdf0e10cSrcweir bit_concatenation 3214cdf0e10cSrcweir { 3215cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3216cdf0e10cSrcweir $$->append($1); 3217cdf0e10cSrcweir } 3218cdf0e10cSrcweir | 3219cdf0e10cSrcweir bit_concatenation: 3220cdf0e10cSrcweir bit_value_exp '+' bit_factor 3221cdf0e10cSrcweir { 3222cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3223cdf0e10cSrcweir $$->append($1); 3224cdf0e10cSrcweir $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); 3225cdf0e10cSrcweir $$->append($3); 3226cdf0e10cSrcweir } 3227cdf0e10cSrcweir ; 3228cdf0e10cSrcweir */ 3229cdf0e10cSrcweir bit_factor: 3230cdf0e10cSrcweir bit_primary 3231cdf0e10cSrcweir { 3232cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3233cdf0e10cSrcweir $$->append($1); 3234cdf0e10cSrcweir } 3235cdf0e10cSrcweir ; 3236cdf0e10cSrcweir bit_primary: 3237cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3238cdf0e10cSrcweir /* value_exp_primary 3239cdf0e10cSrcweir { 3240cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3241cdf0e10cSrcweir $$->append($1); 3242cdf0e10cSrcweir } 3243cdf0e10cSrcweir | string_value_fct 3244cdf0e10cSrcweir { 3245cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3246cdf0e10cSrcweir $$->append($1); 3247cdf0e10cSrcweir }*/ 3248cdf0e10cSrcweir ; 3249cdf0e10cSrcweir char_value_fct: 3250cdf0e10cSrcweir char_substring_fct 3251cdf0e10cSrcweir | fold 3252cdf0e10cSrcweir | form_conversion 3253cdf0e10cSrcweir { 3254cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3255cdf0e10cSrcweir $$->append($1); 3256cdf0e10cSrcweir } 3257cdf0e10cSrcweir | char_translation 3258cdf0e10cSrcweir { 3259cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3260cdf0e10cSrcweir $$->append($1); 3261cdf0e10cSrcweir } 3262cdf0e10cSrcweir | trim_fct 3263cdf0e10cSrcweir { 3264cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3265cdf0e10cSrcweir $$->append($1); 3266cdf0e10cSrcweir } 3267cdf0e10cSrcweir ; 3268cdf0e10cSrcweir for_length: 3269cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3270cdf0e10cSrcweir | SQL_TOKEN_FOR value_exp 3271cdf0e10cSrcweir { 3272cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3273cdf0e10cSrcweir $$->append($1); 3274cdf0e10cSrcweir $$->append($2); 3275cdf0e10cSrcweir } 3276cdf0e10cSrcweir ; 3277cdf0e10cSrcweir char_substring_fct: 3278cdf0e10cSrcweir SQL_TOKEN_SUBSTRING '(' value_exp SQL_TOKEN_FROM value_exp for_length ')' 3279cdf0e10cSrcweir { 3280cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3281cdf0e10cSrcweir $$->append($1); 3282cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3283cdf0e10cSrcweir $$->append($3); 3284cdf0e10cSrcweir $$->append($4); 3285cdf0e10cSrcweir $$->append($5); 3286cdf0e10cSrcweir $$->append($6); 3287cdf0e10cSrcweir $$->append($7 = newNode(")", SQL_NODE_PUNCTUATION)); 3288cdf0e10cSrcweir } 3289cdf0e10cSrcweir | SQL_TOKEN_SUBSTRING '(' value_exp_commalist ')' 3290cdf0e10cSrcweir { 3291cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3292cdf0e10cSrcweir $$->append($1); 3293cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3294cdf0e10cSrcweir $$->append($3); 3295cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3296cdf0e10cSrcweir } 3297cdf0e10cSrcweir ; 3298cdf0e10cSrcweir upper_lower: 3299cdf0e10cSrcweir SQL_TOKEN_UPPER 3300cdf0e10cSrcweir | SQL_TOKEN_LOWER 3301cdf0e10cSrcweir ; 3302cdf0e10cSrcweir fold: 3303cdf0e10cSrcweir upper_lower '(' value_exp ')' 3304cdf0e10cSrcweir { 3305cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3306cdf0e10cSrcweir $$->append($1); 3307cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3308cdf0e10cSrcweir $$->append($3); 3309cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3310cdf0e10cSrcweir } 3311cdf0e10cSrcweir ; 3312cdf0e10cSrcweir form_conversion: 3313cdf0e10cSrcweir SQL_TOKEN_CONVERT '(' string_value_exp SQL_TOKEN_USING table_node ')' 3314cdf0e10cSrcweir { 3315cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3316cdf0e10cSrcweir $$->append($1); 3317cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3318cdf0e10cSrcweir $$->append($3); 3319cdf0e10cSrcweir $$->append($4); 3320cdf0e10cSrcweir $$->append($5); 3321cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 3322cdf0e10cSrcweir } 3323cdf0e10cSrcweir | SQL_TOKEN_CONVERT '(' cast_operand ',' cast_target ')' 3324cdf0e10cSrcweir { 3325cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3326cdf0e10cSrcweir $$->append($1); 3327cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3328cdf0e10cSrcweir $$->append($3); 3329cdf0e10cSrcweir $$->append($2 = newNode(",", SQL_NODE_PUNCTUATION)); 3330cdf0e10cSrcweir $$->append($5); 3331cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 3332cdf0e10cSrcweir } 3333cdf0e10cSrcweir ; 3334cdf0e10cSrcweir char_translation: 3335cdf0e10cSrcweir SQL_TOKEN_TRANSLATE '(' string_value_exp SQL_TOKEN_USING table_node ')' 3336cdf0e10cSrcweir { 3337cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3338cdf0e10cSrcweir $$->append($1); 3339cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3340cdf0e10cSrcweir $$->append($3); 3341cdf0e10cSrcweir $$->append($4); 3342cdf0e10cSrcweir $$->append($5); 3343cdf0e10cSrcweir $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); 3344cdf0e10cSrcweir } 3345cdf0e10cSrcweir ; 3346cdf0e10cSrcweir trim_fct: 3347cdf0e10cSrcweir SQL_TOKEN_TRIM '(' trim_operands ')' 3348cdf0e10cSrcweir { 3349cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3350cdf0e10cSrcweir $$->append($1); 3351cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3352cdf0e10cSrcweir $$->append($3); 3353cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3354cdf0e10cSrcweir } 3355cdf0e10cSrcweir ; 3356cdf0e10cSrcweir trim_operands: 3357cdf0e10cSrcweir trim_spec value_exp SQL_TOKEN_FROM value_exp 3358cdf0e10cSrcweir { 3359cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3360cdf0e10cSrcweir $$->append($1); 3361cdf0e10cSrcweir $$->append($2); 3362cdf0e10cSrcweir $$->append($3); 3363cdf0e10cSrcweir $$->append($4); 3364cdf0e10cSrcweir } 3365cdf0e10cSrcweir | trim_spec SQL_TOKEN_FROM value_exp 3366cdf0e10cSrcweir { 3367cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3368cdf0e10cSrcweir $$->append($1); 3369cdf0e10cSrcweir $$->append($2); 3370cdf0e10cSrcweir $$->append($3); 3371cdf0e10cSrcweir } 3372cdf0e10cSrcweir | value_exp SQL_TOKEN_FROM value_exp 3373cdf0e10cSrcweir { 3374cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3375cdf0e10cSrcweir $$->append($1); 3376cdf0e10cSrcweir $$->append($2); 3377cdf0e10cSrcweir $$->append($3); 3378cdf0e10cSrcweir } 3379cdf0e10cSrcweir | SQL_TOKEN_FROM value_exp 3380cdf0e10cSrcweir { 3381cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3382cdf0e10cSrcweir $$->append($1); 3383cdf0e10cSrcweir $$->append($2); 3384cdf0e10cSrcweir } 3385cdf0e10cSrcweir | value_exp 3386cdf0e10cSrcweir ; 3387cdf0e10cSrcweir 3388cdf0e10cSrcweir trim_spec: 3389cdf0e10cSrcweir SQL_TOKEN_BOTH 3390cdf0e10cSrcweir | SQL_TOKEN_LEADING 3391cdf0e10cSrcweir | SQL_TOKEN_TRAILING 3392cdf0e10cSrcweir ; 3393cdf0e10cSrcweir 3394cdf0e10cSrcweir derived_column: 3395cdf0e10cSrcweir value_exp as_clause 3396cdf0e10cSrcweir { 3397cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3398cdf0e10cSrcweir $$->append($1); 3399cdf0e10cSrcweir $$->append($2); 3400cdf0e10cSrcweir } 3401cdf0e10cSrcweir ; 3402cdf0e10cSrcweir /* Tabellenname */ 3403cdf0e10cSrcweir table_node: 3404cdf0e10cSrcweir table_name 3405cdf0e10cSrcweir | schema_name 3406cdf0e10cSrcweir | catalog_name 3407cdf0e10cSrcweir ; 3408cdf0e10cSrcweir catalog_name: 3409cdf0e10cSrcweir SQL_TOKEN_NAME '.' schema_name 3410cdf0e10cSrcweir { 3411cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3412cdf0e10cSrcweir $$->append($1); 3413cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 3414cdf0e10cSrcweir $$->append($3); 3415cdf0e10cSrcweir } 3416cdf0e10cSrcweir | SQL_TOKEN_NAME ':' schema_name 3417cdf0e10cSrcweir { 3418cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3419cdf0e10cSrcweir $$->append($1); 3420cdf0e10cSrcweir $$->append($2 = newNode(":", SQL_NODE_PUNCTUATION)); 3421cdf0e10cSrcweir $$->append($3); 3422cdf0e10cSrcweir } 3423cdf0e10cSrcweir ; 3424cdf0e10cSrcweir schema_name: 3425cdf0e10cSrcweir SQL_TOKEN_NAME '.' table_name 3426cdf0e10cSrcweir { 3427cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3428cdf0e10cSrcweir $$->append($1); 3429cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 3430cdf0e10cSrcweir $$->append($3); 3431cdf0e10cSrcweir } 3432cdf0e10cSrcweir ; 3433cdf0e10cSrcweir 3434cdf0e10cSrcweir table_name: 3435cdf0e10cSrcweir SQL_TOKEN_NAME 3436cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3437cdf0e10cSrcweir $$->append($1);} 3438cdf0e10cSrcweir ; 3439cdf0e10cSrcweir /* Columns */ 3440cdf0e10cSrcweir column_ref: 3441cdf0e10cSrcweir column 3442cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3443cdf0e10cSrcweir $$->append($1);} 3444cdf0e10cSrcweir /* | table_node '.' column_val %prec '.' 3445cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3446cdf0e10cSrcweir $$->append($1); 3447cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 3448cdf0e10cSrcweir $$->append($3);} 3449cdf0e10cSrcweir */ 3450cdf0e10cSrcweir | SQL_TOKEN_NAME '.' column_val %prec '.' 3451cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3452cdf0e10cSrcweir $$->append($1); 3453cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 3454cdf0e10cSrcweir $$->append($3); 3455cdf0e10cSrcweir } 3456cdf0e10cSrcweir | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val %prec '.' 3457cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3458cdf0e10cSrcweir $$->append($1); 3459cdf0e10cSrcweir $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); 3460cdf0e10cSrcweir $$->append($3); 3461cdf0e10cSrcweir $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); 3462cdf0e10cSrcweir $$->append($5);} 3463cdf0e10cSrcweir | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val %prec '.' 3464cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3465cdf0e10cSrcweir $$->append($1); 3466cdf0e10cSrcweir $$->append($2= newNode(".", SQL_NODE_PUNCTUATION)); 3467cdf0e10cSrcweir $$->append($3); 3468cdf0e10cSrcweir $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); 3469cdf0e10cSrcweir $$->append($5); 3470cdf0e10cSrcweir $$->append($6 = newNode(".", SQL_NODE_PUNCTUATION)); 3471cdf0e10cSrcweir $$->append($7); 3472cdf0e10cSrcweir } 3473cdf0e10cSrcweir | SQL_TOKEN_NAME ':' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val %prec '.' 3474cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3475cdf0e10cSrcweir $$->append($1); 3476cdf0e10cSrcweir $$->append($2= newNode(":", SQL_NODE_PUNCTUATION)); 3477cdf0e10cSrcweir $$->append($3); 3478cdf0e10cSrcweir $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); 3479cdf0e10cSrcweir $$->append($5); 3480cdf0e10cSrcweir $$->append($6 = newNode(".", SQL_NODE_PUNCTUATION)); 3481cdf0e10cSrcweir $$->append($7); 3482cdf0e10cSrcweir } 3483cdf0e10cSrcweir /* | SQL_TOKEN_NAME ';' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val 3484cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3485cdf0e10cSrcweir $$->append($1); 3486cdf0e10cSrcweir $$->append($2= newNode(";", SQL_NODE_PUNCTUATION)); 3487cdf0e10cSrcweir $$->append($3); 3488cdf0e10cSrcweir $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); 3489cdf0e10cSrcweir $$->append($5); 3490cdf0e10cSrcweir $$->append($6 = newNode(".", SQL_NODE_PUNCTUATION)); 3491cdf0e10cSrcweir $$->append($7); 3492cdf0e10cSrcweir } 3493cdf0e10cSrcweir */ ; 3494cdf0e10cSrcweir 3495cdf0e10cSrcweir /* data types */ 3496cdf0e10cSrcweir column_val: 3497cdf0e10cSrcweir column 3498cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 3499cdf0e10cSrcweir $$->append($1);} 3500cdf0e10cSrcweir | '*' 3501cdf0e10cSrcweir { 3502cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3503cdf0e10cSrcweir $$->append($1 = newNode("*", SQL_NODE_PUNCTUATION)); 3504cdf0e10cSrcweir } 3505cdf0e10cSrcweir ; 3506cdf0e10cSrcweir data_type: 3507cdf0e10cSrcweir predefined_type 3508cdf0e10cSrcweir ; 3509cdf0e10cSrcweir opt_char_set_spec: 3510cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3511cdf0e10cSrcweir | SQL_TOKEN_CHARACTER SQL_TOKEN_SET SQL_TOKEN_NAME 3512cdf0e10cSrcweir { 3513cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3514cdf0e10cSrcweir $$->append($1); 3515cdf0e10cSrcweir $$->append($2); 3516cdf0e10cSrcweir $$->append($3); 3517cdf0e10cSrcweir } 3518cdf0e10cSrcweir ; 3519cdf0e10cSrcweir opt_collate_clause: 3520cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3521cdf0e10cSrcweir | collate_clause 3522cdf0e10cSrcweir ; 3523cdf0e10cSrcweir predefined_type: 3524cdf0e10cSrcweir character_string_type opt_char_set_spec opt_collate_clause 3525cdf0e10cSrcweir { 3526cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3527cdf0e10cSrcweir $$->append($1); 3528cdf0e10cSrcweir $$->append($2); 3529cdf0e10cSrcweir $$->append($3); 3530cdf0e10cSrcweir } 3531cdf0e10cSrcweir | national_character_string_type opt_collate_clause 3532cdf0e10cSrcweir { 3533cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3534cdf0e10cSrcweir $$->append($1); 3535cdf0e10cSrcweir $$->append($2); 3536cdf0e10cSrcweir } 3537cdf0e10cSrcweir | binary_string_type 3538cdf0e10cSrcweir | numeric_type 3539cdf0e10cSrcweir | boolean_type 3540cdf0e10cSrcweir | datetime_type 3541cdf0e10cSrcweir | interval_type 3542cdf0e10cSrcweir ; 3543cdf0e10cSrcweir character_string_type: 3544cdf0e10cSrcweir SQL_TOKEN_CHARACTER opt_paren_precision 3545cdf0e10cSrcweir { 3546cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3547cdf0e10cSrcweir $$->append($1); 3548cdf0e10cSrcweir $$->append($2); 3549cdf0e10cSrcweir } 3550cdf0e10cSrcweir | SQL_TOKEN_CHAR opt_paren_precision 3551cdf0e10cSrcweir { 3552cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3553cdf0e10cSrcweir $$->append($1); 3554cdf0e10cSrcweir $$->append($2); 3555cdf0e10cSrcweir } 3556cdf0e10cSrcweir | SQL_TOKEN_CHARACTER SQL_TOKEN_VARYING paren_char_length 3557cdf0e10cSrcweir { 3558cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3559cdf0e10cSrcweir $$->append($1); 3560cdf0e10cSrcweir $$->append($2); 3561cdf0e10cSrcweir $$->append($3); 3562cdf0e10cSrcweir } 3563cdf0e10cSrcweir | SQL_TOKEN_CHAR SQL_TOKEN_VARYING paren_char_length 3564cdf0e10cSrcweir { 3565cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3566cdf0e10cSrcweir $$->append($1); 3567cdf0e10cSrcweir $$->append($2); 3568cdf0e10cSrcweir $$->append($3); 3569cdf0e10cSrcweir } 3570cdf0e10cSrcweir | SQL_TOKEN_VARCHAR paren_char_length 3571cdf0e10cSrcweir { 3572cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3573cdf0e10cSrcweir $$->append($1); 3574cdf0e10cSrcweir $$->append($2); 3575cdf0e10cSrcweir } 3576cdf0e10cSrcweir | character_large_object_type 3577cdf0e10cSrcweir ; 3578cdf0e10cSrcweir opt_paren_precision: 3579cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3580cdf0e10cSrcweir | paren_char_length 3581cdf0e10cSrcweir ; 3582cdf0e10cSrcweir paren_char_length: 3583cdf0e10cSrcweir '(' SQL_TOKEN_INTNUM ')' 3584cdf0e10cSrcweir { 3585cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3586cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 3587cdf0e10cSrcweir $$->append($2); 3588cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 3589cdf0e10cSrcweir } 3590cdf0e10cSrcweir ; 3591cdf0e10cSrcweir opt_paren_char_large_length: 3592cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3593cdf0e10cSrcweir | paren_character_large_object_length 3594cdf0e10cSrcweir ; 3595cdf0e10cSrcweir paren_character_large_object_length: 3596cdf0e10cSrcweir '(' large_object_length ')' 3597cdf0e10cSrcweir { 3598cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3599cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 3600cdf0e10cSrcweir $$->append($2); 3601cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 3602cdf0e10cSrcweir } 3603cdf0e10cSrcweir ; 3604cdf0e10cSrcweir 3605cdf0e10cSrcweir large_object_length: 3606cdf0e10cSrcweir SQL_TOKEN_INTNUM opt_multiplier 3607cdf0e10cSrcweir { 3608cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3609cdf0e10cSrcweir $$->append($1); 3610cdf0e10cSrcweir $$->append($2); 3611cdf0e10cSrcweir } 3612cdf0e10cSrcweir ; 3613cdf0e10cSrcweir opt_multiplier: 3614cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3615cdf0e10cSrcweir | 'K' 3616cdf0e10cSrcweir { 3617cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3618cdf0e10cSrcweir $$->append($1 = newNode("K", SQL_NODE_PUNCTUATION)); 3619cdf0e10cSrcweir } 3620cdf0e10cSrcweir | 'M' 3621cdf0e10cSrcweir { 3622cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3623cdf0e10cSrcweir $$->append($1 = newNode("M", SQL_NODE_PUNCTUATION)); 3624cdf0e10cSrcweir } 3625cdf0e10cSrcweir | 'G' 3626cdf0e10cSrcweir { 3627cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3628cdf0e10cSrcweir $$->append($1 = newNode("G", SQL_NODE_PUNCTUATION)); 3629cdf0e10cSrcweir } 3630cdf0e10cSrcweir | 'T' 3631cdf0e10cSrcweir { 3632cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3633cdf0e10cSrcweir $$->append($1 = newNode("T", SQL_NODE_PUNCTUATION)); 3634cdf0e10cSrcweir } 3635cdf0e10cSrcweir | 'P' 3636cdf0e10cSrcweir { 3637cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3638cdf0e10cSrcweir $$->append($1 = newNode("P", SQL_NODE_PUNCTUATION)); 3639cdf0e10cSrcweir } 3640cdf0e10cSrcweir ; 3641cdf0e10cSrcweir character_large_object_type: 3642cdf0e10cSrcweir SQL_TOKEN_CHARACTER SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length 3643cdf0e10cSrcweir { 3644cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3645cdf0e10cSrcweir $$->append($1); 3646cdf0e10cSrcweir $$->append($2); 3647cdf0e10cSrcweir $$->append($3); 3648cdf0e10cSrcweir $$->append($4); 3649cdf0e10cSrcweir } 3650cdf0e10cSrcweir | SQL_TOKEN_CHAR SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length 3651cdf0e10cSrcweir { 3652cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3653cdf0e10cSrcweir $$->append($1); 3654cdf0e10cSrcweir $$->append($2); 3655cdf0e10cSrcweir $$->append($3); 3656cdf0e10cSrcweir $$->append($4); 3657cdf0e10cSrcweir } 3658cdf0e10cSrcweir | SQL_TOKEN_CLOB opt_paren_char_large_length 3659cdf0e10cSrcweir { 3660cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3661cdf0e10cSrcweir $$->append($1); 3662cdf0e10cSrcweir $$->append($2); 3663cdf0e10cSrcweir } 3664cdf0e10cSrcweir ; 3665cdf0e10cSrcweir national_character_string_type: 3666cdf0e10cSrcweir SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER opt_paren_precision 3667cdf0e10cSrcweir { 3668cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3669cdf0e10cSrcweir $$->append($1); 3670cdf0e10cSrcweir $$->append($2); 3671cdf0e10cSrcweir $$->append($3); 3672cdf0e10cSrcweir } 3673cdf0e10cSrcweir | SQL_TOKEN_NATIONAL SQL_TOKEN_CHAR opt_paren_precision 3674cdf0e10cSrcweir { 3675cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3676cdf0e10cSrcweir $$->append($1); 3677cdf0e10cSrcweir $$->append($2); 3678cdf0e10cSrcweir $$->append($3); 3679cdf0e10cSrcweir } 3680cdf0e10cSrcweir | SQL_TOKEN_NCHAR opt_paren_precision 3681cdf0e10cSrcweir { 3682cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3683cdf0e10cSrcweir $$->append($1); 3684cdf0e10cSrcweir $$->append($2); 3685cdf0e10cSrcweir } 3686cdf0e10cSrcweir | SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER SQL_TOKEN_VARYING paren_char_length 3687cdf0e10cSrcweir { 3688cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3689cdf0e10cSrcweir $$->append($1); 3690cdf0e10cSrcweir $$->append($2); 3691cdf0e10cSrcweir $$->append($3); 3692cdf0e10cSrcweir $$->append($4); 3693cdf0e10cSrcweir } 3694cdf0e10cSrcweir | SQL_TOKEN_NATIONAL SQL_TOKEN_CHAR SQL_TOKEN_VARYING paren_char_length 3695cdf0e10cSrcweir { 3696cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3697cdf0e10cSrcweir $$->append($1); 3698cdf0e10cSrcweir $$->append($2); 3699cdf0e10cSrcweir $$->append($3); 3700cdf0e10cSrcweir $$->append($4); 3701cdf0e10cSrcweir } 3702cdf0e10cSrcweir | SQL_TOKEN_NCHAR SQL_TOKEN_VARYING paren_char_length 3703cdf0e10cSrcweir { 3704cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3705cdf0e10cSrcweir $$->append($1); 3706cdf0e10cSrcweir $$->append($2); 3707cdf0e10cSrcweir $$->append($3); 3708cdf0e10cSrcweir } 3709cdf0e10cSrcweir | national_character_large_object_type 3710cdf0e10cSrcweir ; 3711cdf0e10cSrcweir national_character_large_object_type: 3712cdf0e10cSrcweir SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length 3713cdf0e10cSrcweir { 3714cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3715cdf0e10cSrcweir $$->append($1); 3716cdf0e10cSrcweir $$->append($2); 3717cdf0e10cSrcweir $$->append($3); 3718cdf0e10cSrcweir $$->append($4); 3719cdf0e10cSrcweir $$->append($5); 3720cdf0e10cSrcweir } 3721cdf0e10cSrcweir | SQL_TOKEN_NCHAR SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length 3722cdf0e10cSrcweir { 3723cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3724cdf0e10cSrcweir $$->append($1); 3725cdf0e10cSrcweir $$->append($2); 3726cdf0e10cSrcweir $$->append($3); 3727cdf0e10cSrcweir $$->append($4); 3728cdf0e10cSrcweir } 3729cdf0e10cSrcweir | SQL_TOKEN_NCLOB opt_paren_char_large_length 3730cdf0e10cSrcweir { 3731cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3732cdf0e10cSrcweir $$->append($1); 3733cdf0e10cSrcweir $$->append($2); 3734cdf0e10cSrcweir } 3735cdf0e10cSrcweir ; 3736cdf0e10cSrcweir binary_string_type: 3737cdf0e10cSrcweir SQL_TOKEN_BINARY opt_paren_precision 3738cdf0e10cSrcweir { 3739cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3740cdf0e10cSrcweir $$->append($1); 3741cdf0e10cSrcweir $$->append($2); 3742cdf0e10cSrcweir } 3743cdf0e10cSrcweir | SQL_TOKEN_BINARY SQL_TOKEN_VARYING paren_char_length 3744cdf0e10cSrcweir { 3745cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3746cdf0e10cSrcweir $$->append($1); 3747cdf0e10cSrcweir $$->append($2); 3748cdf0e10cSrcweir $$->append($3); 3749cdf0e10cSrcweir } 3750cdf0e10cSrcweir | SQL_TOKEN_VARBINARY paren_char_length 3751cdf0e10cSrcweir { 3752cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3753cdf0e10cSrcweir $$->append($1); 3754cdf0e10cSrcweir $$->append($2); 3755cdf0e10cSrcweir } 3756cdf0e10cSrcweir | binary_large_object_string_type 3757cdf0e10cSrcweir ; 3758cdf0e10cSrcweir binary_large_object_string_type: 3759cdf0e10cSrcweir SQL_TOKEN_BINARY SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length 3760cdf0e10cSrcweir { 3761cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3762cdf0e10cSrcweir $$->append($1); 3763cdf0e10cSrcweir $$->append($2); 3764cdf0e10cSrcweir $$->append($3); 3765cdf0e10cSrcweir $$->append($4); 3766cdf0e10cSrcweir } 3767cdf0e10cSrcweir | SQL_TOKEN_BLOB opt_paren_char_large_length 3768cdf0e10cSrcweir { 3769cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3770cdf0e10cSrcweir $$->append($1); 3771cdf0e10cSrcweir $$->append($2); 3772cdf0e10cSrcweir } 3773cdf0e10cSrcweir ; 3774cdf0e10cSrcweir numeric_type: 3775cdf0e10cSrcweir exact_numeric_type 3776cdf0e10cSrcweir | approximate_numeric_type 3777cdf0e10cSrcweir ; 3778cdf0e10cSrcweir opt_paren_precision_scale: 3779cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3780cdf0e10cSrcweir | '(' SQL_TOKEN_INTNUM ')' 3781cdf0e10cSrcweir { 3782cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3783cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 3784cdf0e10cSrcweir $$->append($2); 3785cdf0e10cSrcweir $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); 3786cdf0e10cSrcweir } 3787cdf0e10cSrcweir | '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' 3788cdf0e10cSrcweir { 3789cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3790cdf0e10cSrcweir $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); 3791cdf0e10cSrcweir $$->append($2); 3792cdf0e10cSrcweir $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION)); 3793cdf0e10cSrcweir $$->append($4); 3794cdf0e10cSrcweir $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); 3795cdf0e10cSrcweir } 3796cdf0e10cSrcweir ; 3797cdf0e10cSrcweir exact_numeric_type: 3798cdf0e10cSrcweir SQL_TOKEN_NUMERIC opt_paren_precision_scale 3799cdf0e10cSrcweir { 3800cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3801cdf0e10cSrcweir $$->append($1); 3802cdf0e10cSrcweir $$->append($2); 3803cdf0e10cSrcweir } 3804cdf0e10cSrcweir | SQL_TOKEN_DECIMAL opt_paren_precision_scale 3805cdf0e10cSrcweir { 3806cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3807cdf0e10cSrcweir $$->append($1); 3808cdf0e10cSrcweir $$->append($2); 3809cdf0e10cSrcweir } 3810cdf0e10cSrcweir | SQL_TOKEN_DEC opt_paren_precision_scale 3811cdf0e10cSrcweir { 3812cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3813cdf0e10cSrcweir $$->append($1); 3814cdf0e10cSrcweir $$->append($2); 3815cdf0e10cSrcweir } 3816cdf0e10cSrcweir | SQL_TOKEN_SMALLINT 3817cdf0e10cSrcweir | SQL_TOKEN_INTEGER 3818cdf0e10cSrcweir | SQL_TOKEN_INT 3819cdf0e10cSrcweir | SQL_TOKEN_BIGINT 3820cdf0e10cSrcweir ; 3821cdf0e10cSrcweir approximate_numeric_type: 3822cdf0e10cSrcweir SQL_TOKEN_FLOAT '(' SQL_TOKEN_INTNUM ')' 3823cdf0e10cSrcweir { 3824cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3825cdf0e10cSrcweir $$->append($1); 3826cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3827cdf0e10cSrcweir $$->append($3); 3828cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3829cdf0e10cSrcweir } 3830cdf0e10cSrcweir | SQL_TOKEN_FLOAT 3831cdf0e10cSrcweir | SQL_TOKEN_REAL 3832cdf0e10cSrcweir | SQL_TOKEN_DOUBLE 3833cdf0e10cSrcweir | SQL_TOKEN_DOUBLE SQL_TOKEN_PRECISION 3834cdf0e10cSrcweir { 3835cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3836cdf0e10cSrcweir $$->append($1); 3837cdf0e10cSrcweir $$->append($2); 3838cdf0e10cSrcweir } 3839cdf0e10cSrcweir ; 3840cdf0e10cSrcweir boolean_type: 3841cdf0e10cSrcweir SQL_TOKEN_BOOLEAN 3842cdf0e10cSrcweir ; 3843cdf0e10cSrcweir datetime_type: 3844cdf0e10cSrcweir SQL_TOKEN_DATE 3845cdf0e10cSrcweir | SQL_TOKEN_TIME opt_paren_precision opt_with_or_without_time_zone 3846cdf0e10cSrcweir { 3847cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3848cdf0e10cSrcweir $$->append($1); 3849cdf0e10cSrcweir $$->append($2); 3850cdf0e10cSrcweir $$->append($3); 3851cdf0e10cSrcweir } 3852cdf0e10cSrcweir | SQL_TOKEN_TIMESTAMP opt_paren_precision opt_with_or_without_time_zone 3853cdf0e10cSrcweir { 3854cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3855cdf0e10cSrcweir $$->append($1); 3856cdf0e10cSrcweir $$->append($2); 3857cdf0e10cSrcweir $$->append($3); 3858cdf0e10cSrcweir } 3859cdf0e10cSrcweir ; 3860cdf0e10cSrcweir opt_with_or_without_time_zone: 3861cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 3862cdf0e10cSrcweir | SQL_TOKEN_WITH SQL_TOKEN_TIME SQL_TOKEN_ZONE 3863cdf0e10cSrcweir { 3864cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3865cdf0e10cSrcweir $$->append($1); 3866cdf0e10cSrcweir $$->append($2); 3867cdf0e10cSrcweir $$->append($3); 3868cdf0e10cSrcweir } 3869cdf0e10cSrcweir | SQL_TOKEN_WITHOUT SQL_TOKEN_TIME SQL_TOKEN_ZONE 3870cdf0e10cSrcweir { 3871cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3872cdf0e10cSrcweir $$->append($1); 3873cdf0e10cSrcweir $$->append($2); 3874cdf0e10cSrcweir $$->append($3); 3875cdf0e10cSrcweir } 3876cdf0e10cSrcweir ; 3877cdf0e10cSrcweir interval_type: 3878cdf0e10cSrcweir SQL_TOKEN_INTERVAL interval_qualifier 3879cdf0e10cSrcweir { 3880cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3881cdf0e10cSrcweir $$->append($1); 3882cdf0e10cSrcweir $$->append($2); 3883cdf0e10cSrcweir } 3884cdf0e10cSrcweir ; 3885cdf0e10cSrcweir /* the various things you can name */ 3886cdf0e10cSrcweir 3887cdf0e10cSrcweir column: 3888cdf0e10cSrcweir SQL_TOKEN_NAME 3889cdf0e10cSrcweir | SQL_TOKEN_POSITION 3890cdf0e10cSrcweir { 3891cdf0e10cSrcweir sal_uInt32 nNod = $$->getRuleID(); 3892cdf0e10cSrcweir delete $$; 3893cdf0e10cSrcweir $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); 3894cdf0e10cSrcweir } 3895cdf0e10cSrcweir | SQL_TOKEN_CHAR_LENGTH 3896cdf0e10cSrcweir { 3897cdf0e10cSrcweir sal_uInt32 nNod = $$->getRuleID(); 3898cdf0e10cSrcweir delete $$; 3899cdf0e10cSrcweir $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); 3900cdf0e10cSrcweir } 3901cdf0e10cSrcweir | SQL_TOKEN_EXTRACT 3902cdf0e10cSrcweir { 3903cdf0e10cSrcweir sal_uInt32 nNod = $$->getRuleID(); 3904cdf0e10cSrcweir delete $$; 3905cdf0e10cSrcweir $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); 3906cdf0e10cSrcweir } 3907cdf0e10cSrcweir ; 3908cdf0e10cSrcweir case_expression: 3909cdf0e10cSrcweir case_abbreviation 3910cdf0e10cSrcweir | case_specification 3911cdf0e10cSrcweir ; 3912cdf0e10cSrcweir case_abbreviation: 3913cdf0e10cSrcweir SQL_TOKEN_NULLIF '(' value_exp_commalist ')' 3914cdf0e10cSrcweir { 3915cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3916cdf0e10cSrcweir $$->append($1); 3917cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3918cdf0e10cSrcweir $$->append($3); 3919cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3920cdf0e10cSrcweir } 3921cdf0e10cSrcweir | SQL_TOKEN_COALESCE '(' value_exp ')' 3922cdf0e10cSrcweir { 3923cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3924cdf0e10cSrcweir $$->append($1); 3925cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3926cdf0e10cSrcweir $$->append($3); 3927cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3928cdf0e10cSrcweir } 3929cdf0e10cSrcweir | SQL_TOKEN_COALESCE '(' value_exp_commalist ')' 3930cdf0e10cSrcweir { 3931cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3932cdf0e10cSrcweir $$->append($1); 3933cdf0e10cSrcweir $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); 3934cdf0e10cSrcweir $$->append($3); 3935cdf0e10cSrcweir $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); 3936cdf0e10cSrcweir } 3937cdf0e10cSrcweir ; 3938cdf0e10cSrcweir case_specification: 3939cdf0e10cSrcweir simple_case 3940cdf0e10cSrcweir | searched_case 3941cdf0e10cSrcweir ; 3942cdf0e10cSrcweir simple_case: 3943cdf0e10cSrcweir SQL_TOKEN_CASE case_operand simple_when_clause_list else_clause SQL_TOKEN_END 3944cdf0e10cSrcweir { 3945cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3946cdf0e10cSrcweir $$->append($1); 3947cdf0e10cSrcweir $$->append($2); 3948cdf0e10cSrcweir $$->append($3); 3949cdf0e10cSrcweir $$->append($4); 3950cdf0e10cSrcweir $$->append($5); 3951cdf0e10cSrcweir } 3952cdf0e10cSrcweir ; 3953cdf0e10cSrcweir searched_case: 3954cdf0e10cSrcweir SQL_TOKEN_CASE searched_when_clause_list else_clause SQL_TOKEN_END 3955cdf0e10cSrcweir { 3956cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3957cdf0e10cSrcweir $$->append($1); 3958cdf0e10cSrcweir $$->append($2); 3959cdf0e10cSrcweir $$->append($3); 3960cdf0e10cSrcweir $$->append($4); 3961cdf0e10cSrcweir } 3962cdf0e10cSrcweir ; 3963cdf0e10cSrcweir simple_when_clause_list: 3964cdf0e10cSrcweir simple_when_clause 3965cdf0e10cSrcweir { 3966cdf0e10cSrcweir $$ = SQL_NEW_LISTRULE; 3967cdf0e10cSrcweir $$->append($1); 3968cdf0e10cSrcweir } 3969cdf0e10cSrcweir | searched_when_clause_list simple_when_clause 3970cdf0e10cSrcweir { 3971cdf0e10cSrcweir $1->append($2); 3972cdf0e10cSrcweir $$ = $1; 3973cdf0e10cSrcweir } 3974cdf0e10cSrcweir ; 3975cdf0e10cSrcweir simple_when_clause: 3976cdf0e10cSrcweir SQL_TOKEN_WHEN when_operand_list SQL_TOKEN_THEN result 3977cdf0e10cSrcweir { 3978cdf0e10cSrcweir $$ = SQL_NEW_RULE; 3979cdf0e10cSrcweir $$->append($1); 3980cdf0e10cSrcweir $$->append($2); 3981cdf0e10cSrcweir $$->append($3); 3982cdf0e10cSrcweir $$->append($4); 3983cdf0e10cSrcweir } 3984cdf0e10cSrcweir ; 3985cdf0e10cSrcweir when_operand_list: 3986cdf0e10cSrcweir when_operand 3987cdf0e10cSrcweir {$$ = SQL_NEW_COMMALISTRULE; 3988cdf0e10cSrcweir $$->append($1);} 3989cdf0e10cSrcweir | when_operand_list ',' when_operand 3990cdf0e10cSrcweir {$1->append($3); 3991cdf0e10cSrcweir $$ = $1;} 3992cdf0e10cSrcweir ; 3993cdf0e10cSrcweir when_operand: 3994cdf0e10cSrcweir row_value_constructor_elem 3995cdf0e10cSrcweir | comparison_predicate_part_2 3996cdf0e10cSrcweir | between_predicate_part_2 3997cdf0e10cSrcweir | in_predicate_part_2 3998cdf0e10cSrcweir | character_like_predicate_part_2 3999cdf0e10cSrcweir | null_predicate_part_2 4000cdf0e10cSrcweir ; 4001cdf0e10cSrcweir searched_when_clause_list: 4002cdf0e10cSrcweir searched_when_clause 4003cdf0e10cSrcweir { 4004cdf0e10cSrcweir $$ = SQL_NEW_LISTRULE; 4005cdf0e10cSrcweir $$->append($1); 4006cdf0e10cSrcweir } 4007cdf0e10cSrcweir | searched_when_clause_list searched_when_clause 4008cdf0e10cSrcweir { 4009cdf0e10cSrcweir $1->append($2); 4010cdf0e10cSrcweir $$ = $1; 4011cdf0e10cSrcweir } 4012cdf0e10cSrcweir ; 4013cdf0e10cSrcweir searched_when_clause: 4014cdf0e10cSrcweir SQL_TOKEN_WHEN search_condition SQL_TOKEN_THEN result 4015cdf0e10cSrcweir { 4016cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4017cdf0e10cSrcweir $$->append($1); 4018cdf0e10cSrcweir $$->append($2); 4019cdf0e10cSrcweir $$->append($3); 4020cdf0e10cSrcweir $$->append($4); 4021cdf0e10cSrcweir } 4022cdf0e10cSrcweir ; 4023cdf0e10cSrcweir else_clause: 4024cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 4025cdf0e10cSrcweir | SQL_TOKEN_ELSE result 4026cdf0e10cSrcweir { 4027cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4028cdf0e10cSrcweir $$->append($1); 4029cdf0e10cSrcweir $$->append($2); 4030cdf0e10cSrcweir } 4031cdf0e10cSrcweir ; 4032cdf0e10cSrcweir result: 4033cdf0e10cSrcweir result_expression 4034cdf0e10cSrcweir | SQL_TOKEN_NULL 4035cdf0e10cSrcweir ; 4036cdf0e10cSrcweir result_expression: 4037cdf0e10cSrcweir value_exp 4038cdf0e10cSrcweir ; 4039cdf0e10cSrcweir case_operand: 4040cdf0e10cSrcweir row_value_constructor_elem 4041cdf0e10cSrcweir ; 4042cdf0e10cSrcweir 4043cdf0e10cSrcweir cursor: SQL_TOKEN_NAME 4044cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 4045cdf0e10cSrcweir $$->append($1);} 4046cdf0e10cSrcweir ; 4047cdf0e10cSrcweir 4048cdf0e10cSrcweir /*** 4049cdf0e10cSrcweir module: SQL_TOKEN_NAME 4050cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 4051cdf0e10cSrcweir $$->append($1);} 4052cdf0e10cSrcweir ; 4053cdf0e10cSrcweir ***/ 4054cdf0e10cSrcweir 4055cdf0e10cSrcweir parameter: 4056cdf0e10cSrcweir ':' SQL_TOKEN_NAME 4057cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 4058cdf0e10cSrcweir $$->append($1 = newNode(":", SQL_NODE_PUNCTUATION)); 4059cdf0e10cSrcweir $$->append($2);} 4060cdf0e10cSrcweir | '?' 4061cdf0e10cSrcweir {$$ = SQL_NEW_RULE; // test 4062cdf0e10cSrcweir $$->append($1 = newNode("?", SQL_NODE_PUNCTUATION));} 4063cdf0e10cSrcweir | '[' SQL_TOKEN_NAME ']' 4064cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 4065cdf0e10cSrcweir $$->append($1 = newNode("[", SQL_NODE_PUNCTUATION)); 4066cdf0e10cSrcweir $$->append($2); 4067cdf0e10cSrcweir $$->append($3 = newNode("]", SQL_NODE_PUNCTUATION));} 4068cdf0e10cSrcweir ; 4069cdf0e10cSrcweir 4070cdf0e10cSrcweir /*** 4071cdf0e10cSrcweir procedure: SQL_TOKEN_NAME 4072cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 4073cdf0e10cSrcweir $$->append($1);} 4074cdf0e10cSrcweir ; 4075cdf0e10cSrcweir ***/ 4076cdf0e10cSrcweir 4077cdf0e10cSrcweir range_variable: 4078cdf0e10cSrcweir {$$ = SQL_NEW_RULE;} 4079cdf0e10cSrcweir | opt_as SQL_TOKEN_NAME 4080cdf0e10cSrcweir {$$ = SQL_NEW_RULE; 4081cdf0e10cSrcweir $$->append($1); 4082cdf0e10cSrcweir $$->append($2); 4083cdf0e10cSrcweir } 4084cdf0e10cSrcweir ; 4085cdf0e10cSrcweir 4086cdf0e10cSrcweir user: SQL_TOKEN_NAME 4087cdf0e10cSrcweir ; 4088cdf0e10cSrcweir 4089cdf0e10cSrcweir /* PREDICATECHECK RULES */ 4090cdf0e10cSrcweir sql: 4091cdf0e10cSrcweir search_condition /* checking predicats */ 4092cdf0e10cSrcweir { 4093cdf0e10cSrcweir if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // sql: rule 1 4094cdf0e10cSrcweir { 4095cdf0e10cSrcweir $$ = $1; 4096cdf0e10cSrcweir if ( SQL_ISRULE($$,search_condition) ) 4097cdf0e10cSrcweir { 4098cdf0e10cSrcweir $$->insert(0,newNode("(", SQL_NODE_PUNCTUATION)); 4099cdf0e10cSrcweir $$->append(newNode(")", SQL_NODE_PUNCTUATION)); 4100cdf0e10cSrcweir } 4101cdf0e10cSrcweir } 4102cdf0e10cSrcweir else 4103cdf0e10cSrcweir YYERROR; 4104cdf0e10cSrcweir } 4105cdf0e10cSrcweir | '(' sql ')' /* checking predicats */ 4106cdf0e10cSrcweir ; 4107cdf0e10cSrcweir trigger_definition: 4108cdf0e10cSrcweir SQL_TOKEN_CREATE SQL_TOKEN_TRIGGER trigger_name trigger_action_time trigger_event SQL_TOKEN_ON table_name op_referencing triggered_action 4109cdf0e10cSrcweir { 4110cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4111cdf0e10cSrcweir $$->append($1); 4112cdf0e10cSrcweir $$->append($2); 4113cdf0e10cSrcweir $$->append($3); 4114cdf0e10cSrcweir $$->append($4); 4115cdf0e10cSrcweir $$->append($5); 4116cdf0e10cSrcweir $$->append($6); 4117cdf0e10cSrcweir $$->append($7); 4118cdf0e10cSrcweir $$->append($8); 4119cdf0e10cSrcweir $$->append($9); 4120cdf0e10cSrcweir } 4121cdf0e10cSrcweir ; 4122cdf0e10cSrcweir op_referencing: 4123cdf0e10cSrcweir { 4124cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4125cdf0e10cSrcweir } 4126cdf0e10cSrcweir | SQL_TOKEN_REFERENCING transition_table_or_variable_list 4127cdf0e10cSrcweir { 4128cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4129cdf0e10cSrcweir $$->append($1); 4130cdf0e10cSrcweir $$->append($2); 4131cdf0e10cSrcweir } 4132cdf0e10cSrcweir ; 4133cdf0e10cSrcweir trigger_action_time: 4134cdf0e10cSrcweir SQL_TOKEN_BEFORE 4135cdf0e10cSrcweir | SQL_TOKEN_AFTER 4136cdf0e10cSrcweir | SQL_TOKEN_INSTEAD SQL_TOKEN_OF 4137cdf0e10cSrcweir { 4138cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4139cdf0e10cSrcweir $$->append($1); 4140cdf0e10cSrcweir $$->append($2); 4141cdf0e10cSrcweir } 4142cdf0e10cSrcweir ; 4143cdf0e10cSrcweir trigger_event: 4144cdf0e10cSrcweir SQL_TOKEN_INSERT 4145cdf0e10cSrcweir | SQL_TOKEN_DELETE 4146cdf0e10cSrcweir | SQL_TOKEN_UPDATE op_trigger_columnlist 4147cdf0e10cSrcweir { 4148cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4149cdf0e10cSrcweir $$->append($1); 4150cdf0e10cSrcweir $$->append($2); 4151cdf0e10cSrcweir } 4152cdf0e10cSrcweir ; 4153cdf0e10cSrcweir op_trigger_columnlist: 4154cdf0e10cSrcweir { 4155cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4156cdf0e10cSrcweir } 4157cdf0e10cSrcweir | SQL_TOKEN_OF trigger_column_list 4158cdf0e10cSrcweir { 4159cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4160cdf0e10cSrcweir $$->append($1); 4161cdf0e10cSrcweir $$->append($2); 4162cdf0e10cSrcweir } 4163cdf0e10cSrcweir ; 4164cdf0e10cSrcweir trigger_column_list: 4165cdf0e10cSrcweir column_commalist 4166cdf0e10cSrcweir ; 4167cdf0e10cSrcweir triggered_action: 4168cdf0e10cSrcweir op_triggered_action_for triggered_when_clause triggered_SQL_statement 4169cdf0e10cSrcweir { 4170cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4171cdf0e10cSrcweir $$->append($1); 4172cdf0e10cSrcweir $$->append($2); 4173cdf0e10cSrcweir $$->append($3); 4174cdf0e10cSrcweir } 4175cdf0e10cSrcweir ; 4176cdf0e10cSrcweir op_triggered_action_for: 4177cdf0e10cSrcweir { 4178cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4179cdf0e10cSrcweir } 4180cdf0e10cSrcweir | SQL_TOKEN_FOR SQL_TOKEN_EACH trigger_for 4181cdf0e10cSrcweir { 4182cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4183cdf0e10cSrcweir $$->append($1); 4184cdf0e10cSrcweir $$->append($2); 4185cdf0e10cSrcweir $$->append($3); 4186cdf0e10cSrcweir } 4187cdf0e10cSrcweir ; 4188cdf0e10cSrcweir trigger_for: 4189cdf0e10cSrcweir SQL_TOKEN_ROW 4190cdf0e10cSrcweir | SQL_TOKEN_STATEMENT 4191cdf0e10cSrcweir ; 4192cdf0e10cSrcweir triggered_when_clause: 4193cdf0e10cSrcweir { 4194cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4195cdf0e10cSrcweir } 4196cdf0e10cSrcweir | SQL_TOKEN_WHEN parenthesized_boolean_value_expression 4197cdf0e10cSrcweir { 4198cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4199cdf0e10cSrcweir $$->append($1); 4200cdf0e10cSrcweir $$->append($2); 4201cdf0e10cSrcweir } 4202cdf0e10cSrcweir ; 4203cdf0e10cSrcweir triggered_SQL_statement: 4204cdf0e10cSrcweir SQL_procedure_statement 4205cdf0e10cSrcweir | SQL_TOKEN_BEGIN SQL_TOKEN_ATOMIC SQL_procedure_statement_list ';' SQL_TOKEN_END 4206cdf0e10cSrcweir { 4207cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4208cdf0e10cSrcweir $$->append($1); 4209cdf0e10cSrcweir $$->append($2); 4210cdf0e10cSrcweir $$->append($3); 4211cdf0e10cSrcweir $$->append($4 = newNode(";", SQL_NODE_PUNCTUATION)); 4212cdf0e10cSrcweir $$->append($5); 4213cdf0e10cSrcweir } 4214cdf0e10cSrcweir ; 4215cdf0e10cSrcweir SQL_procedure_statement_list: 4216cdf0e10cSrcweir SQL_procedure_statement 4217cdf0e10cSrcweir { 4218cdf0e10cSrcweir $$ = SQL_NEW_LISTRULE; 4219cdf0e10cSrcweir $$->append($1); 4220cdf0e10cSrcweir } 4221cdf0e10cSrcweir | SQL_procedure_statement_list ';' SQL_procedure_statement 4222cdf0e10cSrcweir { 4223cdf0e10cSrcweir $1->append($3); 4224cdf0e10cSrcweir $$ = $1; 4225cdf0e10cSrcweir } 4226cdf0e10cSrcweir ; 4227cdf0e10cSrcweir SQL_procedure_statement: 4228cdf0e10cSrcweir sql 4229cdf0e10cSrcweir ; 4230cdf0e10cSrcweir 4231cdf0e10cSrcweir transition_table_or_variable_list: 4232cdf0e10cSrcweir transition_table_or_variable 4233cdf0e10cSrcweir { 4234cdf0e10cSrcweir $$ = SQL_NEW_LISTRULE; 4235cdf0e10cSrcweir $$->append($1); 4236cdf0e10cSrcweir } 4237cdf0e10cSrcweir | transition_table_or_variable_list transition_table_or_variable 4238cdf0e10cSrcweir { 4239cdf0e10cSrcweir $1->append($2); 4240cdf0e10cSrcweir $$ = $1; 4241cdf0e10cSrcweir } 4242cdf0e10cSrcweir ; 4243cdf0e10cSrcweir 4244cdf0e10cSrcweir transition_table_or_variable: 4245cdf0e10cSrcweir SQL_TOKEN_OLD opt_row opt_as old_transition_variable_name 4246cdf0e10cSrcweir { 4247cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4248cdf0e10cSrcweir $$->append($1); 4249cdf0e10cSrcweir $$->append($2); 4250cdf0e10cSrcweir $$->append($3); 4251cdf0e10cSrcweir $$->append($4); 4252cdf0e10cSrcweir } 4253cdf0e10cSrcweir | SQL_TOKEN_NEW opt_row opt_as new_transition_variable_name 4254cdf0e10cSrcweir { 4255cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4256cdf0e10cSrcweir $$->append($1); 4257cdf0e10cSrcweir $$->append($2); 4258cdf0e10cSrcweir $$->append($3); 4259cdf0e10cSrcweir $$->append($4); 4260cdf0e10cSrcweir } 4261cdf0e10cSrcweir | SQL_TOKEN_OLD SQL_TOKEN_TABLE opt_as old_transition_table_name 4262cdf0e10cSrcweir { 4263cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4264cdf0e10cSrcweir $$->append($1); 4265cdf0e10cSrcweir $$->append($2); 4266cdf0e10cSrcweir $$->append($3); 4267cdf0e10cSrcweir $$->append($4); 4268cdf0e10cSrcweir } 4269cdf0e10cSrcweir | SQL_TOKEN_NEW SQL_TOKEN_TABLE opt_as new_transition_table_name 4270cdf0e10cSrcweir { 4271cdf0e10cSrcweir $$ = SQL_NEW_RULE; 4272cdf0e10cSrcweir $$->append($1); 4273cdf0e10cSrcweir $$->append($2); 4274cdf0e10cSrcweir $$->append($3); 4275cdf0e10cSrcweir $$->append($4); 4276cdf0e10cSrcweir } 4277cdf0e10cSrcweir ; 4278cdf0e10cSrcweir old_transition_table_name: 4279cdf0e10cSrcweir transition_table_name 4280cdf0e10cSrcweir ; 4281cdf0e10cSrcweir new_transition_table_name: 4282cdf0e10cSrcweir transition_table_name 4283cdf0e10cSrcweir ; 4284cdf0e10cSrcweir transition_table_name: 4285cdf0e10cSrcweir SQL_TOKEN_NAME 4286cdf0e10cSrcweir ; 4287cdf0e10cSrcweir old_transition_variable_name: 4288cdf0e10cSrcweir SQL_TOKEN_NAME 4289cdf0e10cSrcweir ; 4290cdf0e10cSrcweir new_transition_variable_name: 4291cdf0e10cSrcweir SQL_TOKEN_NAME 4292cdf0e10cSrcweir ; 4293cdf0e10cSrcweir trigger_name: 4294cdf0e10cSrcweir SQL_TOKEN_NAME 4295cdf0e10cSrcweir ; 4296cdf0e10cSrcweir %% 4297cdf0e10cSrcweir 4298cdf0e10cSrcweir 4299cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 4300cdf0e10cSrcweir using namespace ::com::sun::star::beans; 4301cdf0e10cSrcweir using namespace ::com::sun::star::uno; 4302cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 4303cdf0e10cSrcweir using namespace ::com::sun::star::lang; 4304cdf0e10cSrcweir using namespace ::com::sun::star::util; 4305cdf0e10cSrcweir using namespace ::osl; 4306cdf0e10cSrcweir using namespace ::dbtools; 4307cdf0e10cSrcweir // using namespace connectivity; 4308cdf0e10cSrcweir 4309cdf0e10cSrcweir //============================================================ 4310cdf0e10cSrcweir //= a helper for static ascii pseudo-unicode strings 4311cdf0e10cSrcweir //============================================================ 4312cdf0e10cSrcweir // string constants 4313cdf0e10cSrcweir struct _ConstAsciiString_ 4314cdf0e10cSrcweir { 4315cdf0e10cSrcweir sal_Int32 length; 4316cdf0e10cSrcweir sal_Char const* str; 4317cdf0e10cSrcweir 4318cdf0e10cSrcweir operator rtl::OUString () const { return rtl::OUString(str, length, RTL_TEXTENCODING_ASCII_US); } 4319cdf0e10cSrcweir // operator ::rtl::OUString () const { return ::rtl::OUString(str, length, RTL_TEXTENCODING_ASCII_US); } 4320cdf0e10cSrcweir operator const sal_Char * () const { return str; } 4321cdf0e10cSrcweir operator ::rtl::OString() const { return str; } 4322cdf0e10cSrcweir }; 4323cdf0e10cSrcweir 4324cdf0e10cSrcweir #define IMPLEMENT_CONSTASCII_STRING( name, string ) \ 4325cdf0e10cSrcweir _ConstAsciiString_ const name = { sizeof(string)-1, string } 4326cdf0e10cSrcweir 4327cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_GENERAL, "Syntax error in SQL expression"); 4328cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_VALUE_NO_LIKE, "The value #1 can not be used with LIKE."); 4329cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_FIELD_NO_LIKE, "LIKE can not be used with this field."); 4330cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_COMPARE, "The entered criterion can not be compared with this field."); 4331cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_DATE_COMPARE, "The field can not be compared with a date."); 4332cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_REAL_COMPARE, "The field can not be compared with a floating point number."); 4333cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_INT_COMPARE, "The field can not be compared with a number."); 4334cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_TABLE, "The database does not contain a table named \"#\"."); 4335cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_TABLE_OR_QUERY, "The database does contain neither a table nor a query named \"#\"."); 4336cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_COLUMN, "The column \"#1\" is unknown in the table \"#2\"."); 4337cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_TABLE_EXIST, "The database already contains a table or view with name \"#\"."); 4338cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_QUERY_EXIST, "The database already contains a query with name \"#\"."); 4339cdf0e10cSrcweir 4340cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_LIKE, "LIKE"); 4341cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_NOT, "NOT"); 4342cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_NULL, "NULL"); 4343cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_TRUE, "True"); 4344cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_FALSE, "False"); 4345cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_IS, "IS"); 4346cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_BETWEEN, "BETWEEN"); 4347cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_OR, "OR"); 4348cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_AND, "AND"); 4349cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_AVG, "AVG"); 4350cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_COUNT, "COUNT"); 4351cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_MAX, "MAX"); 4352cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_MIN, "MIN"); 4353cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_SUM, "SUM"); 4354cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_EVERY, "EVERY"); 4355cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_ANY, "ANY"); 4356cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_SOME, "SOME"); 4357cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_STDDEV_POP, "STDDEV_POP"); 4358cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_STDDEV_SAMP, "STDDEV_SAMP"); 4359cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_VAR_SAMP, "VAR_SAMP"); 4360cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_VAR_POP, "VAR_POP"); 4361cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_COLLECT, "COLLECT"); 4362cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_FUSION, "FUSION"); 4363cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(KEY_STR_INTERSECTION, "INTERSECTION"); 4364cdf0e10cSrcweir 4365cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(FIELD_STR_NULLDATE, "NullDate"); 4366cdf0e10cSrcweir 4367cdf0e10cSrcweir IMPLEMENT_CONSTASCII_STRING(STR_SQL_TOKEN, "SQL_TOKEN_"); 4368cdf0e10cSrcweir 4369cdf0e10cSrcweir //========================================================================== 4370cdf0e10cSrcweir //= OParseContext 4371cdf0e10cSrcweir //========================================================================== 4372cdf0e10cSrcweir //----------------------------------------------------------------------------- 4373cdf0e10cSrcweir OParseContext::OParseContext() 4374cdf0e10cSrcweir { 4375cdf0e10cSrcweir } 4376cdf0e10cSrcweir 4377cdf0e10cSrcweir //----------------------------------------------------------------------------- 4378cdf0e10cSrcweir OParseContext::~OParseContext() 4379cdf0e10cSrcweir { 4380cdf0e10cSrcweir } 4381cdf0e10cSrcweir 4382cdf0e10cSrcweir //----------------------------------------------------------------------------- 4383cdf0e10cSrcweir ::rtl::OUString OParseContext::getErrorMessage(ErrorCode _eCode) const 4384cdf0e10cSrcweir { 4385cdf0e10cSrcweir ::rtl::OUString aMsg; 4386cdf0e10cSrcweir switch (_eCode) 4387cdf0e10cSrcweir { 4388cdf0e10cSrcweir case ERROR_GENERAL: aMsg = ERROR_STR_GENERAL; break; 4389cdf0e10cSrcweir case ERROR_VALUE_NO_LIKE: aMsg = ERROR_STR_VALUE_NO_LIKE; break; 4390cdf0e10cSrcweir case ERROR_FIELD_NO_LIKE: aMsg = ERROR_STR_FIELD_NO_LIKE; break; 4391cdf0e10cSrcweir case ERROR_INVALID_COMPARE: aMsg = ERROR_STR_INVALID_COMPARE; break; 4392cdf0e10cSrcweir case ERROR_INVALID_INT_COMPARE: aMsg = ERROR_STR_INVALID_INT_COMPARE; break; 4393cdf0e10cSrcweir case ERROR_INVALID_DATE_COMPARE: aMsg = ERROR_STR_INVALID_DATE_COMPARE; break; 4394cdf0e10cSrcweir case ERROR_INVALID_REAL_COMPARE: aMsg = ERROR_STR_INVALID_REAL_COMPARE; break; 4395cdf0e10cSrcweir case ERROR_INVALID_TABLE: aMsg = ERROR_STR_INVALID_TABLE; break; 4396cdf0e10cSrcweir case ERROR_INVALID_TABLE_OR_QUERY: aMsg = ERROR_STR_INVALID_TABLE_OR_QUERY; break; 4397cdf0e10cSrcweir case ERROR_INVALID_COLUMN: aMsg = ERROR_STR_INVALID_COLUMN; break; 4398cdf0e10cSrcweir case ERROR_INVALID_TABLE_EXIST: aMsg = ERROR_STR_INVALID_TABLE_EXIST; break; 4399cdf0e10cSrcweir case ERROR_INVALID_QUERY_EXIST: aMsg = ERROR_STR_INVALID_QUERY_EXIST; break; 4400cdf0e10cSrcweir default: 4401cdf0e10cSrcweir OSL_ENSURE( false, "OParseContext::getErrorMessage: unknown error code!" ); 4402cdf0e10cSrcweir break; 4403cdf0e10cSrcweir } 4404cdf0e10cSrcweir return aMsg; 4405cdf0e10cSrcweir } 4406cdf0e10cSrcweir 4407cdf0e10cSrcweir //----------------------------------------------------------------------------- 4408cdf0e10cSrcweir ::rtl::OString OParseContext::getIntlKeywordAscii(InternationalKeyCode _eKey) const 4409cdf0e10cSrcweir { 4410cdf0e10cSrcweir ::rtl::OString aKeyword; 4411cdf0e10cSrcweir switch (_eKey) 4412cdf0e10cSrcweir { 4413cdf0e10cSrcweir case KEY_LIKE: aKeyword = KEY_STR_LIKE; break; 4414cdf0e10cSrcweir case KEY_NOT: aKeyword = KEY_STR_NOT; break; 4415cdf0e10cSrcweir case KEY_NULL: aKeyword = KEY_STR_NULL; break; 4416cdf0e10cSrcweir case KEY_TRUE: aKeyword = KEY_STR_TRUE; break; 4417cdf0e10cSrcweir case KEY_FALSE: aKeyword = KEY_STR_FALSE; break; 4418cdf0e10cSrcweir case KEY_IS: aKeyword = KEY_STR_IS; break; 4419cdf0e10cSrcweir case KEY_BETWEEN: aKeyword = KEY_STR_BETWEEN; break; 4420cdf0e10cSrcweir case KEY_OR: aKeyword = KEY_STR_OR; break; 4421cdf0e10cSrcweir case KEY_AND: aKeyword = KEY_STR_AND; break; 4422cdf0e10cSrcweir case KEY_AVG: aKeyword = KEY_STR_AVG; break; 4423cdf0e10cSrcweir case KEY_COUNT: aKeyword = KEY_STR_COUNT; break; 4424cdf0e10cSrcweir case KEY_MAX: aKeyword = KEY_STR_MAX; break; 4425cdf0e10cSrcweir case KEY_MIN: aKeyword = KEY_STR_MIN; break; 4426cdf0e10cSrcweir case KEY_SUM: aKeyword = KEY_STR_SUM; break; 4427cdf0e10cSrcweir case KEY_EVERY: aKeyword = KEY_STR_EVERY; break; 4428cdf0e10cSrcweir case KEY_ANY: aKeyword = KEY_STR_ANY; break; 4429cdf0e10cSrcweir case KEY_SOME: aKeyword = KEY_STR_SOME; break; 4430cdf0e10cSrcweir case KEY_STDDEV_POP: aKeyword = KEY_STR_STDDEV_POP; break; 4431cdf0e10cSrcweir case KEY_STDDEV_SAMP: aKeyword = KEY_STR_STDDEV_SAMP; break; 4432cdf0e10cSrcweir case KEY_VAR_SAMP: aKeyword = KEY_STR_VAR_SAMP; break; 4433cdf0e10cSrcweir case KEY_VAR_POP: aKeyword = KEY_STR_VAR_POP; break; 4434cdf0e10cSrcweir case KEY_COLLECT: aKeyword = KEY_STR_COLLECT; break; 4435cdf0e10cSrcweir case KEY_FUSION: aKeyword = KEY_STR_FUSION; break; 4436cdf0e10cSrcweir case KEY_INTERSECTION:aKeyword = KEY_STR_INTERSECTION; break; 4437cdf0e10cSrcweir case KEY_NONE: break; 4438cdf0e10cSrcweir default: 4439cdf0e10cSrcweir OSL_ENSURE( false, "OParseContext::getIntlKeywordAscii: unknown key!" ); 4440cdf0e10cSrcweir break; 4441cdf0e10cSrcweir } 4442cdf0e10cSrcweir return aKeyword; 4443cdf0e10cSrcweir } 4444cdf0e10cSrcweir 4445cdf0e10cSrcweir //----------------------------------------------------------------------------- 4446cdf0e10cSrcweir IParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ::rtl::OString& rToken) const 4447cdf0e10cSrcweir { 4448cdf0e10cSrcweir static IParseContext::InternationalKeyCode Intl_TokenID[] = 4449cdf0e10cSrcweir { 4450cdf0e10cSrcweir KEY_LIKE, KEY_NOT, KEY_NULL, KEY_TRUE, 4451cdf0e10cSrcweir KEY_FALSE, KEY_IS, KEY_BETWEEN, KEY_OR, 4452cdf0e10cSrcweir KEY_AND, KEY_AVG, KEY_COUNT, KEY_MAX, 4453cdf0e10cSrcweir KEY_MIN, KEY_SUM, KEY_EVERY,KEY_ANY,KEY_SOME, 4454cdf0e10cSrcweir KEY_STDDEV_POP,KEY_STDDEV_SAMP,KEY_VAR_SAMP, 4455cdf0e10cSrcweir KEY_VAR_POP,KEY_COLLECT,KEY_FUSION,KEY_INTERSECTION 4456cdf0e10cSrcweir }; 4457cdf0e10cSrcweir 4458cdf0e10cSrcweir sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0]; 4459cdf0e10cSrcweir for (sal_uInt32 i = 0; i < nCount; i++) 4460cdf0e10cSrcweir { 4461cdf0e10cSrcweir ::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]); 4462cdf0e10cSrcweir if (rToken.equalsIgnoreAsciiCase(aKey)) 4463cdf0e10cSrcweir return Intl_TokenID[i]; 4464cdf0e10cSrcweir } 4465cdf0e10cSrcweir 4466cdf0e10cSrcweir return KEY_NONE; 4467cdf0e10cSrcweir } 4468cdf0e10cSrcweir 4469cdf0e10cSrcweir //------------------------------------------------------------------------------ 4470cdf0e10cSrcweir static Locale& impl_getLocaleInstance( ) 4471cdf0e10cSrcweir { 4472cdf0e10cSrcweir static Locale s_aLocale( 4473cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ), 4474cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "US" ) ), 4475cdf0e10cSrcweir ::rtl::OUString( ) 4476cdf0e10cSrcweir ); 4477cdf0e10cSrcweir return s_aLocale; 4478cdf0e10cSrcweir } 4479cdf0e10cSrcweir 4480cdf0e10cSrcweir //------------------------------------------------------------------------------ 4481cdf0e10cSrcweir void OParseContext::setDefaultLocale( const ::com::sun::star::lang::Locale& _rLocale ) 4482cdf0e10cSrcweir { 4483cdf0e10cSrcweir impl_getLocaleInstance() = _rLocale; 4484cdf0e10cSrcweir } 4485cdf0e10cSrcweir 4486cdf0e10cSrcweir //------------------------------------------------------------------------------ 4487cdf0e10cSrcweir Locale OParseContext::getPreferredLocale( ) const 4488cdf0e10cSrcweir { 4489cdf0e10cSrcweir return getDefaultLocale(); 4490cdf0e10cSrcweir } 4491cdf0e10cSrcweir 4492cdf0e10cSrcweir //------------------------------------------------------------------------------ 4493cdf0e10cSrcweir const Locale& OParseContext::getDefaultLocale() 4494cdf0e10cSrcweir { 4495cdf0e10cSrcweir return impl_getLocaleInstance(); 4496cdf0e10cSrcweir } 4497cdf0e10cSrcweir 4498cdf0e10cSrcweir //========================================================================== 4499cdf0e10cSrcweir //= misc 4500cdf0e10cSrcweir //========================================================================== 4501cdf0e10cSrcweir // Der (leider globale) yylval fuer die Uebergabe von 4502cdf0e10cSrcweir // Werten vom Scanner an den Parser. Die globale Variable 4503cdf0e10cSrcweir // wird nur kurzzeitig verwendet, der Parser liest die Variable 4504cdf0e10cSrcweir // sofort nach dem Scanner-Aufruf in eine gleichnamige eigene 4505cdf0e10cSrcweir // Member-Variable. 4506cdf0e10cSrcweir 4507cdf0e10cSrcweir const double fMilliSecondsPerDay = 86400000.0; 4508cdf0e10cSrcweir 4509cdf0e10cSrcweir //------------------------------------------------------------------------------ 4510cdf0e10cSrcweir 4511cdf0e10cSrcweir 4512cdf0e10cSrcweir //------------------------------------------------------------------ 4513cdf0e10cSrcweir ::rtl::OUString ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational) 4514cdf0e10cSrcweir { 4515cdf0e10cSrcweir ::rtl::OUStringBuffer aMatchStr; 4516cdf0e10cSrcweir if (pTokenNode->isToken()) 4517cdf0e10cSrcweir { 4518cdf0e10cSrcweir sal_Unicode cEscape = 0; 4519cdf0e10cSrcweir if (pEscapeNode->count()) 4520cdf0e10cSrcweir cEscape = pEscapeNode->getChild(1)->getTokenValue().toChar(); 4521cdf0e10cSrcweir 4522cdf0e10cSrcweir // Platzhalter austauschen 4523cdf0e10cSrcweir aMatchStr = pTokenNode->getTokenValue(); 4524cdf0e10cSrcweir const sal_Int32 nLen = aMatchStr.getLength(); 4525cdf0e10cSrcweir ::rtl::OUStringBuffer sSearch,sReplace; 4526cdf0e10cSrcweir if ( bInternational ) 4527cdf0e10cSrcweir { 4528cdf0e10cSrcweir sSearch.appendAscii("%_",2); 4529cdf0e10cSrcweir sReplace.appendAscii("*?",2); 4530cdf0e10cSrcweir } 4531cdf0e10cSrcweir else 4532cdf0e10cSrcweir { 4533cdf0e10cSrcweir sSearch.appendAscii("*?",2); 4534cdf0e10cSrcweir sReplace.appendAscii("%_",2); 4535cdf0e10cSrcweir } 4536cdf0e10cSrcweir 4537cdf0e10cSrcweir for (sal_Int32 i = 0; i < nLen; i++) 4538cdf0e10cSrcweir { 4539cdf0e10cSrcweir const sal_Unicode c = aMatchStr.charAt(i); 4540cdf0e10cSrcweir if (c == sSearch.charAt(0) || c == sSearch.charAt(1)) 4541cdf0e10cSrcweir { 4542cdf0e10cSrcweir if (i > 0 && aMatchStr.charAt(i-1) == cEscape) 4543cdf0e10cSrcweir continue; 4544cdf0e10cSrcweir else 4545cdf0e10cSrcweir { 4546cdf0e10cSrcweir const sal_Unicode cCharacter = sReplace.charAt( (c == sSearch.charAt(0)) ? 0 : 1); 4547cdf0e10cSrcweir aMatchStr.setCharAt(i , cCharacter); 4548cdf0e10cSrcweir } 4549cdf0e10cSrcweir } 4550cdf0e10cSrcweir } 4551cdf0e10cSrcweir } 4552cdf0e10cSrcweir return aMatchStr.makeStringAndClear(); 4553cdf0e10cSrcweir } 4554cdf0e10cSrcweir 4555cdf0e10cSrcweir //========================================================================== 4556cdf0e10cSrcweir //= OSQLParser 4557cdf0e10cSrcweir //========================================================================== 4558cdf0e10cSrcweir 4559cdf0e10cSrcweir sal_uInt32 OSQLParser::s_nRuleIDs[OSQLParseNode::rule_count + 1]; 4560cdf0e10cSrcweir OSQLParser::RuleIDMap OSQLParser::s_aReverseRuleIDLookup; 4561cdf0e10cSrcweir OParseContext OSQLParser::s_aDefaultContext; 4562cdf0e10cSrcweir 4563cdf0e10cSrcweir sal_Int32 OSQLParser::s_nRefCount = 0; 4564cdf0e10cSrcweir // ::osl::Mutex OSQLParser::s_aMutex; 4565cdf0e10cSrcweir OSQLScanner* OSQLParser::s_pScanner = 0; 4566cdf0e10cSrcweir OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = 0; 4567cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> OSQLParser::s_xLocaleData = NULL; 4568cdf0e10cSrcweir //----------------------------------------------------------------------------- 4569cdf0e10cSrcweir void setParser(OSQLParser* _pParser) 4570cdf0e10cSrcweir { 4571cdf0e10cSrcweir xxx_pGLOBAL_SQLPARSER = _pParser; 4572cdf0e10cSrcweir } 4573cdf0e10cSrcweir // ------------------------------------------------------------------------- 4574cdf0e10cSrcweir void OSQLParser::setParseTree(OSQLParseNode * pNewParseTree) 4575cdf0e10cSrcweir { 4576cdf0e10cSrcweir ::osl::MutexGuard aGuard(getMutex()); 4577cdf0e10cSrcweir m_pParseTree = pNewParseTree; 4578cdf0e10cSrcweir } 4579cdf0e10cSrcweir //----------------------------------------------------------------------------- 4580cdf0e10cSrcweir OSQLParseNode* OSQLParser::parseTree(::rtl::OUString& rErrorMessage, 4581cdf0e10cSrcweir const ::rtl::OUString& rStatement, 4582cdf0e10cSrcweir sal_Bool bInternational) 4583cdf0e10cSrcweir { 4584cdf0e10cSrcweir 4585cdf0e10cSrcweir 4586cdf0e10cSrcweir // Guard the parsing 4587cdf0e10cSrcweir ::osl::MutexGuard aGuard(getMutex()); 4588cdf0e10cSrcweir // must be reset 4589cdf0e10cSrcweir setParser(this); 4590cdf0e10cSrcweir 4591cdf0e10cSrcweir // defines how to scan 4592cdf0e10cSrcweir s_pScanner->SetRule(s_pScanner->GetSQLRule()); // initial 4593cdf0e10cSrcweir s_pScanner->prepareScan(rStatement, m_pContext, bInternational); 4594cdf0e10cSrcweir 4595cdf0e10cSrcweir SQLyylval.pParseNode = NULL; 4596cdf0e10cSrcweir // SQLyypvt = NULL; 4597cdf0e10cSrcweir m_pParseTree = NULL; 4598cdf0e10cSrcweir m_sErrorMessage = ::rtl::OUString(); 4599cdf0e10cSrcweir 4600cdf0e10cSrcweir // ... und den Parser anwerfen ... 4601cdf0e10cSrcweir if (SQLyyparse() != 0) 4602cdf0e10cSrcweir { 4603cdf0e10cSrcweir // only set the error message, if it's not already set 4604cdf0e10cSrcweir if (!m_sErrorMessage.getLength()) 4605cdf0e10cSrcweir m_sErrorMessage = s_pScanner->getErrorMessage(); 4606cdf0e10cSrcweir if (!m_sErrorMessage.getLength()) 4607cdf0e10cSrcweir m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_GENERAL); 4608cdf0e10cSrcweir 4609cdf0e10cSrcweir rErrorMessage = m_sErrorMessage; 4610cdf0e10cSrcweir 4611cdf0e10cSrcweir // clear the garbage collector 4612cdf0e10cSrcweir (*s_pGarbageCollector)->clearAndDelete(); 4613cdf0e10cSrcweir return NULL; 4614cdf0e10cSrcweir } 4615cdf0e10cSrcweir else 4616cdf0e10cSrcweir { 4617cdf0e10cSrcweir (*s_pGarbageCollector)->clear(); 4618cdf0e10cSrcweir 4619cdf0e10cSrcweir // Das Ergebnis liefern (den Root Parse Node): 4620cdf0e10cSrcweir 4621cdf0e10cSrcweir // OSL_ENSURE(Sdbyyval.pParseNode != NULL,"OSQLParser: Parser hat keinen ParseNode geliefert"); 4622cdf0e10cSrcweir // return Sdbyyval.pParseNode; 4623cdf0e10cSrcweir // geht nicht wegen Bug in MKS YACC-erzeugtem Code (es wird ein falscher ParseNode 4624cdf0e10cSrcweir // geliefert). 4625cdf0e10cSrcweir 4626cdf0e10cSrcweir // Stattdessen setzt die Parse-Routine jetzt den Member pParseTree 4627cdf0e10cSrcweir // - einfach diesen zurueckliefern: 4628cdf0e10cSrcweir OSL_ENSURE(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); 4629cdf0e10cSrcweir return m_pParseTree; 4630cdf0e10cSrcweir } 4631cdf0e10cSrcweir } 4632cdf0e10cSrcweir //----------------------------------------------------------------------------- 4633cdf0e10cSrcweir ::rtl::OString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pContext) 4634cdf0e10cSrcweir { 4635cdf0e10cSrcweir ::rtl::OString aStr; 4636cdf0e10cSrcweir if (pContext) 4637cdf0e10cSrcweir { 4638cdf0e10cSrcweir IParseContext::InternationalKeyCode eKeyCode = IParseContext::KEY_NONE; 4639cdf0e10cSrcweir switch( nTokenID ) 4640cdf0e10cSrcweir { 4641cdf0e10cSrcweir case SQL_TOKEN_LIKE: eKeyCode = IParseContext::KEY_LIKE; break; 4642cdf0e10cSrcweir case SQL_TOKEN_NOT: eKeyCode = IParseContext::KEY_NOT; break; 4643cdf0e10cSrcweir case SQL_TOKEN_NULL: eKeyCode = IParseContext::KEY_NULL; break; 4644cdf0e10cSrcweir case SQL_TOKEN_TRUE: eKeyCode = IParseContext::KEY_TRUE; break; 4645cdf0e10cSrcweir case SQL_TOKEN_FALSE: eKeyCode = IParseContext::KEY_FALSE; break; 4646cdf0e10cSrcweir case SQL_TOKEN_IS: eKeyCode = IParseContext::KEY_IS; break; 4647cdf0e10cSrcweir case SQL_TOKEN_BETWEEN: eKeyCode = IParseContext::KEY_BETWEEN; break; 4648cdf0e10cSrcweir case SQL_TOKEN_OR: eKeyCode = IParseContext::KEY_OR; break; 4649cdf0e10cSrcweir case SQL_TOKEN_AND: eKeyCode = IParseContext::KEY_AND; break; 4650cdf0e10cSrcweir case SQL_TOKEN_AVG: eKeyCode = IParseContext::KEY_AVG; break; 4651cdf0e10cSrcweir case SQL_TOKEN_COUNT: eKeyCode = IParseContext::KEY_COUNT; break; 4652cdf0e10cSrcweir case SQL_TOKEN_MAX: eKeyCode = IParseContext::KEY_MAX; break; 4653cdf0e10cSrcweir case SQL_TOKEN_MIN: eKeyCode = IParseContext::KEY_MIN; break; 4654cdf0e10cSrcweir case SQL_TOKEN_SUM: eKeyCode = IParseContext::KEY_SUM; break; 4655cdf0e10cSrcweir } 4656cdf0e10cSrcweir if ( eKeyCode != IParseContext::KEY_NONE ) 4657cdf0e10cSrcweir aStr = pContext->getIntlKeywordAscii(eKeyCode); 4658cdf0e10cSrcweir } 4659cdf0e10cSrcweir 4660cdf0e10cSrcweir if (!aStr.getLength()) 4661cdf0e10cSrcweir { 4662cdf0e10cSrcweir aStr = yytname[YYTRANSLATE(nTokenID)]; 4663cdf0e10cSrcweir if(!aStr.compareTo("SQL_TOKEN_",10)) 4664cdf0e10cSrcweir aStr = aStr.copy(10); 4665cdf0e10cSrcweir } 4666cdf0e10cSrcweir return aStr; 4667cdf0e10cSrcweir } 4668cdf0e10cSrcweir 4669cdf0e10cSrcweir //----------------------------------------------------------------------------- 4670cdf0e10cSrcweir ::rtl::OUString OSQLParser::RuleIDToStr(sal_uInt32 nRuleID) 4671cdf0e10cSrcweir { 4672cdf0e10cSrcweir OSL_ENSURE(nRuleID < (sizeof yytname/sizeof yytname[0]), "OSQLParser::RuleIDToStr: Invalid nRuleId!"); 4673cdf0e10cSrcweir return ::rtl::OUString::createFromAscii(yytname[nRuleID]); 4674cdf0e10cSrcweir } 4675cdf0e10cSrcweir 4676cdf0e10cSrcweir //----------------------------------------------------------------------------- 4677cdf0e10cSrcweir sal_uInt32 OSQLParser::StrToRuleID(const ::rtl::OString & rValue) 4678cdf0e10cSrcweir { 4679cdf0e10cSrcweir // In yysvar nach dem angegebenen Namen suchen, den Index zurueckliefern 4680cdf0e10cSrcweir // (oder 0, wenn nicht gefunden) 4681cdf0e10cSrcweir static sal_uInt32 nLen = sizeof(yytname)/sizeof(yytname[0]); 4682cdf0e10cSrcweir for (sal_uInt32 i = YYTRANSLATE(SQL_TOKEN_INVALIDSYMBOL); i < (nLen-1); i++) 4683cdf0e10cSrcweir { 4684cdf0e10cSrcweir if (yytname && rValue == yytname[i]) 4685cdf0e10cSrcweir return i; 4686cdf0e10cSrcweir } 4687cdf0e10cSrcweir 4688cdf0e10cSrcweir // Nicht gefunden 4689cdf0e10cSrcweir return 0; 4690cdf0e10cSrcweir } 4691cdf0e10cSrcweir 4692cdf0e10cSrcweir //----------------------------------------------------------------------------- 4693cdf0e10cSrcweir OSQLParseNode::Rule OSQLParser::RuleIDToRule( sal_uInt32 _nRule ) 4694cdf0e10cSrcweir { 4695cdf0e10cSrcweir return s_aReverseRuleIDLookup[ _nRule ]; 4696cdf0e10cSrcweir } 4697cdf0e10cSrcweir 4698cdf0e10cSrcweir //----------------------------------------------------------------------------- 4699cdf0e10cSrcweir sal_uInt32 OSQLParser::RuleID(OSQLParseNode::Rule eRule) 4700cdf0e10cSrcweir { 4701cdf0e10cSrcweir return s_nRuleIDs[(sal_uInt16)eRule]; 4702cdf0e10cSrcweir } 4703cdf0e10cSrcweir // ------------------------------------------------------------------------- 4704cdf0e10cSrcweir sal_Int16 OSQLParser::buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pCompare,OSQLParseNode* pLiteral,OSQLParseNode* pLiteral2) 4705cdf0e10cSrcweir { 4706cdf0e10cSrcweir OSQLParseNode* pColumnRef = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); 4707cdf0e10cSrcweir pColumnRef->append(new OSQLInternalNode(m_sFieldName,SQL_NODE_NAME)); 4708cdf0e10cSrcweir OSQLParseNode* pComp = NULL; 4709cdf0e10cSrcweir if ( SQL_ISTOKEN( pCompare, BETWEEN) && pLiteral2 ) 4710cdf0e10cSrcweir pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::between_predicate_part_2)); 4711cdf0e10cSrcweir else 4712cdf0e10cSrcweir pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::comparison_predicate)); 4713cdf0e10cSrcweir 4714cdf0e10cSrcweir pComp->append(pColumnRef); 4715cdf0e10cSrcweir pComp->append(pCompare); 4716cdf0e10cSrcweir pComp->append(pLiteral); 4717cdf0e10cSrcweir if ( pLiteral2 ) 4718cdf0e10cSrcweir { 4719cdf0e10cSrcweir pComp->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD,SQL_TOKEN_AND)); 4720cdf0e10cSrcweir pComp->append(pLiteral2); 4721cdf0e10cSrcweir } 4722cdf0e10cSrcweir pAppend->append(pComp); 4723cdf0e10cSrcweir return 1; 4724cdf0e10cSrcweir } 4725cdf0e10cSrcweir //----------------------------------------------------------------------------- 4726cdf0e10cSrcweir sal_Int16 OSQLParser::buildStringNodes(OSQLParseNode*& pLiteral) 4727cdf0e10cSrcweir { 4728cdf0e10cSrcweir if(!pLiteral) 4729cdf0e10cSrcweir return 1; 4730cdf0e10cSrcweir 4731cdf0e10cSrcweir if(SQL_ISRULE(pLiteral,set_fct_spec) || SQL_ISRULE(pLiteral,general_set_fct) || SQL_ISRULE(pLiteral,column_ref) 4732cdf0e10cSrcweir || SQL_ISRULE(pLiteral,subquery)) 4733cdf0e10cSrcweir return 1; // here I have a function that I can't transform into a string 4734cdf0e10cSrcweir 4735cdf0e10cSrcweir if(pLiteral->getNodeType() == SQL_NODE_INTNUM || pLiteral->getNodeType() == SQL_NODE_APPROXNUM || pLiteral->getNodeType() == SQL_NODE_ACCESS_DATE) 4736cdf0e10cSrcweir { 4737cdf0e10cSrcweir OSQLParseNode* pParent = pLiteral->getParent(); 4738cdf0e10cSrcweir 4739cdf0e10cSrcweir OSQLParseNode* pNewNode = new OSQLInternalNode(pLiteral->getTokenValue(), SQL_NODE_STRING); 4740cdf0e10cSrcweir pParent->replace(pLiteral, pNewNode); 4741cdf0e10cSrcweir delete pLiteral; 4742cdf0e10cSrcweir pLiteral = NULL; 4743cdf0e10cSrcweir return 1; 4744cdf0e10cSrcweir } 4745cdf0e10cSrcweir 4746cdf0e10cSrcweir for(sal_uInt32 i=0;i<pLiteral->count();++i) 4747cdf0e10cSrcweir { 4748cdf0e10cSrcweir OSQLParseNode* pChild = pLiteral->getChild(i); 4749cdf0e10cSrcweir buildStringNodes(pChild); 4750cdf0e10cSrcweir } 4751cdf0e10cSrcweir if(SQL_ISRULE(pLiteral,term) || SQL_ISRULE(pLiteral,value_exp_primary)) 4752cdf0e10cSrcweir { 4753cdf0e10cSrcweir m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_COMPARE); 4754cdf0e10cSrcweir return 0; 4755cdf0e10cSrcweir } 4756cdf0e10cSrcweir return 1; 4757cdf0e10cSrcweir } 4758cdf0e10cSrcweir //----------------------------------------------------------------------------- 4759cdf0e10cSrcweir sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral) 4760cdf0e10cSrcweir { 4761cdf0e10cSrcweir OSQLParseNode* pComp = new OSQLInternalNode(::rtl::OUString::createFromAscii("="), SQL_NODE_EQUAL); 4762cdf0e10cSrcweir return buildPredicateRule(pAppend,pLiteral,pComp); 4763cdf0e10cSrcweir } 4764cdf0e10cSrcweir 4765cdf0e10cSrcweir 4766cdf0e10cSrcweir //----------------------------------------------------------------------------- 4767cdf0e10cSrcweir void OSQLParser::reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank) 4768cdf0e10cSrcweir { 4769cdf0e10cSrcweir OSL_ENSURE(pLiteral->isRule(), "This is no ::com::sun::star::chaos::Rule"); 4770cdf0e10cSrcweir OSL_ENSURE(pLiteral->count() == 2, "OSQLParser::ReduceLiteral() Invalid count"); 4771cdf0e10cSrcweir OSQLParseNode* pTemp = pLiteral; 4772cdf0e10cSrcweir ::rtl::OUStringBuffer aValue(pLiteral->getChild(0)->getTokenValue()); 4773cdf0e10cSrcweir if (bAppendBlank) 4774cdf0e10cSrcweir { 4775cdf0e10cSrcweir aValue.appendAscii(" "); 4776cdf0e10cSrcweir } 4777cdf0e10cSrcweir 4778cdf0e10cSrcweir aValue.append(pLiteral->getChild(1)->getTokenValue()); 4779cdf0e10cSrcweir 4780cdf0e10cSrcweir pLiteral = new OSQLInternalNode(aValue.makeStringAndClear(),SQL_NODE_STRING); 4781cdf0e10cSrcweir delete pTemp; 4782cdf0e10cSrcweir } 4783cdf0e10cSrcweir 4784cdf0e10cSrcweir // ------------------------------------------------------------------------- 4785*b135d50bSHerbert Dürr void OSQLParser::error( const sal_Char* fmt) 4786cdf0e10cSrcweir { 4787cdf0e10cSrcweir if(!m_sErrorMessage.getLength()) 4788cdf0e10cSrcweir { 4789cdf0e10cSrcweir ::rtl::OUString sStr(fmt,strlen(fmt),RTL_TEXTENCODING_UTF8); 4790cdf0e10cSrcweir ::rtl::OUString sSQL_TOKEN(::rtl::OUString::createFromAscii("SQL_TOKEN_")); 4791cdf0e10cSrcweir 4792cdf0e10cSrcweir sal_Int32 nPos1 = sStr.indexOf(sSQL_TOKEN); 4793cdf0e10cSrcweir if(nPos1 != -1) 4794cdf0e10cSrcweir { 4795cdf0e10cSrcweir ::rtl::OUString sFirst = sStr.copy(0,nPos1); 4796cdf0e10cSrcweir sal_Int32 nPos2 = sStr.indexOf(sSQL_TOKEN,nPos1+1); 4797cdf0e10cSrcweir if(nPos2 != -1) 4798cdf0e10cSrcweir { 4799cdf0e10cSrcweir ::rtl::OUString sSecond = sStr.copy(nPos1+sSQL_TOKEN.getLength(),nPos2-nPos1-sSQL_TOKEN.getLength()); 4800cdf0e10cSrcweir sFirst += sSecond; 4801cdf0e10cSrcweir sFirst += sStr.copy(nPos2+sSQL_TOKEN.getLength()); 4802cdf0e10cSrcweir } 4803cdf0e10cSrcweir else 4804cdf0e10cSrcweir sFirst += sStr.copy(nPos1+sSQL_TOKEN.getLength()); 4805cdf0e10cSrcweir 4806cdf0e10cSrcweir m_sErrorMessage = sFirst; 4807cdf0e10cSrcweir } 4808cdf0e10cSrcweir else 4809cdf0e10cSrcweir m_sErrorMessage = sStr; 4810cdf0e10cSrcweir 4811cdf0e10cSrcweir ::rtl::OUString aError = s_pScanner->getErrorMessage(); 4812cdf0e10cSrcweir if(aError.getLength()) 4813cdf0e10cSrcweir { 4814cdf0e10cSrcweir m_sErrorMessage += ::rtl::OUString::createFromAscii(", "); 4815cdf0e10cSrcweir m_sErrorMessage += aError; 4816cdf0e10cSrcweir } 4817cdf0e10cSrcweir } 4818cdf0e10cSrcweir } 4819cdf0e10cSrcweir // ------------------------------------------------------------------------- 4820cdf0e10cSrcweir int OSQLParser::SQLlex() 4821cdf0e10cSrcweir { 4822cdf0e10cSrcweir return s_pScanner->SQLlex(); 4823cdf0e10cSrcweir } 4824cdf0e10cSrcweir 4825cdf0e10cSrcweir #if defined __SUNPRO_CC 4826cdf0e10cSrcweir #pragma enable_warn 4827cdf0e10cSrcweir #elif defined _MSC_VER 4828cdf0e10cSrcweir #pragma warning(pop) 4829cdf0e10cSrcweir #endif 4830