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