Add support for some basic / popular functions :
String functions: LENGTH, CONTAINS, POSITION, SUBSTRING, CONCAT, CONCAT_WS
Numeric functions: ABS, MOD, CEIL, FLOOR, ROUND
Date and time functions: CURRENT_DATE, CURRENT_TIME, CURRENT_DATE_TIME or NOW, CURRENT_TIMEZONE
Other suggestion (more for the future):
string:
MD5(), sha.., hash…
BASE64(), binary… ascii… hex…
REPLACE(), UPPER(), LOWER()
numeric:
MOD()
others
conditional: CASE, IF(), NULLIF()
array: IN()
For POSITION, I think it should return an Integer, which would typically be -1, if strings are assumed to be 0-indexed like in C, Java etc.
looking for industry standard I checked the followings:
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_locate
https://www.postgresql.org/docs/13/functions-string.html - see position()
https://docs.microsoft.com/en-us/sql/t-sql/functions/charindex-transact-sql?view=sql-server-ver15
https://docs.microsoft.com/en-us/sql/t-sql/functions/patindex-transact-sql?view=sql-server-ver15
They all consider first character of a string to be position 1, and returns 0 in case of not-found. None of them use -1 actually. Hence my text on POSITION function.
I made some changes and hopefully I improve the text anyways, making it more clear.
I think that is better.
Not all of the functions described in the Jira description above have made it into the specs. This is likely intentional, but the Jira description should be updated accordingly?
As a minor issue: https://specifications.openehr.org/releases/QUERY/latest/AQL.html#_reserved_words_and_characters lists all the functions in lowercase whereas the rest of the spec uses uppercase.
You are right about issue-text - I will update it.
As about function name on that paragraph (you are also right) - the reason was partially a legacy text (previous version also used lowercase) as well as own preferences to distinguish these from main clause keywords (SELECT, FROM, …). It is however legal to use them in any case and even combination. But perhaps you are right, for consistency reason perhaps we should have them also uppercase.