Skip to content
Snippets Groups Projects
Commit d09d012b authored by Jarosław Staniek's avatar Jarosław Staniek
Browse files

calligradb: Add support for 22 typical scalar SQL functions

BUG:352631

With minor exceptions these functions now work with SQLite, MySQL, PostgreSQL:
*abs(X)
*ceiling(X)
*char(X1,X2,...,XN)
*coalesce(X,Y,...)
*floor(X)
*greatest(X,Y,...) & alias max(X,Y,...)
*hex(X)
*ifnull(X,Y)
*instr(X,Y)
*least(X,Y,...) & alias min(X,Y,...)
*length(X)
*lower(X)
*ltrim(X) & ltrim(X,Y)
*nullif(X,Y)
*random() & random(X,Y)
*replace(X,Y,Z)
*round(X) & round(X,Y)
*rtrim(X) & rtrim(X,Y)
*soundex(X)
*trim(X) & trim(X,Y)
*unicode(X)
*upper(X)

In many cases substitute functions are used to make the result work in a portable way.

The implementation of function parser supports:
* checking number of arguments
* checking types of arguments, sometimes "any number" or "any text or BLOB"
* checking compatibility of arguments in function
* checking relation of value of arguments in function, e.g. value of the first argument smaller than second's
* checking NULL arguments in function; then most often the result is NULL
* argument overloading or optional arguments, e.g. round(X) and round(X,Y)
* displaying of human-readable error messages when the above constraints are not met, for example "Three arguments required" or "Function does not accept any arguments"
* easy extensibility using just a few lines of code

Note: no extra i18n added; will be added in a KDb port
parent b4d1753a
Loading
Showing
with 1466 additions and 62 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment