Add support for built-in functions

Description

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()

Activity

Show:
Thomas Beale
January 14, 2021, 10:05 PM

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.

Thomas Beale
January 18, 2021, 8:47 AM

I think that is better.

Sebastian Garde
January 26, 2021, 6:58 PM

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.

Sebastian Iancu
January 29, 2021, 8:34 AM

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.

Reporter

Sebastian Iancu

Components

Affects versions