diff options
Diffstat (limited to 'connectivity/source/parse')
-rw-r--r-- | connectivity/source/parse/PColumn.cxx | 70 | ||||
-rw-r--r-- | connectivity/source/parse/sqlbison.y | 1140 | ||||
-rw-r--r-- | connectivity/source/parse/sqlflex.l | 539 | ||||
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 32 | ||||
-rw-r--r-- | connectivity/source/parse/sqlnode.cxx | 6 |
5 files changed, 1293 insertions, 494 deletions
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index e8baf187eef7..0134c1a3aab3 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -45,12 +45,14 @@ using namespace connectivity::parse; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; // ------------------------------------------------------------------------- OParseColumn::OParseColumn(const Reference<XPropertySet>& _xColumn,sal_Bool _bCase) : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) @@ -72,6 +74,7 @@ OParseColumn::OParseColumn(const Reference<XPropertySet>& _xColumn,sal_Bool OParseColumn::OParseColumn( const ::rtl::OUString& _Name, const ::rtl::OUString& _TypeName, const ::rtl::OUString& _DefaultValue, + const ::rtl::OUString& _Description, sal_Int32 _IsNullable, sal_Int32 _Precision, sal_Int32 _Scale, @@ -82,6 +85,7 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, ) : connectivity::sdbcx::OColumn(_Name, _TypeName, _DefaultValue, + _Description, _IsNullable, _Precision, _Scale, @@ -100,25 +104,52 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, // ------------------------------------------------------------------------- ::vos::ORef< OSQLColumns > OParseColumn::createColumnsForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData, - const Reference< XDatabaseMetaData >& _rxDBMetaData ) + const Reference< XDatabaseMetaData >& _rxDBMetaData,const Reference< XNameAccess>& i_xQueryColumns ) { sal_Int32 nColumnCount = _rxResMetaData->getColumnCount(); ::vos::ORef< OSQLColumns > aReturn( new OSQLColumns ); aReturn->get().reserve( nColumnCount ); + StringMap aColumnMap; for ( sal_Int32 i = 1; i <= nColumnCount; ++i ) - aReturn->get().push_back( createColumnForResultSet( _rxResMetaData, _rxDBMetaData, i ) ); + { + OParseColumn* pColumn = createColumnForResultSet( _rxResMetaData, _rxDBMetaData, i,aColumnMap ); + aReturn->get().push_back( pColumn ); + if ( i_xQueryColumns.is() && i_xQueryColumns->hasByName(pColumn->getRealName()) ) + { + Reference<XPropertySet> xColumn(i_xQueryColumns->getByName(pColumn->getRealName()),UNO_QUERY_THROW); + ::rtl::OUString sLabel; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_LABEL)) >>= sLabel; + if ( sLabel.getLength() ) + pColumn->setLabel(sLabel); + } + } return aReturn; } // ------------------------------------------------------------------------- OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData, - const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos ) + const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos,StringMap& _rColumns ) { + ::rtl::OUString sLabel = _rxResMetaData->getColumnLabel( _nColumnPos ); + // retrieve the name of the column + // check for duplicate entries + if(_rColumns.find(sLabel) != _rColumns.end()) + { + ::rtl::OUString sAlias(sLabel); + sal_Int32 searchIndex=1; + while(_rColumns.find(sAlias) != _rColumns.end()) + { + (sAlias = sLabel) += ::rtl::OUString::valueOf(searchIndex++); + } + sLabel = sAlias; + } + _rColumns.insert(StringMap::value_type(sLabel,0)); OParseColumn* pColumn = new OParseColumn( - _rxResMetaData->getColumnLabel( _nColumnPos ), + sLabel, _rxResMetaData->getColumnTypeName( _nColumnPos ), ::rtl::OUString(), + ::rtl::OUString(), _rxResMetaData->isNullable( _nColumnPos ), _rxResMetaData->getPrecision( _nColumnPos ), _rxResMetaData->getScale( _nColumnPos ), @@ -136,6 +167,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe ) ); pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) ); pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos )); + pColumn->setLabel(sLabel); return pColumn; } @@ -152,7 +184,7 @@ void OParseColumn::construct() registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME), PROPERTY_ID_REALNAME, 0, &m_aRealName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DBASEPRECISIONCHANGED), PROPERTY_ID_DBASEPRECISIONCHANGED, 0, &m_bDbasePrecisionChanged, ::getCppuType(reinterpret_cast<sal_Bool*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISSEARCHABLE), PROPERTY_ID_ISSEARCHABLE, 0, &m_bIsSearchable, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); - + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_LABEL), PROPERTY_ID_LABEL, 0, &m_sLabel, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OParseColumn::createArrayHelper() const @@ -172,6 +204,7 @@ OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) @@ -186,33 +219,6 @@ OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn construct(); } // ------------------------------------------------------------------------- -OOrderColumn::OOrderColumn( const ::rtl::OUString& _Name, - const ::rtl::OUString& _TypeName, - const ::rtl::OUString& _DefaultValue, - sal_Int32 _IsNullable, - sal_Int32 _Precision, - sal_Int32 _Scale, - sal_Int32 _Type, - sal_Bool _IsAutoIncrement, - sal_Bool _IsCurrency, - sal_Bool _bCase - ,sal_Bool _bAscending - ) : connectivity::sdbcx::OColumn(_Name, - _TypeName, - _DefaultValue, - _IsNullable, - _Precision, - _Scale, - _Type, - _IsAutoIncrement, - sal_False, - _IsCurrency, - _bCase) - , m_bAscending(_bAscending) -{ - construct(); -} -// ------------------------------------------------------------------------- OOrderColumn::~OOrderColumn() { } diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 1680516e8dc0..35a7177ad853 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -149,7 +149,7 @@ using namespace connectivity; %union { connectivity::OSQLParseNode * pParseNode; } -%type <pParseNode> '(' ')' ',' ':' ';' '?' '[' ']' '{' '}' '.' +%type <pParseNode> '(' ')' ',' ':' ';' '?' '[' ']' '{' '}' '.' 'K' 'M' 'G' 'T' 'P' %token <pParseNode> SQL_TOKEN_STRING SQL_TOKEN_ACCESS_DATE SQL_TOKEN_INT SQL_TOKEN_REAL_NUM %token <pParseNode> SQL_TOKEN_INTNUM SQL_TOKEN_APPROXNUM SQL_TOKEN_NOT SQL_TOKEN_NAME @@ -192,7 +192,7 @@ using namespace connectivity; /* ODBC KEYWORDS */ %token <pParseNode> SQL_TOKEN_CALL SQL_TOKEN_D SQL_TOKEN_FN SQL_TOKEN_T SQL_TOKEN_TS SQL_TOKEN_OJ /* string functions */ -%token <pParseNode> SQL_TOKEN_ASCII SQL_TOKEN_BIT_LENGTH SQL_TOKEN_CHAR SQL_TOKEN_CHAR_LENGTH SQL_TOKEN_CHARACTER_LENGTH +%token <pParseNode> SQL_TOKEN_ASCII SQL_TOKEN_BIT_LENGTH SQL_TOKEN_CHAR SQL_TOKEN_CHAR_LENGTH SQL_TOKEN_SQL_TOKEN_INTNUM %token <pParseNode> SQL_TOKEN_CONCAT %token <pParseNode> SQL_TOKEN_DIFFERENCE SQL_TOKEN_INSERT SQL_TOKEN_LCASE SQL_TOKEN_LEFT SQL_TOKEN_LENGTH SQL_TOKEN_LOCATE %token <pParseNode> SQL_TOKEN_LOCATE_2 SQL_TOKEN_LTRIM SQL_TOKEN_POSITION SQL_TOKEN_REPEAT SQL_TOKEN_REPLACE @@ -214,6 +214,13 @@ using namespace connectivity; %token <pParseNode> SQL_TOKEN_EVERY SQL_TOKEN_INTERSECTION SQL_TOKEN_FUSION SQL_TOKEN_COLLECT SQL_TOKEN_VAR_POP SQL_TOKEN_VAR_SAMP %token <pParseNode> SQL_TOKEN_STDDEV_SAMP SQL_TOKEN_STDDEV_POP +%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 +%token <pParseNode> SQL_TOKEN_CASE SQL_TOKEN_THEN SQL_TOKEN_END SQL_TOKEN_NULLIF SQL_TOKEN_COALESCE SQL_TOKEN_WHEN SQL_TOKEN_ELSE +%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 +%token <pParseNode> SQL_TOKEN_NEW SQL_TOKEN_OLD +%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 /* operators */ %left SQL_TOKEN_NAME %left <pParseNode> SQL_TOKEN_OR @@ -246,10 +253,10 @@ using namespace connectivity; %type <pParseNode> update_statement_searched target_commalist target opt_where_clause %type <pParseNode> select_statement selection table_exp from_clause table_ref_commalist table_ref %type <pParseNode> where_clause opt_group_by_clause column_ref_commalist opt_having_clause -%type <pParseNode> search_condition predicate comparison_predicate between_predicate -%type <pParseNode> like_predicate opt_escape test_for_null in_predicate -%type <pParseNode> all_or_any_predicate any_all_some existence_test subquery -%type <pParseNode> scalar_exp_commalist parameter_ref literal +%type <pParseNode> search_condition predicate comparison_predicate comparison_predicate_part_2 between_predicate between_predicate_part_2 +%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 +%type <pParseNode> all_or_any_predicate any_all_some existence_test subquery quantified_comparison_predicate_part_2 +%type <pParseNode> scalar_exp_commalist parameter_ref literal parenthesized_boolean_value_expression %type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/ /* neue Regeln bei OJ */ %type <pParseNode> derived_column as_clause table_name num_primary term num_value_exp @@ -261,8 +268,8 @@ using namespace connectivity; %type <pParseNode> qualified_join value_exp query_term join_type outer_join_type join_condition boolean_term %type <pParseNode> boolean_factor truth_value boolean_test boolean_primary named_columns_join join_spec %type <pParseNode> cast_operand cast_target factor datetime_value_exp /*interval_value_exp*/ datetime_term datetime_factor -%type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ /*interval_qualifier*/ -%type <pParseNode> /*start_field*/ non_second_datetime_field /*end_field*/ /*single_datetime_field*/ extract_field datetime_field time_zone_field +%type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ interval_qualifier +%type <pParseNode> start_field non_second_datetime_field end_field single_datetime_field extract_field datetime_field time_zone_field %type <pParseNode> extract_source char_length_exp octet_length_exp bit_length_exp select_sublist string_value_exp %type <pParseNode> char_value_exp concatenation char_factor char_primary string_value_fct char_substring_fct fold %type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist @@ -274,6 +281,15 @@ using namespace connectivity; %type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement %type <pParseNode> op_odbc_call_parameter odbc_parameter_commalist odbc_parameter function_args_commalist function_arg %type <pParseNode> catalog_name schema_name table_node numeric_function string_function function_name date_function table_primary_as_range_column opt_as +%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 +%type <pParseNode> case_expression else_clause result_expression result case_abbreviation case_specification searched_when_clause simple_when_clause searched_case simple_case +%type <pParseNode> when_operand_list when_operand case_operand +%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 +%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 +%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 +%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 %% /* Parse Tree an OSQLParser zurueckliefern @@ -286,25 +302,20 @@ sql_single_statement: | sql ';' { xxx_pGLOBAL_SQLPARSER->setParseTree( $1 ); } ; -/* -sql_list: - sql_ ';' - {$$ = SQL_NEW_LISTRULE; - $$->append($1); - pSqlParseTreeRoot = $1; -- obsolete - Ergebnis in yyval! rdm } - | sql_list sql ';' - {$1->append($2); - $$ = $1;} - ; -*/ - /* schema definition language */ /* Note: other ``sql:sal_Unicode() rules appear later in the grammar */ -/*** + sql: - schema + manipulative_statement + | schema_element + { + $$ = SQL_NEW_RULE; + $$->append($1); + } ; + +/*** op_authorization: {$$ = SQL_NEW_RULE;} @@ -340,7 +351,7 @@ schema: ; opt_schema_element_list: - /* empty * / {$$ = SQL_NEW_RULE;} + {$$ = SQL_NEW_RULE;} | schema_glement_list ; @@ -353,17 +364,12 @@ schema_element_list: $$ = $1;} ; */ -sql: - schema_element - {$$ = SQL_NEW_RULE; - $$->append($1); - } - ; schema_element: base_table_def | view_def | privilege_def + | trigger_definition ; base_table_def: @@ -680,9 +686,6 @@ sql_not: /* manipulative statements */ -sql: manipulative_statement - ; - manipulative_statement: commit_statement /* | delete_statement_positioned*/ @@ -957,6 +960,10 @@ opt_as: /* empty */ {$$ = SQL_NEW_RULE;} | SQL_TOKEN_AS ; +opt_row: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ROW + ; table_primary_as_range_column: {$$ = SQL_NEW_RULE;} | opt_as SQL_TOKEN_NAME op_column_commalist @@ -1077,7 +1084,15 @@ boolean_primary: YYERROR; } ; - +parenthesized_boolean_value_expression: + '(' search_condition ')' + { // boolean_primary: rule 2 + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; boolean_test: boolean_primary | boolean_primary SQL_TOKEN_IS sql_not truth_value @@ -1128,7 +1143,13 @@ predicate: | in_predicate | like_predicate ; - +comparison_predicate_part_2: + comparison row_value_constructor + { + $$ = SQL_NEW_RULE; // comparison_predicate: rule 1 + $$->append($1); + $$->append($2); + } comparison_predicate: row_value_constructor comparison row_value_constructor { @@ -1169,23 +1190,14 @@ comparison: | SQL_LESSEQ | SQL_GREATEQ ; -between_predicate: - row_value_constructor sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor - {$$ = SQL_NEW_RULE; // between_predicate: rule 1 - $$->append($1); - $$->append($2); - $$->append($3); - $$->append($4); - $$->append($5); - $$->append($6); - } - | sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor +between_predicate_part_2: + sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // between_predicate: rule 2 { $$ = SQL_NEW_RULE; - sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildPredicateRule($$,$3,$2,$5); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildPredicateRule($$,$2,$1,$4); if(nErg == 1) { OSQLParseNode* pTemp = $$; @@ -1201,46 +1213,58 @@ between_predicate: } } else - YYERROR; + { + $$ = SQL_NEW_RULE; // between_predicate: rule 1 + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + } +between_predicate: + row_value_constructor between_predicate_part_2 + { + $$ = SQL_NEW_RULE; // between_predicate: rule 1 + $$->append($1); + $$->append($2); } + | between_predicate_part_2 ; - -like_predicate: - row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE string_value_exp opt_escape +character_like_predicate_part_2: + sql_not SQL_TOKEN_LIKE string_value_exp opt_escape { $$ = SQL_NEW_RULE; // like_predicate: rule 1 $$->append($1); $$->append($2); $$->append($3); $$->append($4); - $$->append($5); } - | row_value_constructor SQL_TOKEN_LIKE string_value_exp opt_escape + ; +other_like_predicate_part_2: + sql_not SQL_TOKEN_LIKE value_exp_primary opt_escape { - $$ = SQL_NEW_RULE; // like_predicate: rule 2 + $$ = SQL_NEW_RULE; // like_predicate: rule 1 $$->append($1); $$->append($2); $$->append($3); $$->append($4); } - | row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE value_exp_primary opt_escape + ; +like_predicate: + row_value_constructor character_like_predicate_part_2 { - $$ = SQL_NEW_RULE; // like_predicate: rule 3 + $$ = SQL_NEW_RULE; // like_predicate: rule 1 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); - $$->append($5); } - | row_value_constructor SQL_TOKEN_LIKE value_exp_primary opt_escape + | row_value_constructor other_like_predicate_part_2 { - $$ = SQL_NEW_RULE; // like_predicate: rule 4 + $$ = SQL_NEW_RULE; // like_predicate: rule 3 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | sql_not SQL_TOKEN_LIKE string_value_exp opt_escape + | character_like_predicate_part_2 { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 5 { @@ -1250,10 +1274,8 @@ like_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$3,$4)) - $$->append($4); - else + OSQLParseNode* p2nd = $1->getChild(2); + if ( !xxx_pGLOBAL_SQLPARSER->buildLikeRule($1,p2nd,$1->getChild(3)) ) { delete $$; YYABORT; @@ -1262,7 +1284,7 @@ like_predicate: else YYERROR; } - | sql_not SQL_TOKEN_LIKE value_exp_primary opt_escape + | other_like_predicate_part_2 { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 6 { @@ -1272,10 +1294,8 @@ like_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$3,$4)) - $$->append($4); - else + OSQLParseNode* p2nd = $1->getChild(2); + if ( !xxx_pGLOBAL_SQLPARSER->buildLikeRule($1,p2nd,$1->getChild(3)) ) { delete $$; YYABORT; @@ -1302,16 +1322,23 @@ opt_escape: } ; +null_predicate_part_2: + SQL_TOKEN_IS sql_not SQL_TOKEN_NULL + { + $$ = SQL_NEW_RULE; // test_for_null: rule 1 + $$->append($1); + $$->append($2); + $$->append($3); + } + ; test_for_null: - row_value_constructor SQL_TOKEN_IS sql_not truth_value + row_value_constructor null_predicate_part_2 { $$ = SQL_NEW_RULE; // test_for_null: rule 1 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | SQL_TOKEN_IS sql_not truth_value + | null_predicate_part_2 { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// test_for_null: rule 2 { @@ -1321,8 +1348,6 @@ test_for_null: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - $$->append($3); } else YYERROR; @@ -1340,16 +1365,23 @@ in_predicate_value: $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); } ; +in_predicate_part_2: + sql_not SQL_TOKEN_IN in_predicate_value + { + $$ = SQL_NEW_RULE;// in_predicate: rule 1 + $$->append($1); + $$->append($2); + $$->append($3); + } + ; in_predicate: - row_value_constructor sql_not SQL_TOKEN_IN in_predicate_value + row_value_constructor in_predicate_part_2 { $$ = SQL_NEW_RULE;// in_predicate: rule 1 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | sql_not SQL_TOKEN_IN in_predicate_value + | in_predicate_part_2 { if ( xxx_pGLOBAL_SQLPARSER->inPredicateCheck() )// in_predicate: rule 2 { @@ -1359,24 +1391,28 @@ in_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - $$->append($3); - // hello } else YYERROR; } ; +quantified_comparison_predicate_part_2: + comparison any_all_some subquery + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; all_or_any_predicate: - row_value_constructor comparison any_all_some subquery + row_value_constructor quantified_comparison_predicate_part_2 { $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | comparison any_all_some subquery + | quantified_comparison_predicate_part_2 { if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) { @@ -1386,8 +1422,6 @@ all_or_any_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - $$->append($3); } else YYERROR; @@ -1580,7 +1614,7 @@ char_length_exp: $$->append($3); $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); } - | SQL_TOKEN_CHARACTER_LENGTH '(' value_exp ')' + | SQL_TOKEN_SQL_TOKEN_INTNUM '(' value_exp ')' { $$ = SQL_NEW_RULE; $$->append($1); @@ -1686,10 +1720,19 @@ unsigned_value_spec: ; general_value_spec: parameter - | SQL_TOKEN_USER - | SQL_TOKEN_NULL - | SQL_TOKEN_FALSE - | SQL_TOKEN_TRUE + | SQL_TOKEN_USER + /* | SQL_TOKEN_NULL*/ + | SQL_TOKEN_FALSE + | SQL_TOKEN_TRUE + | 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 + | SQL_TOKEN_SESSION_USER + | SQL_TOKEN_SYSTEM_USER ; set_fct_spec: general_set_fct @@ -1966,7 +2009,7 @@ odbc_fct_type: ; general_set_fct: - set_fct_type '(' opt_all_distinct value_exp ')' + set_fct_type '(' opt_all_distinct function_arg ')' { $$ = SQL_NEW_RULE; $$->append($1); @@ -1983,7 +2026,7 @@ general_set_fct: $$->append($3 = newNode("*", SQL_NODE_PUNCTUATION)); $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); } - | SQL_TOKEN_COUNT '(' opt_all_distinct value_exp ')' + | SQL_TOKEN_COUNT '(' opt_all_distinct function_arg ')' { $$ = SQL_NEW_RULE; $$->append($1); @@ -1992,6 +2035,8 @@ general_set_fct: $$->append($4); $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); } + | ordered_set_function + | array_aggregate_function ; set_fct_type: SQL_TOKEN_AVG @@ -2010,6 +2055,87 @@ set_fct_type: | SQL_TOKEN_INTERSECTION ; +ordered_set_function: + hypothetical_set_function + | inverse_distribution_function + ; +hypothetical_set_function: + rank_function_type '(' hypothetical_set_function_value_expression_list ')' within_group_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($5); + } + | rank_function_type '(' hypothetical_set_function_value_expression_list SQL_TOKEN_BY value_exp_commalist ')' within_group_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($7); + } + ; + +within_group_specification: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_WITHIN SQL_TOKEN_GROUP '(' opt_order_by_clause ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +hypothetical_set_function_value_expression_list: + value_exp_commalist + ; + +inverse_distribution_function: + inverse_distribution_function_type '('inverse_distribution_function_argument ')' within_group_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +inverse_distribution_function_argument: + num_value_exp + ; +inverse_distribution_function_type: + SQL_TOKEN_PERCENTILE_CONT + | SQL_TOKEN_PERCENTILE_DISC + ; + +array_aggregate_function: + SQL_TOKEN_ARRAY_AGG '(' value_exp opt_order_by_clause ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; + +rank_function_type: + SQL_TOKEN_RANK + | SQL_TOKEN_DENSE_RANK + | SQL_TOKEN_PERCENT_RANK + | SQL_TOKEN_CUME_DIST + ; outer_join_type: SQL_TOKEN_LEFT %prec SQL_TOKEN_LEFT { @@ -2055,7 +2181,7 @@ join_type: } ; cross_union: - table_ref /*[SQL_TOKEN_CROSS]*/ SQL_TOKEN_CROSS SQL_TOKEN_JOIN table_ref + table_ref SQL_TOKEN_CROSS SQL_TOKEN_JOIN table_ref { $$ = SQL_NEW_RULE; $$->append($1); @@ -2067,7 +2193,7 @@ cross_union: qualified_join: /* wenn SQL_TOKEN_NATURAL, dann keine join_spec */ - table_ref /*[SQL_TOKEN_NATURAL]*/ SQL_TOKEN_NATURAL join_type SQL_TOKEN_JOIN table_ref + table_ref SQL_TOKEN_NATURAL join_type SQL_TOKEN_JOIN table_ref { $$ = SQL_NEW_RULE; $$->append($1); @@ -2182,6 +2308,7 @@ value_exp_primary: | column_ref | set_fct_spec | scalar_subquery + | case_expression | '(' value_exp ')' { $$ = SQL_NEW_RULE; @@ -2405,83 +2532,39 @@ non_second_datetime_field: | SQL_TOKEN_HOUR | SQL_TOKEN_MINUTE ; -/*start_field: - non_second_datetime_field +start_field: + non_second_datetime_field opt_paren_precision { $$ = SQL_NEW_RULE; $$->append($1); - } - | non_second_datetime_field '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($2); } ; end_field: non_second_datetime_field + | SQL_TOKEN_SECOND opt_paren_precision { $$ = SQL_NEW_RULE; $$->append($1); - } - | SQL_TOKEN_SECOND - { - $$ = SQL_NEW_RULE; - $$->append($1); - } - | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($2); } ; -*/ -/* + single_datetime_field: - non_second_datetime_field + non_second_datetime_field opt_paren_precision { $$ = SQL_NEW_RULE; $$->append($1); + $$->append($2); } - | non_second_datetime_field '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); - } - | SQL_TOKEN_SECOND - { - $$ = SQL_NEW_RULE; - $$->append($1); - } - | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); - } - | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + | SQL_TOKEN_SECOND opt_paren_precision_scale { $$ = 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($2); } ; -*/ -/* + interval_qualifier: start_field SQL_TOKEN_TO end_field { @@ -2490,13 +2573,9 @@ interval_qualifier: $$->append($2); $$->append($3); } - | single_datetime_field - { - $$ = SQL_NEW_RULE; - $$->append($1); - } + | single_datetime_field ; -*/ + function_arg_commalist2: function_arg ',' function_arg {$$ = SQL_NEW_COMMALISTRULE; @@ -2550,6 +2629,21 @@ function_arg: $$->append($2); $$->append($3); } + | value_exp SQL_TOKEN_USING value_exp comparison value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | value_exp SQL_TOKEN_BY value_exp_commalist + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } ; function_args_commalist: function_arg @@ -2956,59 +3050,384 @@ column_val: } ; data_type: - SQL_TOKEN_CHARACTER - | SQL_TOKEN_CHARACTER '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + predefined_type + ; +opt_char_set_spec: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_CHARACTER SQL_TOKEN_SET SQL_TOKEN_NAME + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_NUMERIC - | SQL_TOKEN_NUMERIC '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + ; +opt_collate_clause: + {$$ = SQL_NEW_RULE;} + | collate_clause + ; +predefined_type: + character_string_type opt_char_set_spec opt_collate_clause + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_NUMERIC '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | national_character_string_type opt_collate_clause + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | binary_string_type + | numeric_type + | boolean_type + | datetime_type + | interval_type + ; +character_string_type: + SQL_TOKEN_CHARACTER opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_CHAR opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_CHARACTER SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); $$->append($3); - $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); - $$->append($5); - $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_DECIMAL - | SQL_TOKEN_DECIMAL '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | SQL_TOKEN_CHAR SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_DECIMAL '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | SQL_TOKEN_VARCHAR paren_char_length + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | character_large_object_type + ; +opt_paren_precision: + {$$ = SQL_NEW_RULE;} + | paren_char_length + ; +paren_char_length: + '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +opt_paren_char_large_length: + {$$ = SQL_NEW_RULE;} + | paren_character_large_object_length + ; +paren_character_large_object_length: + '(' large_object_length ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; + +large_object_length: + SQL_TOKEN_INTNUM opt_multiplier + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +opt_multiplier: + {$$ = SQL_NEW_RULE;} + | 'K' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("K", SQL_NODE_PUNCTUATION)); + } + | 'M' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("M", SQL_NODE_PUNCTUATION)); + } + | 'G' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("G", SQL_NODE_PUNCTUATION)); + } + | 'T' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("T", SQL_NODE_PUNCTUATION)); + } + | 'P' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("P", SQL_NODE_PUNCTUATION)); + } + ; +character_large_object_type: + SQL_TOKEN_CHARACTER SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); $$->append($3); - $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($4); + } + | SQL_TOKEN_CHAR SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_CLOB opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +national_character_string_type: + SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_NATIONAL SQL_TOKEN_CHAR opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_NCHAR opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NATIONAL SQL_TOKEN_CHAR SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NCHAR SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | national_character_large_object_type + ; +national_character_large_object_type: + SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); $$->append($5); - $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_INTEGER - | SQL_TOKEN_SMALLINT - | SQL_TOKEN_FLOAT - | SQL_TOKEN_FLOAT '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | SQL_TOKEN_NCHAR SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NCLOB opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +binary_string_type: + SQL_TOKEN_BINARY opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_BINARY SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_VARBINARY paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | binary_large_object_string_type + ; +binary_large_object_string_type: + SQL_TOKEN_BINARY SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_BLOB opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +numeric_type: + exact_numeric_type + | approximate_numeric_type + ; +opt_paren_precision_scale: + {$$ = SQL_NEW_RULE;} + | '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +exact_numeric_type: + SQL_TOKEN_NUMERIC opt_paren_precision_scale + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_DECIMAL opt_paren_precision_scale + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_DEC opt_paren_precision_scale + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_SMALLINT + | SQL_TOKEN_INTEGER + | SQL_TOKEN_INT + | SQL_TOKEN_BIGINT + ; +approximate_numeric_type: + SQL_TOKEN_FLOAT '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; $$->append($1); $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_REAL - | SQL_TOKEN_DOUBLE SQL_TOKEN_PRECISION - {$$ = SQL_NEW_RULE; + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_FLOAT + | SQL_TOKEN_REAL + | SQL_TOKEN_DOUBLE + | SQL_TOKEN_DOUBLE SQL_TOKEN_PRECISION + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2);} + $$->append($2); + } + ; +boolean_type: + SQL_TOKEN_BOOLEAN +; +datetime_type: + SQL_TOKEN_DATE + | SQL_TOKEN_TIME opt_paren_precision opt_with_or_without_time_zone + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_TIMESTAMP opt_paren_precision opt_with_or_without_time_zone + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +opt_with_or_without_time_zone: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_WITH SQL_TOKEN_TIME SQL_TOKEN_ZONE + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_WITHOUT SQL_TOKEN_TIME SQL_TOKEN_ZONE + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +interval_type: + SQL_TOKEN_INTERVAL interval_qualifier + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } ; - /* the various things you can name */ column: @@ -3032,7 +3451,141 @@ column: $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); } ; - +case_expression: + case_abbreviation + | case_specification + ; +case_abbreviation: + SQL_TOKEN_NULLIF '(' value_exp_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_COALESCE '(' value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_COALESCE '(' value_exp_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +case_specification: + simple_case + | searched_case + ; +simple_case: + SQL_TOKEN_CASE case_operand simple_when_clause_list else_clause SQL_TOKEN_END + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + ; +searched_case: + SQL_TOKEN_CASE searched_when_clause_list else_clause SQL_TOKEN_END + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +simple_when_clause_list: + simple_when_clause + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | searched_when_clause_list simple_when_clause + { + $1->append($2); + $$ = $1; + } + ; +simple_when_clause: + SQL_TOKEN_WHEN when_operand_list SQL_TOKEN_THEN result + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +when_operand_list: + when_operand + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | when_operand_list ',' when_operand + {$1->append($3); + $$ = $1;} + ; +when_operand: + row_value_constructor_elem + | comparison_predicate_part_2 + | between_predicate_part_2 + | in_predicate_part_2 + | character_like_predicate_part_2 + | null_predicate_part_2 +; +searched_when_clause_list: + searched_when_clause + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | searched_when_clause_list searched_when_clause + { + $1->append($2); + $$ = $1; + } + ; +searched_when_clause: + SQL_TOKEN_WHEN search_condition SQL_TOKEN_THEN result + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +else_clause: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ELSE result + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +result: + result_expression + | SQL_TOKEN_NULL + ; +result_expression: + value_exp + ; +case_operand: + row_value_constructor_elem + ; + cursor: SQL_TOKEN_NAME {$$ = SQL_NEW_RULE; $$->append($1);} @@ -3097,6 +3650,195 @@ sql: } | '(' sql ')' /* checking predicats */ ; +trigger_definition: + SQL_TOKEN_CREATE SQL_TOKEN_TRIGGER trigger_name trigger_action_time trigger_event SQL_TOKEN_ON table_name op_referencing triggered_action + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7); + $$->append($8); + $$->append($9); + } + ; +op_referencing: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_REFERENCING transition_table_or_variable_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +trigger_action_time: + SQL_TOKEN_BEFORE + | SQL_TOKEN_AFTER + | SQL_TOKEN_INSTEAD SQL_TOKEN_OF + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } +; +trigger_event: + SQL_TOKEN_INSERT + | SQL_TOKEN_DELETE + | SQL_TOKEN_UPDATE op_trigger_columnlist + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +op_trigger_columnlist: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_OF trigger_column_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +trigger_column_list: + column_commalist + ; +triggered_action: + op_triggered_action_for triggered_when_clause triggered_SQL_statement + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +op_triggered_action_for: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_FOR SQL_TOKEN_EACH trigger_for + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +trigger_for: + SQL_TOKEN_ROW + | SQL_TOKEN_STATEMENT + ; +triggered_when_clause: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_WHEN parenthesized_boolean_value_expression + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +triggered_SQL_statement: + SQL_procedure_statement + | SQL_TOKEN_BEGIN SQL_TOKEN_ATOMIC SQL_procedure_statement_list ';' SQL_TOKEN_END + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4 = newNode(";", SQL_NODE_PUNCTUATION)); + $$->append($5); + } + ; +SQL_procedure_statement_list: + SQL_procedure_statement + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | SQL_procedure_statement_list ';' SQL_procedure_statement + { + $1->append($3); + $$ = $1; + } + ; +SQL_procedure_statement: + sql + ; + +transition_table_or_variable_list: + transition_table_or_variable + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | transition_table_or_variable_list transition_table_or_variable + { + $1->append($2); + $$ = $1; + } + ; + +transition_table_or_variable: + SQL_TOKEN_OLD opt_row opt_as old_transition_variable_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NEW opt_row opt_as new_transition_variable_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_OLD SQL_TOKEN_TABLE opt_as old_transition_table_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NEW SQL_TOKEN_TABLE opt_as new_transition_table_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } +; +old_transition_table_name: + transition_table_name +; +new_transition_table_name: + transition_table_name +; +transition_table_name: + SQL_TOKEN_NAME +; +old_transition_variable_name: + SQL_TOKEN_NAME +; +new_transition_variable_name: + SQL_TOKEN_NAME +; +trigger_name: + SQL_TOKEN_NAME +; %% diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index e365fdec1eca..ecb5c36655a5 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -90,15 +90,11 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; SQLyylval.pParseNode = new OSQLInternalNode(text, token); #define SQL_NEW_KEYWORD(token) \ - SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); + SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); return token; -#define SQL_NEW_NAME SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME) -#define SQL_NEW_INTNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_INTNUM) -#define SQL_NEW_APPROXNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_APPROXNUM) -#define SQL_NEW_STRING SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_STRING) -#define SQL_NEW_COMPARISON SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_COMPARISON) -#define SQL_NEW_AMMSC SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_AMMSC) -#define SQL_NEW_DATE SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE) +#define SQL_NEW_INTNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_INTNUM); return SQL_TOKEN_INTNUM; +#define SQL_NEW_APPROXNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_APPROXNUM); return SQL_TOKEN_APPROXNUM; +#define SQL_NEW_DATE SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); return SQL_TOKEN_ACCESS_DATE; #define YY_INPUT(buf,result,max_size) \ { \ @@ -126,231 +122,280 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; %option never-interactive %% -[Aa][Bb][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_ABS); return SQL_TOKEN_ABS; } -[Aa][Cc][Oo][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_ACOS); return SQL_TOKEN_ACOS; } -[Aa][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_ALL); return SQL_TOKEN_ALL; } -[Aa][Ll][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_ALTER); return SQL_TOKEN_ALTER; } -[Aa][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_AND); return SQL_TOKEN_AND; } -[Aa][Nn][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_ANY); return SQL_TOKEN_ANY; } -[Aa][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_AS); return SQL_TOKEN_AS; } -[Aa][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_ASC); return SQL_TOKEN_ASC; } -[Aa][Ss][Cc][Ii][Ii] {SQL_NEW_KEYWORD(SQL_TOKEN_ASCII); return SQL_TOKEN_ASCII; } -[Aa][Ss][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ASIN); return SQL_TOKEN_ASIN; } -[Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_AT); return SQL_TOKEN_AT; } -[Aa][Tt][Aa][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN); return SQL_TOKEN_ATAN; } -[Aa][Tt][Aa][Nn]2 {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN2); return SQL_TOKEN_ATAN2; } -[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_AUTHORIZATION); return SQL_TOKEN_AUTHORIZATION; } -[Aa][Vv][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_AVG); return SQL_TOKEN_AVG; } - -[Bb][Ee][Tt][Ww][Ee][Ee][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_BETWEEN); return SQL_TOKEN_BETWEEN; } -[Bb][Ii][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_BIT); return SQL_TOKEN_BIT; } -[Bb][Ii][Tt]_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_BIT_LENGTH); return SQL_TOKEN_BIT_LENGTH; } -[Bb][Oo][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_BOTH); return SQL_TOKEN_BOTH; } -[Bb][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_BY); return SQL_TOKEN_BY; } - -[Cc][Aa][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_CALL); return SQL_TOKEN_CALL; } -[Cc][Aa][Ss][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CAST); return SQL_TOKEN_CAST; } -[Cc][Hh][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR); return SQL_TOKEN_CHAR; } -[Cc][Hh][Aa][Rr][Aa][Cc][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CHARACTER); return SQL_TOKEN_CHARACTER; } -[Cc][Hh][Aa][Rr]([Aa][Cc][Tt][Ee][Rr])?_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR_LENGTH); return SQL_TOKEN_CHAR_LENGTH; } -[Cc][Hh][Ee][Cc][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_CHECK); return SQL_TOKEN_CHECK; } -[Cc][Ee][Ii][Ll][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_CEILING); return SQL_TOKEN_CEILING; } -[Cc][Oo][Ll][Ll][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_COLLATE); return SQL_TOKEN_COLLATE; } -COLLECT {SQL_NEW_KEYWORD(SQL_TOKEN_COLLECT); return SQL_TOKEN_COLLECT; } -[Cc][Oo][Mm][Mm][Ii][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COMMIT); return SQL_TOKEN_COMMIT; } -[Cc][Oo][Nn][Cc][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CONCAT); return SQL_TOKEN_CONCAT; } -[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CONTINUE); return SQL_TOKEN_CONTINUE; } -[Cc][Oo][Nn][Vv][Ee][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CONVERT); return SQL_TOKEN_CONVERT; } -[Cc][Oo][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_COS); return SQL_TOKEN_COS; } -[Cc][Oo][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COT); return SQL_TOKEN_COT; } -[Cc][Oo][Uu][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COUNT); return SQL_TOKEN_COUNT; } -[Cc][Rr][Ee][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CREATE); return SQL_TOKEN_CREATE; } -[Cc][Rr][Oo][Ss][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_CROSS); return SQL_TOKEN_CROSS; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT); return SQL_TOKEN_CURRENT; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DATE); return SQL_TOKEN_CURRENT_DATE; } -[Cc][Uu][Rr][Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURDATE); return SQL_TOKEN_CURDATE; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIME); return SQL_TOKEN_CURRENT_TIME; } -[Cc][Uu][Rr][Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURTIME); return SQL_TOKEN_CURTIME; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIMESTAMP); return SQL_TOKEN_CURRENT_TIMESTAMP; } -[Cc][Uu][Rr][Ss][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); return SQL_TOKEN_CURSOR; } - -[Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_D); return SQL_TOKEN_D; } -[Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); return SQL_TOKEN_DATE; } -[Dd][Aa][Tt][Ee][Dd][Ii][Ff][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_DATEDIFF); return SQL_TOKEN_DATEDIFF; } -[Dd][Aa][Tt][Ee][Vv][Aa][Ll][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DATEVALUE); return SQL_TOKEN_DATEVALUE; } -[Dd][Aa][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); return SQL_TOKEN_DAY; } -[Dd][Aa][Yy][Nn][Aa][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYNAME); return SQL_TOKEN_DAYNAME; } -[Dd][Aa][Yy][Oo][Ff][Mm][Oo][Nn][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFMONTH); return SQL_TOKEN_DAYOFMONTH; } -[Dd][Aa][Yy][Oo][Ff][Ww][Ee][Ee][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFWEEK); return SQL_TOKEN_DAYOFWEEK; } -[Dd][Aa][Yy][Oo][Ff][Yy][Ee][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFYEAR); return SQL_TOKEN_DAYOFYEAR; } -[Dd][Ee][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DEC); return SQL_TOKEN_DEC; } -[Dd][Ee][Cc][Ii][Mm][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_DECIMAL); return SQL_TOKEN_DECIMAL; } -[Dd][Ee][Cc][Ll][Aa][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DECLARE); return SQL_TOKEN_DECLARE; } -[Dd][Ee][Ff][Aa][Uu][Ll][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DEFAULT); return SQL_TOKEN_DEFAULT; } -[Dd][Ee][Gg][Rr][Ee][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_DEGREES); return SQL_TOKEN_DEGREES; } -[Dd][Ee][Ll][Ee][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DELETE); return SQL_TOKEN_DELETE; } -[Dd][Ee][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); return SQL_TOKEN_DESC; } -[Dd][Ii][Ff][Ff][Ee][Rr][Ee][Nn][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DIFFERENCE); return SQL_TOKEN_DIFFERENCE; } -[Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); return SQL_TOKEN_DISTINCT; } -[Dd][Oo][Uu][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); return SQL_TOKEN_DOUBLE; } -[Dd][Rr][Oo][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); return SQL_TOKEN_DROP; } - -EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); return SQL_TOKEN_EVERY; } -[Ee][Ss][Cc][Aa][Pp][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); return SQL_TOKEN_ESCAPE; } -[Ee][Xx][Cc][Ee][Pp][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); return SQL_TOKEN_EXCEPT; } -[Ee][Xx][Ii][Ss][Tt][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); return SQL_TOKEN_EXISTS; } -[Ee][Xx][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); return SQL_TOKEN_EXP; } -[Ee][Xx][Tt][Rr][Aa][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); return SQL_TOKEN_EXTRACT; } - -[Ff][Aa][Ll][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); return SQL_TOKEN_FALSE; } -[Ff][Ee][Tt][Cc][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); return SQL_TOKEN_FETCH; } -[Ff][Ll][Oo][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); return SQL_TOKEN_FLOAT; } -[Ff][Ll][Oo][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); return SQL_TOKEN_FLOOR; } -[Ff][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_FN); return SQL_TOKEN_FN; } -[Ff][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); return SQL_TOKEN_FOR; } -[Ff][Oo][Rr][Ee][Ii][Gg][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); return SQL_TOKEN_FOREIGN; } -[Ff][Oo][Uu][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); return SQL_TOKEN_FOUND; } -[Ff][Rr][Oo][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_FROM); return SQL_TOKEN_FROM; } -[Ff][Uu][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_FULL); return SQL_TOKEN_FULL; } -FUSION {SQL_NEW_KEYWORD(SQL_TOKEN_FUSION); return SQL_TOKEN_FUSION; } - -[Gg][Rr][Aa][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_GRANT); return SQL_TOKEN_GRANT; } -[Gg][Rr][Oo][Uu][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); return SQL_TOKEN_GROUP; } - -[Hh][Aa][Vv][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); return SQL_TOKEN_HAVING; } -[Hh][Oo][Uu][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); return SQL_TOKEN_HOUR; } - -[Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_IN); return SQL_TOKEN_IN; } -[Ii][Nn][Nn][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); return SQL_TOKEN_INNER; } -[Ii][Nn][Ss][Ee][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); return SQL_TOKEN_INSERT; } -[Ii][Nn][Tt]([Ee][Gg][Ee][Rr])? {SQL_NEW_KEYWORD(SQL_TOKEN_INTEGER); return SQL_TOKEN_INTEGER; } -[Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECT); return SQL_TOKEN_INTERSECT; } -INTERSECTION {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECTION); return SQL_TOKEN_INTERSECTION; } -[Ii][Nn][Tt][Oo] {SQL_NEW_KEYWORD(SQL_TOKEN_INTO); return SQL_TOKEN_INTO; } -[Ii][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_IS); return SQL_TOKEN_IS; } - -[Jj][Oo][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); return SQL_TOKEN_JOIN; } - -[Kk][Ee][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); return SQL_TOKEN_KEY; } - -[Ll][Cc][Aa][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); return SQL_TOKEN_LCASE; } -[Ll][Ee][Aa][Dd][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); return SQL_TOKEN_LEADING; } -[Ll][Ee][Ff][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); return SQL_TOKEN_LEFT; } -[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); return SQL_TOKEN_LENGTH; } -[Ll][Ii][Kk][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); return SQL_TOKEN_LIKE; } -[Ll][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_LN); return SQL_TOKEN_LN; } -[Ll][Oo][Cc][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); return SQL_TOKEN_LOCAL; } -[Ll][Oo][Cc][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); return SQL_TOKEN_LOCATE; } -[Ll][Oo][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_LOG); return SQL_TOKEN_LOG; } -[Ll][Oo][Gg][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_LOGF); return SQL_TOKEN_LOGF; } -[Ll][Oo][Gg]10 {SQL_NEW_KEYWORD(SQL_TOKEN_LOG10); return SQL_TOKEN_LOG10; } -[Ll][Oo][Ww][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_LOWER); return SQL_TOKEN_LOWER; } -[Ll][Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_LTRIM); return SQL_TOKEN_LTRIM; } - -[Mm][Aa][Xx] {SQL_NEW_KEYWORD(SQL_TOKEN_MAX); return SQL_TOKEN_MAX; } -[Mm][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_MIN); return SQL_TOKEN_MIN; } -[Mm][Ii][Nn][Uu][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_MINUTE); return SQL_TOKEN_MINUTE; } -[Mm][Oo][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_MOD); return SQL_TOKEN_MOD; } -[Mm][Oo][Nn][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_MONTH); return SQL_TOKEN_MONTH; } -[Mm][Oo][Nn][Tt][Hh][Nn][Aa][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_MONTHNAME); return SQL_TOKEN_MONTHNAME; } - -[Nn][Aa][Tt][Uu][Rr][Aa][LL] {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); return SQL_TOKEN_NATURAL; } -[Nn][Cc][Hh][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); return SQL_TOKEN_NCHAR; } -[Nn][Oo][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); return SQL_TOKEN_NOT; } -[Nn][Oo][Ww] {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); return SQL_TOKEN_NOW; } -[Nn][Uu][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); return SQL_TOKEN_NULL; } -[Nn][Uu][Mm][Ee][Rr][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); return SQL_TOKEN_NUMERIC; } - -[Oo][Cc][Tt][Ee][Tt]_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); return SQL_TOKEN_OCTET_LENGTH; } -[Oo][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_OF); return SQL_TOKEN_OF; } -[Oo][Jj] {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); return SQL_TOKEN_OJ; } -[Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ON); return SQL_TOKEN_ON; } -[Oo][Pp][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); return SQL_TOKEN_OPTION; } -[Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_OR); return SQL_TOKEN_OR; } -[Oo][Rr][Dd][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); return SQL_TOKEN_ORDER; } -[Oo][Uu][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); return SQL_TOKEN_OUTER; } - -[Pp][Ii] {SQL_NEW_KEYWORD(SQL_TOKEN_PI); return SQL_TOKEN_PI; } -[Pp][Oo][Ss][Ii][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); return SQL_TOKEN_POSITION; } -[Pp][Oo][Ww][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); return SQL_TOKEN_POWER; } -[Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); return SQL_TOKEN_PRECISION; } -[Pp][Rr][Ii][Mm][Aa][Rr][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); return SQL_TOKEN_PRIMARY; } -[Pp][Rr][Ii][Vv][Ii][Ll][Ee][Gg][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); return SQL_TOKEN_PRIVILEGES; } -[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_PROCEDURE); return SQL_TOKEN_PROCEDURE; } -[Pp][Uu][Bb][Ll][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_PUBLIC); return SQL_TOKEN_PUBLIC; } - -[Qq][Uu][Aa][Rr][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); return SQL_TOKEN_QUARTER; } - -[Rr][Aa][Dd][Ii][Aa][Nn][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); return SQL_TOKEN_RADIANS; } -[Rr][Aa][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); return SQL_TOKEN_RAND; } -[Rr][Ee][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); return SQL_TOKEN_REAL; } -[Rr][Ee][Ff][Ee][Rr][Ee][Nn][Cc][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); return SQL_TOKEN_REFERENCES; } -[Rr][Ee][Pp][Ee][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); return SQL_TOKEN_REPEAT; } -[Rr][Ee][Pp][Ll][Aa][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); return SQL_TOKEN_REPLACE; } -[Rr][Oo][Ll][Ll][Bb][Aa][Cc][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); return SQL_TOKEN_ROLLBACK; } -[Rr][Oo][Uu][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); return SQL_TOKEN_ROUND; } -[Rr][Oo][Uu][Nn][Dd][Mm][Aa][Gg][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); return SQL_TOKEN_ROUNDMAGIC; } -[Rr][Ii][Gg][Hh][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); return SQL_TOKEN_RIGHT; } -[Rr][Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); return SQL_TOKEN_RTRIM; } - -[Ss][Cc][Hh][Ee][Mm][Aa] {SQL_NEW_KEYWORD(SQL_TOKEN_SCHEMA); return SQL_TOKEN_SCHEMA; } -[Ss][Ee][Cc][Oo][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_SECOND); return SQL_TOKEN_SECOND; } -[Ss][Ee][Ll][Ee][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SELECT); return SQL_TOKEN_SELECT; } -[Ss][Ee][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SET); return SQL_TOKEN_SET; } -[Ss][Ii][Zz][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SIZE); return SQL_TOKEN_SIZE; } -[Ss][Ii][Gg][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_SIGN); return SQL_TOKEN_SIGN; } -[Ss][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_SIN); return SQL_TOKEN_SIN; } -[Ss][Mm][Aa][Ll][Ll][Ii][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SMALLINT); return SQL_TOKEN_SMALLINT; } -[Ss][Oo][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SOME); return SQL_TOKEN_SOME; } -[Ss][Oo][Uu][Nn][Dd][Ee][Xx] {SQL_NEW_KEYWORD(SQL_TOKEN_SOUNDEX); return SQL_TOKEN_SOUNDEX; } -[Ss][Pp][Aa][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SPACE); return SQL_TOKEN_SPACE; } -[Ss][Qq][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SQRT); return SQL_TOKEN_SQRT; } -STDDEV_POP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_POP); return SQL_TOKEN_STDDEV_POP; } -STDDEV_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_SAMP); return SQL_TOKEN_STDDEV_SAMP; } -[Ss][Uu][Bb][Ss][Tt][Rr][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_SUBSTRING); return SQL_TOKEN_SUBSTRING; } -[Ss][Uu][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_SUM); return SQL_TOKEN_SUM; } - -[Tt][Aa][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); return SQL_TOKEN_TABLE; } -[Tt][Aa][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); return SQL_TOKEN_TAN; } -[Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); return SQL_TOKEN_TIME; } -[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); return SQL_TOKEN_TIMESTAMP; } -[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp][Aa][Dd][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); return SQL_TOKEN_TIMESTAMPADD; } -[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp][Dd][Ii][Ff][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPDIFF); return SQL_TOKEN_TIMESTAMPDIFF; } -[Tt][Ii][Mm][Ee][Vv][Aa][Ll][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEVALUE); return SQL_TOKEN_TIMEVALUE; } -[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]_[Hh][Oo][Uu][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_HOUR); return SQL_TOKEN_TIMEZONE_HOUR; } -[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]_[Mm][Ii][Nn][Uu][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_MINUTE); return SQL_TOKEN_TIMEZONE_MINUTE; } -[Tt][Oo] {SQL_NEW_KEYWORD(SQL_TOKEN_TO); return SQL_TOKEN_TO; } -[Tt][Rr][Aa][Ii][Ll][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_TRAILING); return SQL_TOKEN_TRAILING; } -[Tt][Rr][Aa][Nn][Ss][Ll][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRANSLATE); return SQL_TOKEN_TRANSLATE; } -[Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_TRIM); return SQL_TOKEN_TRIM; } -[Tt][Rr][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRUE); return SQL_TOKEN_TRUE; } -[Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRUNCATE); return SQL_TOKEN_TRUNCATE; } -[Tt][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_TS); return SQL_TOKEN_TS; } -[Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_T); return SQL_TOKEN_T; } - -[Uu][Cc][Aa][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); return SQL_TOKEN_UCASE; } -[Uu][Nn][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); return SQL_TOKEN_UNION; } -[Uu][Nn][Ii][Qq][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); return SQL_TOKEN_UNIQUE; } -[Uu][Nn][Kk][Nn][Oo][Ww][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); return SQL_TOKEN_UNKNOWN; } -[Uu][Pp][Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UPDATE); return SQL_TOKEN_UPDATE; } -[Uu][Pp][Pp][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_UPPER); return SQL_TOKEN_UPPER; } -[Uu][Ss][Aa][Gg][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_USAGE); return SQL_TOKEN_USAGE; } -[Uu][Ss][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_USER); return SQL_TOKEN_USER; } -[Uu][Ss][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_USING); return SQL_TOKEN_USING; } - -VAR_POP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_POP); return SQL_TOKEN_VAR_POP; } -VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_SAMP); return SQL_TOKEN_VAR_SAMP; } -[Vv][Aa][Ll][Uu][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_VALUES); return SQL_TOKEN_VALUES; } -[Vv][Ii][Ee][Ww] {SQL_NEW_KEYWORD(SQL_TOKEN_VIEW); return SQL_TOKEN_VIEW; } - -[Ww][Ee][Ee][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_WEEK); return SQL_TOKEN_WEEK; } -[Ww][Hh][Ee][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_WHERE); return SQL_TOKEN_WHERE; } -[Ww][Ii][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_WITH); return SQL_TOKEN_WITH; } -[Ww][Oo][Rr][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_WORK); return SQL_TOKEN_WORK; } - -[Yy][Ee][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_YEAR); return SQL_TOKEN_YEAR; } - -[Zz][Oo][Nn][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); return SQL_TOKEN_ZONE; } +ABS {SQL_NEW_KEYWORD(SQL_TOKEN_ABS); } +ACOS {SQL_NEW_KEYWORD(SQL_TOKEN_ACOS); } +AFTER {SQL_NEW_KEYWORD(SQL_TOKEN_AFTER); } +ALL {SQL_NEW_KEYWORD(SQL_TOKEN_ALL); } +ALTER {SQL_NEW_KEYWORD(SQL_TOKEN_ALTER); } +AND {SQL_NEW_KEYWORD(SQL_TOKEN_AND); } +ANY {SQL_NEW_KEYWORD(SQL_TOKEN_ANY); } +ARRAY_AGG {SQL_NEW_KEYWORD(SQL_TOKEN_ARRAY_AGG); } +AS {SQL_NEW_KEYWORD(SQL_TOKEN_AS); } +ASC {SQL_NEW_KEYWORD(SQL_TOKEN_ASC); } +ASCII {SQL_NEW_KEYWORD(SQL_TOKEN_ASCII); } +ASIN {SQL_NEW_KEYWORD(SQL_TOKEN_ASIN); } +AT {SQL_NEW_KEYWORD(SQL_TOKEN_AT); } +ATAN {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN); } +ATAN2 {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN2); } +ATOMIC {SQL_NEW_KEYWORD(SQL_TOKEN_ATOMIC); } +AUTHORIZATION {SQL_NEW_KEYWORD(SQL_TOKEN_AUTHORIZATION); } +AVG {SQL_NEW_KEYWORD(SQL_TOKEN_AVG); } + +BEFORE {SQL_NEW_KEYWORD(SQL_TOKEN_BEFORE); } +BEGIN {SQL_NEW_KEYWORD(SQL_TOKEN_BEGIN); } +BETWEEN {SQL_NEW_KEYWORD(SQL_TOKEN_BETWEEN); } +BIGINT {SQL_NEW_KEYWORD(SQL_TOKEN_BIGINT); } +BINARY {SQL_NEW_KEYWORD(SQL_TOKEN_BINARY); } +BIT {SQL_NEW_KEYWORD(SQL_TOKEN_BIT); } +BIT_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_BIT_LENGTH); } +BLOB {SQL_NEW_KEYWORD(SQL_TOKEN_BLOB); } +BOTH {SQL_NEW_KEYWORD(SQL_TOKEN_BOTH); } +BY {SQL_NEW_KEYWORD(SQL_TOKEN_BY); } + +CALL {SQL_NEW_KEYWORD(SQL_TOKEN_CALL); } +CASE {SQL_NEW_KEYWORD(SQL_TOKEN_CASE); } +CAST {SQL_NEW_KEYWORD(SQL_TOKEN_CAST); } +CEILING {SQL_NEW_KEYWORD(SQL_TOKEN_CEILING); } +CHAR {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR); } +CHARACTER {SQL_NEW_KEYWORD(SQL_TOKEN_CHARACTER); } +CHAR(ACTER)?_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR_LENGTH); } +CHECK {SQL_NEW_KEYWORD(SQL_TOKEN_CHECK); } +CLOB {SQL_NEW_KEYWORD(SQL_TOKEN_CLOB); } +COALESCE {SQL_NEW_KEYWORD(SQL_TOKEN_COALESCE); } +COLLATE {SQL_NEW_KEYWORD(SQL_TOKEN_COLLATE); } +COLLECT {SQL_NEW_KEYWORD(SQL_TOKEN_COLLECT); } +COMMIT {SQL_NEW_KEYWORD(SQL_TOKEN_COMMIT); } +CONCAT {SQL_NEW_KEYWORD(SQL_TOKEN_CONCAT); } +CONTINUE {SQL_NEW_KEYWORD(SQL_TOKEN_CONTINUE); } +CONVERT {SQL_NEW_KEYWORD(SQL_TOKEN_CONVERT); } +COS {SQL_NEW_KEYWORD(SQL_TOKEN_COS); } +COT {SQL_NEW_KEYWORD(SQL_TOKEN_COT); } +COUNT {SQL_NEW_KEYWORD(SQL_TOKEN_COUNT); } +CREATE {SQL_NEW_KEYWORD(SQL_TOKEN_CREATE); } +CROSS {SQL_NEW_KEYWORD(SQL_TOKEN_CROSS); } +CUME_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_CUME_DIST); } +CURRENT {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT); } +CURRENT_DATE {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DATE); } +CURRENT_CATALOG {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_CATALOG); } +CURRENT_DEFAULT_TRANSFORM_GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP); } +CURRENT_PATH {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_PATH); } +CURRENT_ROLE {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_ROLE); } +CURRENT_SCHEMA {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_SCHEMA); } +CURRENT_USER {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_USER); } +CURDATE {SQL_NEW_KEYWORD(SQL_TOKEN_CURDATE); } +CURRENT_TIME {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIME); } +CURTIME {SQL_NEW_KEYWORD(SQL_TOKEN_CURTIME); } +CURRENT_TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIMESTAMP); } +CURSOR {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); } + +D {SQL_NEW_KEYWORD(SQL_TOKEN_D); } +DATE {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); } +DATEDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_DATEDIFF); } +DATEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_DATEVALUE); } +DAY {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); } +DAYNAME {SQL_NEW_KEYWORD(SQL_TOKEN_DAYNAME); } +DAYOFMONTH {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFMONTH); } +DAYOFWEEK {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFWEEK); } +DAYOFYEAR {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFYEAR); } +DEC {SQL_NEW_KEYWORD(SQL_TOKEN_DEC); } +DECIMAL {SQL_NEW_KEYWORD(SQL_TOKEN_DECIMAL); } +DECLARE {SQL_NEW_KEYWORD(SQL_TOKEN_DECLARE); } +DEFAULT {SQL_NEW_KEYWORD(SQL_TOKEN_DEFAULT); } +DEGREES {SQL_NEW_KEYWORD(SQL_TOKEN_DEGREES); } +DELETE {SQL_NEW_KEYWORD(SQL_TOKEN_DELETE); } +DENSE_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_DENSE_RANK); } +DESC {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); } +DIFFERENCE {SQL_NEW_KEYWORD(SQL_TOKEN_DIFFERENCE); } +DISTINCT {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); } +DOUBLE {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); } +DROP {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); } + +EACH {SQL_NEW_KEYWORD(SQL_TOKEN_EACH); } +ELSE {SQL_NEW_KEYWORD(SQL_TOKEN_ELSE); } +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); } +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); } +FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); } +FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); } +FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); } +FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); } +FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); } +FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); } +FROM {SQL_NEW_KEYWORD(SQL_TOKEN_FROM); } +FULL {SQL_NEW_KEYWORD(SQL_TOKEN_FULL); } +FUSION {SQL_NEW_KEYWORD(SQL_TOKEN_FUSION); } + +GRANT {SQL_NEW_KEYWORD(SQL_TOKEN_GRANT); } +GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); } + +HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); } +HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); } + +IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); } +INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); } +INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); } +INSTEAD {SQL_NEW_KEYWORD(SQL_TOKEN_INSTEAD); } +INT(EGER)? {SQL_NEW_KEYWORD(SQL_TOKEN_INTEGER); } +INTERSECT {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECT); } +INTERVAL {SQL_NEW_KEYWORD(SQL_TOKEN_INTERVAL); } +INTERSECTION {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECTION); } +INTO {SQL_NEW_KEYWORD(SQL_TOKEN_INTO); } +IS {SQL_NEW_KEYWORD(SQL_TOKEN_IS); } + +JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); } + +KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); } + +LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); } +LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); } +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); } +LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); } +LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); } +LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); } +LOG {SQL_NEW_KEYWORD(SQL_TOKEN_LOG); } +LOGF {SQL_NEW_KEYWORD(SQL_TOKEN_LOGF); } +LOG10 {SQL_NEW_KEYWORD(SQL_TOKEN_LOG10); } +LOWER {SQL_NEW_KEYWORD(SQL_TOKEN_LOWER); } +LTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_LTRIM); } + +MAX {SQL_NEW_KEYWORD(SQL_TOKEN_MAX); } +MIN {SQL_NEW_KEYWORD(SQL_TOKEN_MIN); } +MINUTE {SQL_NEW_KEYWORD(SQL_TOKEN_MINUTE); } +MOD {SQL_NEW_KEYWORD(SQL_TOKEN_MOD); } +MONTH {SQL_NEW_KEYWORD(SQL_TOKEN_MONTH); } +MONTHNAME {SQL_NEW_KEYWORD(SQL_TOKEN_MONTHNAME); } + +NATIONAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATIONAL); } +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); } +NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); } +NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); } +NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); } +NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); } +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); } +OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); } +OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); } +ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); } +OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); } +OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); } +ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); } +OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); } + +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); } +PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); } +PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); } +PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); } +PROCEDURE {SQL_NEW_KEYWORD(SQL_TOKEN_PROCEDURE); } +PUBLIC {SQL_NEW_KEYWORD(SQL_TOKEN_PUBLIC); } + +QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); } + +RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); } +RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); } +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); } +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); } +RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); } +RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); } + +SCHEMA {SQL_NEW_KEYWORD(SQL_TOKEN_SCHEMA); } +SECOND {SQL_NEW_KEYWORD(SQL_TOKEN_SECOND); } +SELECT {SQL_NEW_KEYWORD(SQL_TOKEN_SELECT); } +SET {SQL_NEW_KEYWORD(SQL_TOKEN_SET); } +SIZE {SQL_NEW_KEYWORD(SQL_TOKEN_SIZE); } +SIGN {SQL_NEW_KEYWORD(SQL_TOKEN_SIGN); } +SIN {SQL_NEW_KEYWORD(SQL_TOKEN_SIN); } +SMALLINT {SQL_NEW_KEYWORD(SQL_TOKEN_SMALLINT); } +SOME {SQL_NEW_KEYWORD(SQL_TOKEN_SOME); } +SOUNDEX {SQL_NEW_KEYWORD(SQL_TOKEN_SOUNDEX); } +SPACE {SQL_NEW_KEYWORD(SQL_TOKEN_SPACE); } +SQRT {SQL_NEW_KEYWORD(SQL_TOKEN_SQRT); } +STDDEV_POP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_POP); } +STDDEV_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_SAMP); } +STATEMENT {SQL_NEW_KEYWORD(SQL_TOKEN_STATEMENT); } +SUBSTRING {SQL_NEW_KEYWORD(SQL_TOKEN_SUBSTRING); } +SUM {SQL_NEW_KEYWORD(SQL_TOKEN_SUM); } +SESSION_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SESSION_USER); } +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); } +TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); } +TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); } +TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); } +TIMESTAMPDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPDIFF); } +TIMEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEVALUE); } +TIMEZONE_HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_HOUR); } +TIMEZONE_MINUTE {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_MINUTE); } +TO {SQL_NEW_KEYWORD(SQL_TOKEN_TO); } +TRAILING {SQL_NEW_KEYWORD(SQL_TOKEN_TRAILING); } +TRANSLATE {SQL_NEW_KEYWORD(SQL_TOKEN_TRANSLATE); } +TRIGGER {SQL_NEW_KEYWORD(SQL_TOKEN_TRIGGER); } +TRIM {SQL_NEW_KEYWORD(SQL_TOKEN_TRIM); } +TRUE {SQL_NEW_KEYWORD(SQL_TOKEN_TRUE); } +TRUNCATE {SQL_NEW_KEYWORD(SQL_TOKEN_TRUNCATE); } +TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); } +T {SQL_NEW_KEYWORD(SQL_TOKEN_T); } + +UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); } +UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); } +UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); } +UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); } +UPDATE {SQL_NEW_KEYWORD(SQL_TOKEN_UPDATE); } +UPPER {SQL_NEW_KEYWORD(SQL_TOKEN_UPPER); } +USAGE {SQL_NEW_KEYWORD(SQL_TOKEN_USAGE); } +USER {SQL_NEW_KEYWORD(SQL_TOKEN_USER); } +USING {SQL_NEW_KEYWORD(SQL_TOKEN_USING); } + +VARBINARY {SQL_NEW_KEYWORD(SQL_TOKEN_VARBINARY); } +VARCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_VARCHAR); } +VARYING {SQL_NEW_KEYWORD(SQL_TOKEN_VARYING); } +VAR_POP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_POP); } +VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_SAMP); } +VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_VALUE); } +VALUES {SQL_NEW_KEYWORD(SQL_TOKEN_VALUES); } +VIEW {SQL_NEW_KEYWORD(SQL_TOKEN_VIEW); } + +WEEK {SQL_NEW_KEYWORD(SQL_TOKEN_WEEK); } +WHEN {SQL_NEW_KEYWORD(SQL_TOKEN_WHEN); } +WHERE {SQL_NEW_KEYWORD(SQL_TOKEN_WHERE); } +WITH {SQL_NEW_KEYWORD(SQL_TOKEN_WITH); } +WITHIN {SQL_NEW_KEYWORD(SQL_TOKEN_WITHIN); } +WITHOUT {SQL_NEW_KEYWORD(SQL_TOKEN_WITHOUT); } +WORK {SQL_NEW_KEYWORD(SQL_TOKEN_WORK); } + +YEAR {SQL_NEW_KEYWORD(SQL_TOKEN_YEAR); } + +ZONE {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); } "<" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_LESS);return SQL_LESS;} ">" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_GREAT);return SQL_GREAT;} @@ -369,31 +414,31 @@ VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_S <SQL>([0-9]+) | <SQL>([0-9]+"."[0-9]*) | -<SQL>("."[0-9]*) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} +<SQL>("."[0-9]*) {SQL_NEW_INTNUM; } <SQL>[0-9]+[eE][+-]?[0-9]+ | <SQL>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | -<SQL>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<SQL>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } <PREDICATE_GER,PREDICATE_ENG,DATE>[A-Za-z\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375][A-Za-z0-9_%.,*?\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375]* {return gatherNamePre(SQLyytext);} -<PREDICATE_GER,PREDICATE_ENG>([0-9]+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} -<PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} -<PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} +<PREDICATE_GER,PREDICATE_ENG>([0-9]+) {SQL_NEW_INTNUM; } +<PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+) {SQL_NEW_INTNUM; } +<PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+) {SQL_NEW_INTNUM; } <PREDICATE_ENG>([0-9]+"."[0-9]+) | <PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+"."[0-9]+) | -<PREDICATE_ENG>("."[0-9]+) {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_ENG>("."[0-9]+) {SQL_NEW_APPROXNUM; } <PREDICATE_ENG>[0-9]+[eE][+-]?[0-9]+ | <PREDICATE_ENG>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | -<PREDICATE_ENG>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_ENG>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } <PREDICATE_GER>([0-9]+","[0-9]+) | <PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+","[0-9]+) | -<PREDICATE_GER>(","[0-9]+) {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_GER>(","[0-9]+) {SQL_NEW_APPROXNUM; } <PREDICATE_GER>[0-9]+[eE][+-]?[0-9]+ | <PREDICATE_GER>[0-9]+","[0-9]*[eE][+-]?[0-9]+ | -<PREDICATE_GER>","[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_GER>","[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } <PREDICATE_GER,PREDICATE_ENG>[0-9.,][A-Za-z0-9_.,%]* {return gatherNamePre(SQLyytext);} @@ -407,7 +452,7 @@ VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_S <PREDICATE_GER,PREDICATE_ENG,DATE># { return gatherString('#' ,2); } <DATE>[0-9]{1,4}[^ ]*[0-9] | -<DATE>[0-9]{1,4}[^ ]*[0-9][ ][0-9]{1,4}[^ ]*[0-9] { SQL_NEW_DATE; return SQL_TOKEN_ACCESS_DATE;} +<DATE>[0-9]{1,4}[^ ]*[0-9][ ][0-9]{1,4}[^ ]*[0-9] { SQL_NEW_DATE; } <STRING>["-""+""*""/"":""("")"",""."";""?""{""}"] { return SQLyytext[0]; } /* */ <STRING>"[" { return gatherString(']' ,0); } @@ -468,7 +513,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp) { case 0: SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); - return SQL_TOKEN_NAME; + return SQL_TOKEN_NAME; case 1: SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); return SQL_TOKEN_STRING; @@ -491,7 +536,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp) } } YY_FATAL_ERROR("Unterminated name string"); - return SQL_TOKEN_INVALIDSYMBOL; + return SQL_TOKEN_INVALIDSYMBOL; } sal_Int32 mapEnumToToken(IParseContext::InternationalKeyCode _eKeyCode ) @@ -566,10 +611,10 @@ sal_Int32 gatherName(const sal_Char* text) case IParseContext::KEY_INTERSECTION: nToken = mapEnumToToken(eKeyCode); SQL_NEW_KEYWORD(nToken); - return nToken; + break; default: SQL_NEW_NODE(::rtl::OUString(text,strlen(text),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); - return SQL_TOKEN_NAME; + return SQL_TOKEN_NAME; } } /** diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 54ab874f70e1..42486ed73ab5 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -829,17 +829,17 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo aColumnName = pColumnRef->getChild(0)->getTokenValue(); OSQLParseNode *pDatatype = pColumnRef->getChild(1); - if (pDatatype && SQL_ISRULE(pDatatype,data_type)) + if (pDatatype && SQL_ISRULE(pDatatype,character_string_type)) { - //data type - // 0 | 1| 2 |3 - //char ( 20 ) - aTypeName = pDatatype->getChild(0)->getTokenValue(); - if (pDatatype->count() == 4 - && SQL_ISPUNCTUATION(pDatatype->getChild(1), "(") - && SQL_ISPUNCTUATION(pDatatype->getChild(3) , ")") ) + const OSQLParseNode *pType = pDatatype->getChild(0); + aTypeName = pType->getTokenValue(); + if (pDatatype->count() == 2 && (pType->getTokenID() == SQL_TOKEN_CHAR || pType->getTokenID() == SQL_TOKEN_CHARACTER )) + nType = DataType::CHAR; + + const OSQLParseNode *pParams = pDatatype->getChild(pDatatype->count()-1); + if ( pParams->count() ) { - nLen = pDatatype->getChild(2)->getTokenValue().toInt32(); + nLen = pParams->getChild(1)->getTokenValue().toInt32(); } } else if(pDatatype && pDatatype->getNodeType() == SQL_NODE_KEYWORD) @@ -849,8 +849,8 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo if (aTypeName.getLength()) { - //TO DO:Create a new class for create statement to handle field length - OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(), + //TODO:Create a new class for create statement to handle field length + OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,nType,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_False); pColumn->setRealName(aColumnName); @@ -1435,6 +1435,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode OParseColumn* pColumn = new OParseColumn( sParameterName, ::rtl::OUString(), ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN, 0, 0, @@ -1498,6 +1499,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode OParseColumn* pColumn = new OParseColumn(aNewColName, ::rtl::OUString(), ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN, 0, 0, @@ -1640,6 +1642,7 @@ void OSQLParseTreeIterator::appendColumns(::vos::ORef<OSQLColumns>& _rColumns,co OParseColumn* pColumn = new OParseColumn(aName , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) @@ -1717,6 +1720,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu // TODO: does this match with _nType? // Or should be fill this from the getTypeInfo of the connection? ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN, 0, 0, @@ -1736,7 +1740,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); - OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); @@ -1757,7 +1761,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); - OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); @@ -1794,7 +1798,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); - OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 969682539074..12f608c68d47 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1425,7 +1425,10 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: { OSQLParseNode::datetime_primary, "datetime_primary" }, { OSQLParseNode::concatenation, "concatenation" }, { OSQLParseNode::char_factor, "char_factor" }, - { OSQLParseNode::bit_value_fct, "bit_value_fct" } + { OSQLParseNode::bit_value_fct, "bit_value_fct" }, + { OSQLParseNode::comparison_predicate_part_2, "comparison_predicate_part_2" }, + { OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" }, + { OSQLParseNode::character_string_type, "character_string_type" } }; size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] ); OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" ); @@ -2557,7 +2560,6 @@ sal_Int32 OSQLParser::getFunctionReturnType(const ::rtl::OUString& _sFunctionNam else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_BIT_LENGTH,pContext))) nType = DataType::INTEGER; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CHAR,pContext))) nType = DataType::VARCHAR; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CHAR_LENGTH,pContext))) nType = DataType::INTEGER; - else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CHARACTER_LENGTH,pContext))) nType = DataType::INTEGER; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CONCAT,pContext))) nType = DataType::VARCHAR; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_DIFFERENCE,pContext))) nType = DataType::VARCHAR; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_INSERT,pContext))) nType = DataType::VARCHAR; |