diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc b/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc index f21c9b7e24..b6961ef2f0 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc @@ -137,7 +137,7 @@ The BNF for an `update` statement is much easier to understand: [[hql-update-bnf-example]] ==== -[source, indent=0] +[source, antlrv4, indent=0] ---- include::{extrasdir}/statement_update_bnf.txt[] ---- @@ -197,7 +197,7 @@ The BNF for a `delete` statement is also quite simple: [[hql-delete-bnf-example]] ==== -[source, indent=0] +[source, antlrv4, indent=0] ---- include::{extrasdir}/statement_delete_bnf.txt[] ---- @@ -226,7 +226,7 @@ The BNF for an `insert` statement is: [[hql-insert-bnf-example]] ==== -[source, indent=0] +[source, antlrv4, indent=0] ---- include::{extrasdir}/statement_insert_bnf.txt[] ---- @@ -526,9 +526,9 @@ include::{sourcedir}/HQLTest.java[tags=hql-entity-type-exp-example] ==== [[hql-case-expressions]] -==== `case` expressions +==== Case expressions -Just like in standard SQL, there are two forms of the case expression: +Just like in standard SQL, there are two forms of case expression: * the _simple_ case expression, and * the so-called _searched_ case expression. @@ -544,7 +544,8 @@ It's often simpler to use the `coalesce()`, `nullif()`, or `ifnull()` functions. The syntax of the simple form is defined by: -[source, JAVA, indent=0] +[[hql-simple-case-expressions-bnf]] +[source, antlrv4, indent=0] ---- include::{extrasdir}/simple_case_bnf.txt[] ---- @@ -566,7 +567,7 @@ include::{sourcedir}/HQLTest.java[tags=hql-simple-case-expressions-example] The searched form has the following syntax: [[hql-searched-case-expressions-bnf]] -[source, JAVA, indent=0] +[source, antlrv4, indent=0] ---- include::{extrasdir}/searched_case_bnf.txt[] ---- @@ -1002,7 +1003,7 @@ Its friend `ilike` performs case-insensitive matching. Their syntax is defined by: [[hql-like-predicate-bnf]] -[source, JAVA, indent=0] +[source, antlrv4, indent=0] ---- include::{extrasdir}/predicate_like_bnf.txt[] ---- @@ -1069,7 +1070,7 @@ The `in` predicates evaluates to true if the value to its left is in ... well, w Its syntax is unexpectedly complicated: [[hql-in-predicate-bnf]] -[source, JAVA, indent=0] +[source, antlrv4, indent=0] ---- include::{extrasdir}/predicate_in_bnf.txt[] ---- diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_ilike_bnf.txt b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_ilike_bnf.txt deleted file mode 100644 index 89ba9fce35..0000000000 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_ilike_bnf.txt +++ /dev/null @@ -1,4 +0,0 @@ -ilike_expression ::= - string_expression - [NOT] ILIKE pattern_value - [ESCAPE escape_character] diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_in_bnf.txt b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_in_bnf.txt index 31b18d75ff..f7ea6f2b23 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_in_bnf.txt +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/predicate_in_bnf.txt @@ -2,6 +2,6 @@ expression NOT? IN inList inList : (ELEMENTS|INDICES) LEFT_PAREN dotIdentifierSequence RIGHT_PAREN - | LEFT_PAREN (expressionOrPredicate (COMMA expressionOrPredicate)*)? RIGHT_PAREN + | LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN | LEFT_PAREN subquery RIGHT_PAREN | parameter diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/root_entity_ref_bnf.txt b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/root_entity_ref_bnf.txt deleted file mode 100644 index 90401dff1e..0000000000 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/root_entity_ref_bnf.txt +++ /dev/null @@ -1,2 +0,0 @@ -root_entity_reference ::= - entity_name [AS] identification_variable \ No newline at end of file diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/searched_case_bnf.txt b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/searched_case_bnf.txt index 211fa3be08..3b6dbd6f6e 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/searched_case_bnf.txt +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/searched_case_bnf.txt @@ -1 +1 @@ -CASE [ WHEN {test_conditional} THEN {match_result} ]* ELSE {miss_result} END \ No newline at end of file +CASE (WHEN predicate THEN expression)+ (ELSE expression)? END \ No newline at end of file diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/simple_case_bnf.txt b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/simple_case_bnf.txt index f4b03b45fa..2e6c97c3d5 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/simple_case_bnf.txt +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/simple_case_bnf.txt @@ -1 +1 @@ -CASE {operand} WHEN {test_value} THEN {match_result} ELSE {miss_result} END \ No newline at end of file +CASE expression (WHEN expression THEN expression)+ (ELSE expression)? END \ No newline at end of file diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/substring_bnf.txt b/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/substring_bnf.txt deleted file mode 100644 index 81302e9a4b..0000000000 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/extras/substring_bnf.txt +++ /dev/null @@ -1 +0,0 @@ -substring( string_expression, numeric_expression [, numeric_expression] ) \ No newline at end of file