HTSQL has full complement of string, numeric, and date functions which are translated into equivalent SQL. Since each RDBMS has its own set of SQL functions and features of their implementation, exact behaviour of HTSQL functions may vary depending on underlying RDBMS system. Especially it concerns boundary cases and datatype implicit casting.
Functions in HTSQL have common function notation:
<function_name>(<argument-list>)
Arguments in argument-list are delimited with comma. Some of the functions have method-like notation:
<object>.<function_name>(<argument-list>)
In such a case object, which function is applied to is called context. For example, all string functions have string context. When used in selector, function’s context can be also specified using embedded selector syntax:
<object>{<function_name>(<argument-list>)}
Advantage of such a syntax is that you can specify several functions (or expressions in more general way) to apply to the single context. For example:
/{'Hello World'{lower(), upper(), label()}}
--->
hello world HELLO WORLD 'Hello World'
If function has several signatures, which differ in type of arguments, type of result or function context, signatures come consecutive in the same paragraph.
If function has context, it’s type is stated in function signature. For example:
string.length()
If argument is obligatory, it comes in square brackets ([ ]). For example:
string.substr(left[, length])
If argument or group of arguments may happen more than once, it comes in curly brackets followed by asterisk ({ }*). For example:
if({cond, value}*[, def])