diff options
-rw-r--r-- | connectivity/inc/connectivity/sqlnode.hxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcomp.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/parse/sqlbison.y | 459 | ||||
-rw-r--r-- | connectivity/source/parse/sqlflex.l | 27 | ||||
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 16 |
5 files changed, 491 insertions, 17 deletions
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx index 04ec8dc153df..2fe688574a0a 100644 --- a/connectivity/inc/connectivity/sqlnode.hxx +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -65,6 +65,8 @@ namespace rtl { class OUStringBuffer; } +#define ORDER_BY_CHILD_POS 5 +#define TABLE_EXPRESSION_CHILD_COUNT 9 namespace connectivity { diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index eeaec1ff40f1..c5b287164e16 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -99,7 +99,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) OSQLParseNode * pTableExp = pSQLParseNode->getChild(3); DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree"); DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Fehler im Parse Tree"); // check that we don't use anything other than count(*) as function OSQLParseNode* pSelection = pSQLParseNode->getChild(2); @@ -117,7 +117,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) pWhereClause = pTableExp->getChild(1); - pOrderbyClause = pTableExp->getChild(4); + pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS); } else if (SQL_ISRULE(pSQLParseNode,update_statement_searched)) { diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 947da78b8f62..bfea82a25c7c 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -217,6 +217,14 @@ using namespace connectivity; %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 %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 %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 +// window function +%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 +%token <pParseNode> SQL_TOKEN_FIRST_VALUE SQL_TOKEN_LAST_VALUE SQL_TOKEN_NTH_VALUE SQL_TOKEN_FIRST SQL_TOKEN_LAST +%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 +%token <pParseNode> SQL_TOKEN_PARTITION SQL_TOKEN_WINDOW SQL_TOKEN_NO +// LIMIT and OFFSEt +%token <pParseNode> SQL_TOKEN_LIMIT SQL_TOKEN_OFFSET SQL_TOKEN_NEXT SQL_TOKEN_ONLY + /* operators */ %left SQL_TOKEN_NAME %left <pParseNode> SQL_TOKEN_OR @@ -286,6 +294,16 @@ using namespace connectivity; %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 %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 %type <pParseNode> approximate_numeric_type exact_numeric_type opt_paren_precision_scale +/* window function rules */ +%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 +%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 +%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 +%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 +%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 +%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 +%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 +/* LIMIT and OFFSET */ +%type <pParseNode> opt_limit_offset_clause limit_offset_clause opt_fetch_first_clause %% /* Parse Tree an OSQLParser zurueckliefern @@ -920,19 +938,89 @@ selection: } | scalar_exp_commalist ; +opt_result_offset_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | result_offset_clause + ; +result_offset_clause: + SQL_TOKEN_OFFSET offset_row_count row_or_rows + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +opt_fetch_first_row_count: + /* empty */ {$$ = SQL_NEW_RULE;} + | fetch_first_row_count + ; +first_or_next: + SQL_TOKEN_FIRST + | SQL_TOKEN_NEXT + ; +row_or_rows: + SQL_TOKEN_ROW + | SQL_TOKEN_ROWS + ; +opt_fetch_first_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | fetch_first_clause + ; +fetch_first_clause: + SQL_TOKEN_FETCH first_or_next opt_fetch_first_row_count row_or_rows SQL_TOKEN_ONLY + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + ; +offset_row_count: + literal + ; +fetch_first_row_count: + literal + ; +opt_limit_offset_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | limit_offset_clause + ; +opt_offset: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_OFFSET SQL_TOKEN_INTNUM + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +limit_offset_clause: + SQL_TOKEN_LIMIT SQL_TOKEN_INTNUM opt_offset + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; table_exp: - from_clause - opt_where_clause - opt_group_by_clause - opt_having_clause - opt_order_by_clause - {$$ = SQL_NEW_RULE; + 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 + { + $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); $$->append($3); $$->append($4); - $$->append($5);} + $$->append($5); + $$->append($6); + $$->append($7); + $$->append($8); + $$->append($9); + } ; from_clause: @@ -1949,6 +2037,362 @@ numeric_function: SQL_TOKEN_RAND | SQL_TOKEN_TRUNCATE ; + +window_function: + window_function_type SQL_TOKEN_OVER window_name_or_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +window_function_type : + rank_function_type '(' ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_ROW_NUMBER '(' ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | general_set_fct + | ntile_function + | lead_or_lag_function + | first_or_last_value_function + | nth_value_function +; +ntile_function : + SQL_TOKEN_NTILE '(' number_of_tiles ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +dynamic_parameter_specification: + parameter + ; +simple_value_specification: + literal + ; +number_of_tiles : + simple_value_specification + | dynamic_parameter_specification + ; +opt_lead_or_lag_function: + /* empty */ {$$ = SQL_NEW_RULE;} + | ',' offset + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | ',' offset ',' default_expression + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($4); + } + ; +opt_null_treatment: + /* empty */ {$$ = SQL_NEW_RULE;} + | null_treatment + ; + +lead_or_lag_function: + lead_or_lag '(' lead_or_lag_extent opt_lead_or_lag_function ')' opt_null_treatment + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($6); + } + ; +lead_or_lag: + SQL_TOKEN_LEAD + | SQL_TOKEN_LAG + ; +lead_or_lag_extent: + value_exp + ; +offset: + SQL_TOKEN_INTNUM + ; +default_expression: + value_exp + ; +null_treatment: + SQL_TOKEN_RESPECT SQL_TOKEN_NULLS + | SQL_TOKEN_IGNORE SQL_TOKEN_NULLS + ; +first_or_last_value_function: + first_or_last_value '(' value_exp ')' opt_null_treatment + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($5); + } + ; +first_or_last_value : + SQL_TOKEN_FIRST_VALUE + | SQL_TOKEN_LAST_VALUE + ; +opt_from_first_or_last: + /* empty */ {$$ = SQL_NEW_RULE;} + | from_first_or_last + ; +nth_value_function: + SQL_TOKEN_NTH_VALUE '(' value_exp ',' nth_row ')' opt_from_first_or_last opt_null_treatment + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($7); + $$->append($8); + } + ; +nth_row: + simple_value_specification + | dynamic_parameter_specification + ; +from_first_or_last: + SQL_TOKEN_FROM SQL_TOKEN_FIRST + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_FROM SQL_TOKEN_LAST + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_name: + SQL_TOKEN_NAME + ; +window_name_or_specification: + window_name + | in_line_window_specification + ; +in_line_window_specification: + window_specification + ; +opt_window_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_clause + ; +window_clause: + SQL_TOKEN_WINDOW window_definition_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_definition_list: + window_definition_list ',' window_definition + {$1->append($3); + $$ = $1;} + | window_definition + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + ; +window_definition: + new_window_name SQL_TOKEN_AS window_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +new_window_name: + window_name + ; +window_specification: + '(' window_specification_details ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +opt_existing_window_name: + /* empty */ {$$ = SQL_NEW_RULE;} + | existing_window_name + ; +opt_window_partition_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_partition_clause + ; +opt_window_frame_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_frame_clause + ; +window_specification_details: + opt_existing_window_name + opt_window_partition_clause + opt_order_by_clause + opt_window_frame_clause + ; +existing_window_name: + window_name + ; +window_partition_clause: + SQL_TOKEN_PARTITION SQL_TOKEN_BY window_partition_column_reference_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +window_partition_column_reference_list: + window_partition_column_reference_list ',' window_partition_column_reference + {$1->append($3); + $$ = $1;} + | window_partition_column_reference + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + ; +window_partition_column_reference: + column_ref opt_collate_clause + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +opt_window_frame_exclusion: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_frame_exclusion + ; +window_frame_clause: + window_frame_units window_frame_extent opt_window_frame_exclusion + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +window_frame_units: + SQL_TOKEN_ROWS + | SQL_TOKEN_RANGE + ; +window_frame_extent: + window_frame_start + | window_frame_between + ; +window_frame_start: + SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | window_frame_preceding + | SQL_TOKEN_CURRENT SQL_TOKEN_ROW + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_frame_preceding: + unsigned_value_spec SQL_TOKEN_PRECEDING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_frame_between: + SQL_TOKEN_BETWEEN window_frame_bound_1 SQL_TOKEN_AND window_frame_bound_2 + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +window_frame_bound_1: + window_frame_bound + ; +window_frame_bound_2: + window_frame_bound + ; +window_frame_bound: + window_frame_start + | SQL_TOKEN_UNBOUNDED SQL_TOKEN_FOLLOWING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | window_frame_following + ; +window_frame_following: + unsigned_value_spec SQL_TOKEN_FOLLOWING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_frame_exclusion: + SQL_TOKEN_EXCLUDE SQL_TOKEN_CURRENT SQL_TOKEN_ROW + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_EXCLUDE SQL_TOKEN_GROUP + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_EXCLUDE SQL_TOKEN_TIES + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_EXCLUDE SQL_TOKEN_NO SQL_TOKEN_OTHERS + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; op_parameter: {$$ = SQL_NEW_RULE;} | '?' SQL_EQUAL @@ -2313,6 +2757,7 @@ value_exp_primary: | set_fct_spec | scalar_subquery | case_expression + | window_function | '(' value_exp ')' { $$ = SQL_NEW_RULE; diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index c6723dfd6869..35a9278a8e49 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -212,15 +212,19 @@ END {SQL_NEW_KEYWORD(SQL_TOKEN_END); } EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); } ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); } EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); } +EXCLUDE {SQL_NEW_KEYWORD(SQL_TOKEN_EXCLUDE); } EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); } EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); } EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); } FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); } FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); } +FIRST {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST); } +FIRST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST_VALUE); } FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); } FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); } FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); } +FOLLOWING {SQL_NEW_KEYWORD(SQL_TOKEN_FOLLOWING); } FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); } FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); } FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); } @@ -234,6 +238,7 @@ GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); } HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); } HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); } +IGNORE {SQL_NEW_KEYWORD(SQL_TOKEN_IGNORE); } IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); } INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); } INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); } @@ -249,12 +254,17 @@ JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); } KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); } +LAG {SQL_NEW_KEYWORD(SQL_TOKEN_LAG); } LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); } +LAST {SQL_NEW_KEYWORD(SQL_TOKEN_LAST); } +LAST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_LAST_VALUE); } LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); } +LEAD {SQL_NEW_KEYWORD(SQL_TOKEN_LEAD); } LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); } LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); } LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); } LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); } +LIMIT {SQL_NEW_KEYWORD(SQL_TOKEN_LIMIT); } LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); } LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); } LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); } @@ -276,29 +286,40 @@ NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); } NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); } NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); } NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); } +NEXT {SQL_NEW_KEYWORD(SQL_TOKEN_NEXT); } +NO {SQL_NEW_KEYWORD(SQL_TOKEN_NO); } NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); } NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); } +NTH_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_NTH_VALUE); } +NTILE {SQL_NEW_KEYWORD(SQL_TOKEN_NTILE); } NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); } NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); } +NULLS {SQL_NEW_KEYWORD(SQL_TOKEN_NULLS); } NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); } OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); } OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); } OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); } +OFFSET {SQL_NEW_KEYWORD(SQL_TOKEN_OFFSET); } OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); } OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); } ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); } +ONLY {SQL_NEW_KEYWORD(SQL_TOKEN_ONLY); } OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); } OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); } ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); } +OTHERS {SQL_NEW_KEYWORD(SQL_TOKEN_OTHERS); } OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); } +OVER {SQL_NEW_KEYWORD(SQL_TOKEN_OVER); } +PARTITION {SQL_NEW_KEYWORD(SQL_TOKEN_PARTITION); } PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); } PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); } PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); } PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); } POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); } POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); } +PRECEDING {SQL_NEW_KEYWORD(SQL_TOKEN_PRECEDING); } PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); } PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); } PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); } @@ -309,16 +330,20 @@ QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); } RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); } RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); } +RANGE {SQL_NEW_KEYWORD(SQL_TOKEN_RANGE); } RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); } REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); } REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); } REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); } REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); } REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); } +RESPECT {SQL_NEW_KEYWORD(SQL_TOKEN_RESPECT); } ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); } ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); } ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); } ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); } +ROWS {SQL_NEW_KEYWORD(SQL_TOKEN_ROWS); } +ROW_NUMBER {SQL_NEW_KEYWORD(SQL_TOKEN_ROW_NUMBER); } RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); } RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); } @@ -345,6 +370,7 @@ SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); } TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); } TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); } THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); } +TIES {SQL_NEW_KEYWORD(SQL_TOKEN_TIES); } TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); } TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); } TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); } @@ -363,6 +389,7 @@ TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); } T {SQL_NEW_KEYWORD(SQL_TOKEN_T); } UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); } +UNBOUNDED {SQL_NEW_KEYWORD(SQL_TOKEN_UNBOUNDED); } UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); } UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); } UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); } diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 34ba49566383..58d0330a2f29 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1068,9 +1068,9 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo OSQLParseNode * pTableExp = pSelectNode->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); - sal_uInt32 nPos = ( _bOrder ? 4 : 2 ); + sal_uInt32 nPos = ( _bOrder ? ORDER_BY_CHILD_POS : 2 ); OSQLParseNode * pOptByClause = pTableExp->getChild(nPos); OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!"); @@ -1233,7 +1233,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele OSQLParseNode * pTableExp = pSelectNode->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pWhereClause = pTableExp->getChild(1); } else if (SQL_ISRULE(pSelectNode,update_statement_searched)) { @@ -1967,7 +1967,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pWhereClause = pTableExp->getChild(1); } @@ -1997,9 +1997,9 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); - pOrderClause = pTableExp->getChild(4); + pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: if(pOrderClause->count() != 3) pOrderClause = NULL; @@ -2019,7 +2019,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pGroupClause = pTableExp->getChild(2); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: @@ -2040,7 +2040,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pHavingClause = pTableExp->getChild(3); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: |