document the syntax sugar
This commit is contained in:
parent
65312cc0f8
commit
779d9c94c9
|
@ -900,6 +900,18 @@ select substring(title, 1, position(' for Dummies' in title)) from Book
|
||||||
select substring(title from 1 for position(' for Dummies' in title)) from Book /* ANSI SQL-style */
|
select substring(title from 1 for position(' for Dummies' in title)) from Book /* ANSI SQL-style */
|
||||||
----
|
----
|
||||||
|
|
||||||
|
Alternatively, slicing may be performed using an operator, which is just syntax sugar for the `substring()` function:
|
||||||
|
|
||||||
|
[source, hql]
|
||||||
|
----
|
||||||
|
select title[1:position(' for Dummies' in title)] from Book /* Operator-style */
|
||||||
|
----
|
||||||
|
|
||||||
|
[source,hql]
|
||||||
|
----
|
||||||
|
select name.first[1]||name.last[1] as initials from Author
|
||||||
|
----
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
===== Trimming strings
|
===== Trimming strings
|
||||||
The `trim()` function follows the syntax and semantics of ANSI SQL.
|
The `trim()` function follows the syntax and semantics of ANSI SQL.
|
||||||
|
@ -1179,6 +1191,21 @@ On supported platforms, HQL provides a rich suite of functions for working with:
|
||||||
- link:{doc-user-guide-url}#hql-functions-xml[XML]
|
- link:{doc-user-guide-url}#hql-functions-xml[XML]
|
||||||
|
|
||||||
The use of these functions is outside the scope of this guide.
|
The use of these functions is outside the scope of this guide.
|
||||||
|
However, we note that the following language constructs work with arrays, and are implemented as syntactic sugar for the underlying functions:
|
||||||
|
|
||||||
|
[[array-syntax-sugar]]
|
||||||
|
|===
|
||||||
|
| Syntax | Interpretation
|
||||||
|
|
||||||
|
| `[1, 2]` | Instantiate an array
|
||||||
|
| `array[1]` | Array element
|
||||||
|
| `array[1:2]` | Array slice
|
||||||
|
| `length(array)` | Length of an array
|
||||||
|
| `position(element in array)` | Position of an element within an array
|
||||||
|
| `cast(array as String)` | Typecast array to string
|
||||||
|
| `element in array` or `array contains element` | Determine if an element belongs to an array
|
||||||
|
| `array includes subarray` | Determine if the elements of one array include all the elements of a second array
|
||||||
|
|===
|
||||||
|
|
||||||
[[embedding-sql]]
|
[[embedding-sql]]
|
||||||
==== Embedding SQL expressions
|
==== Embedding SQL expressions
|
||||||
|
|
Loading…
Reference in New Issue