Jump to content

Kexi/Plugins/Queries/SQL Functions: Difference between revisions

From KDE Community Wiki
Jstaniek (talk | contribs)
No edit summary
Jstaniek (talk | contribs)
Line 2: Line 2:


==Functions==
==Functions==
{{TableStart}}
{{KexiSQLFuncTableStart}}
! width=5 | Name
{{KexiSQLFuncRow|name=abs(X)
! width=100% | Description
|desc=
! width=10 | sqlite
|sqlite=
! width=10 | pgsql
|pg=
! width=10 | mysql
|my=
! width=10 | mssql
|ms=
! width=10 | xbase
|xb=
|- valign=top
}}
| | {{{name}}}
{{KexiSQLFuncRow|name=changes()
| | {{{desc}}}
|desc=
| | {{{sqlite}}}
|sqlite=
| | {{{pg}}}
|pg=
| | {{{my}}}
|my=
| | {{{ms}}}
|ms=
| | {{{xb}}}
|xb=
}}
{{KexiSQLFuncRow|name=char(X1,X2,...,XN)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=coalesce(X,Y,...)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=glob(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=ifnull(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=instr(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=hex(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=last_insert_rowid()
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=length(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=like(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=like(X,Y,Z)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=likelihood(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=likely(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=lower(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=ltrim(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=ltrim(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=max(X,Y,...)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=min(X,Y,...)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=nullif(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=printf(FORMAT,...)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=quote(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=random()
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=randomblob(N)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=replace(X,Y,Z)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=round(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=round(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=rtrim(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=rtrim(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=soundex(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=substr(X,Y,Z)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=substr(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=total_changes()
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=trim(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=trim(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=typeof(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=unlikely(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=unicode(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=upper(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=zeroblob(N)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
|}
 
 
==SQLite-specific Functions==
 
{{KexiSQLFuncTableStart}}
{{KexiSQLFuncRow|name=load_extension(X)<br/>load_ extension(X,Y)
|desc=Loads SQLite extensions out of the shared library file named X using the entry point Y. The result of [https://www.sqlite.org/loadext.html load_extension()] is always a NULL. If Y is omitted then the default entry point name is used. The load_extension() function raises an exception if the extension fails to load or initialize correctly.<br/>The load_extension() function will fail if the extension attempts to modify or delete an SQL function or collating sequence. The extension can add new functions or collating sequences, but cannot modify or delete existing functions or collating sequences because those functions and/or collating sequences might be used elsewhere in the currently running SQL statement. To load an extension that changes or deletes functions or collating sequences, use the [https://www.sqlite.org/c3ref/load_extension.html sqlite3_load_extension()] C-language API.<br/>For security reasons, extension loaded is turned off by default and must be enabled by a prior call to [https://www.sqlite.org/c3ref/enable_load_extension.html sqlite3_enable_load_extension()].
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=sqlite_ compileoption_ get(N)
|desc=A wrapper around the [https://www.sqlite.org/c3ref/compileoption_get.html sqlite3_compileoption_get()] C/C++ function. This routine returns the N-th compile-time option used to build SQLite or NULL if N is out of range. See also the [https://www.sqlite.org/pragma.html#pragma_compile_options compile_options] pragma.
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=sqlite_ compileoption_ used(X)
|desc=A wrapper around the [https://www.sqlite.org/c3ref/compileoption_get.html sqlite3_compileoption_used()] C/C++ function. When the argument X to sqlite_compileoption_used(X) is a string which is the name of a compile-time option, this routine returns true (1) or false (0) depending on whether or not that option was used during the build.
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=sqlite_ source_id()
|desc=Returns a string that identifies the specific version of the source code that was used to build the SQLite library. The string returned by [https://www.sqlite.org/c3ref/libversion.html sqlite_source_id()] begins with the date and time that the source code was checked in and is follows by an SHA1 hash that uniquely identifies the source tree. This function is an SQL wrapper around the sqlite3_sourceid() C interface.
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=sqlite_version()
|desc=Returns the version string for the SQLite library that is running. This function is an SQL wrapper around the [https://www.sqlite.org/c3ref/libversion.html sqlite3_libversion()] C-interface.
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
|}
|}



Revision as of 10:14, 11 December 2014

This page lists SQL functions that Kexi supports or wants to support. Aggregate functions are included. Support in particular SQL backends is compared (SQLite, PostgreSQL, MySQL). For practical reasons emphasis is put on concrete implementation instead of an SQL standard.

Functions

Name Description sqlite pgsql mysql mssql xbase
abs(X)
changes()
char(X1,X2,...,XN)
coalesce(X,Y,...)
glob(X,Y)
ifnull(X,Y)
instr(X,Y)
hex(X)
last_insert_rowid()
length(X)
like(X,Y)
like(X,Y,Z)
likelihood(X,Y)
likely(X)
lower(X)
ltrim(X)
ltrim(X,Y)
max(X,Y,...)
min(X,Y,...)
nullif(X,Y)
printf(FORMAT,...)
quote(X)
random()
randomblob(N)
replace(X,Y,Z)
round(X)
round(X,Y)
rtrim(X)
rtrim(X,Y)
soundex(X)
substr(X,Y,Z)
substr(X,Y)
total_changes()
trim(X)
trim(X,Y)
typeof(X)
unlikely(X)
unicode(X)
upper(X)
zeroblob(N)


SQLite-specific Functions

Name Description sqlite pgsql mysql mssql xbase
load_extension(X)
load_ extension(X,Y)
Loads SQLite extensions out of the shared library file named X using the entry point Y. The result of load_extension() is always a NULL. If Y is omitted then the default entry point name is used. The load_extension() function raises an exception if the extension fails to load or initialize correctly.
The load_extension() function will fail if the extension attempts to modify or delete an SQL function or collating sequence. The extension can add new functions or collating sequences, but cannot modify or delete existing functions or collating sequences because those functions and/or collating sequences might be used elsewhere in the currently running SQL statement. To load an extension that changes or deletes functions or collating sequences, use the sqlite3_load_extension() C-language API.
For security reasons, extension loaded is turned off by default and must be enabled by a prior call to sqlite3_enable_load_extension().
sqlite_ compileoption_ get(N) A wrapper around the sqlite3_compileoption_get() C/C++ function. This routine returns the N-th compile-time option used to build SQLite or NULL if N is out of range. See also the compile_options pragma.
sqlite_ compileoption_ used(X) A wrapper around the sqlite3_compileoption_used() C/C++ function. When the argument X to sqlite_compileoption_used(X) is a string which is the name of a compile-time option, this routine returns true (1) or false (0) depending on whether or not that option was used during the build.
sqlite_ source_id() Returns a string that identifies the specific version of the source code that was used to build the SQLite library. The string returned by sqlite_source_id() begins with the date and time that the source code was checked in and is follows by an SHA1 hash that uniquely identifies the source tree. This function is an SQL wrapper around the sqlite3_sourceid() C interface.
sqlite_version() Returns the version string for the SQLite library that is running. This function is an SQL wrapper around the sqlite3_libversion() C-interface.

Aggregate functions

Further work

Add comparison for other backends: Sybase/MSSQL, xBase.

Links