connectivity/source/parse/sqlbison.y | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
New commits: commit 462f2849d3279164dcec5416e55313f86de663fc Author: jucasaca <jucas...@gmail.com> AuthorDate: Fri Jul 28 19:20:14 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Aug 15 12:26:02 2023 +0200 tdf#104918 Add Firebird's DATEDIFF syntax to the sql parser Add one of the Firebird's DATEDIFF syntax to the parser so now it is possible to execute DATEDIFF(unit, datetime, datetime) in the Base Query designer and don't need to execute it in SQL direct anymore Change-Id: I0514542785c47a2a4693cba26de1815c96ee1b9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155027 Tested-by: Julien Nabet <serval2...@yahoo.fr> Reviewed-by: Julien Nabet <serval2...@yahoo.fr> (cherry picked from commit a509813264b220c70c41c597c0752e0110568511) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155407 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index b06a75fd3739..c119ee8eaec5 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -218,7 +218,7 @@ using namespace connectivity; %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*/ +%type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/ datetime_unit /* new rules at OJ */ %type <pParseNode> derived_column as_clause table_name num_primary term num_value_exp %type <pParseNode> value_exp_primary num_value_fct unsigned_value_spec cast_spec set_fct_spec scalar_subquery @@ -2962,6 +2962,18 @@ non_second_datetime_field: | SQL_TOKEN_HOUR | SQL_TOKEN_MINUTE ; + +datetime_unit: + SQL_TOKEN_YEAR + | SQL_TOKEN_MONTH + | SQL_TOKEN_WEEK + | SQL_TOKEN_DAY + | SQL_TOKEN_HOUR + | SQL_TOKEN_MINUTE + | SQL_TOKEN_SECOND + | SQL_TOKEN_MILLISECOND + ; + start_field: non_second_datetime_field opt_paren_precision { @@ -3093,6 +3105,13 @@ function_args_commalist: else YYERROR; } + | datetime_unit ',' function_arg ',' function_arg + { + $$ = SQL_NEW_COMMALISTRULE; + $$->append($1); + $$->append($3); + $$->append($5); + } ; value_exp: