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

From KDE Community Wiki
< Kexi‎ | Plugins‎ | Queries
No edit summary
No edit summary
Line 6: Line 6:
{{KexiSQLFuncTableStart}}
{{KexiSQLFuncTableStart}}
{{KexiSQLFuncRow|name=abs(X)
{{KexiSQLFuncRow|name=abs(X)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=changes()
|desc=
|desc=
|sqlite=
|sqlite=
Line 254: Line 246:
}}
}}
{{KexiSQLFuncRow|name=substr(X,Y)
{{KexiSQLFuncRow|name=substr(X,Y)
|desc=
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=total_changes()
|desc=
|desc=
|sqlite=
|sqlite=
Line 383: Line 367:


{{KexiSQLFuncTableStart}}
{{KexiSQLFuncTableStart}}
{{KexiSQLFuncRow|name=changes()
|desc=Returns the number of database rows that were changed or inserted or deleted by the most recently completed INSERT, DELETE, or UPDATE statement, exclusive of statements in lower-level triggers. The changes() SQL function is a wrapper around the [https://www.sqlite.org/c3ref/changes.html sqlite3_changes()] C/C++ function and hence follows the same rules for counting changes.
|sqlite=
|pg=
|my=
|ms=
|xb=
}}
{{KexiSQLFuncRow|name=load_extension(X)<br/>load_ extension(X,Y)
{{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()].
|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()].
Line 425: Line 417:
{{KexiSQLFuncRow|name=sqlite_version()
{{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.
|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=
}}
{{KexiSQLFuncRow|name=total_changes()
|desc=Returns the number of row changes caused by INSERT, UPDATE or DELETE statements since the current database connection was opened. This function is a wrapper around the [https://www.sqlite.org/c3ref/total_changes.html sqlite3_total_changes()] C/C++ interface.
|sqlite=
|sqlite=
|pg=
|pg=

Revision as of 10:42, 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 focusing on an SQL standard.

Functions


Name Description sqlite pgsql mysql mssql xbase
abs(X)
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)
trim(X)
trim(X,Y)
typeof(X)
unlikely(X)
unicode(X)
upper(X)
zeroblob(N)

Date And Time Functions


Name Description sqlite pgsql mysql mssql xbase
date(timestring, modifier, modifier, ...)
time(timestring, modifier, modifier, ...)
datetime(timestring, modifier, modifier, ...)
julianday(timestring, modifier, modifier, ...)
strftime(format, timestring, modifier, modifier, ...)

Aggregate functions


Name Description sqlite pgsql mysql mssql xbase

SQLite-specific Functions


Name Description sqlite pgsql mysql mssql xbase
changes() Returns the number of database rows that were changed or inserted or deleted by the most recently completed INSERT, DELETE, or UPDATE statement, exclusive of statements in lower-level triggers. The changes() SQL function is a wrapper around the sqlite3_changes() C/C++ function and hence follows the same rules for counting changes.
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.
total_changes() Returns the number of row changes caused by INSERT, UPDATE or DELETE statements since the current database connection was opened. This function is a wrapper around the sqlite3_total_changes() C/C++ interface.

Further work

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

Links