1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-07 20:22:20 +03:00

Add the (deliberately undocumented) sqlite_log() SQL function as a built-in.

FossilOrigin-Name: f7806e03995b314771aa72a08ce55d56d60096cf
This commit is contained in:
drh
2011-04-25 18:03:10 +00:00
parent 9a3baf10ca
commit 3ca84ef623
3 changed files with 23 additions and 7 deletions

View File

@@ -774,6 +774,21 @@ static void sourceidFunc(
sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC);
}
/*
** Implementation of the sqlite_log() function. This is a wrapper around
** sqlite3_log(). The return value is NULL. The function exists purely for
** its side-effects.
*/
static void logFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
UNUSED_PARAMETER(argc);
UNUSED_PARAMETER(context);
sqlite3_log(sqlite3_value_int(argv[0]), "%s", sqlite3_value_text(argv[1]));
}
/*
** Implementation of the sqlite_compileoption_used() function.
** The result is an integer that identifies if the compiler option
@@ -1541,6 +1556,7 @@ void sqlite3RegisterGlobalFunctions(void){
FUNCTION(nullif, 2, 0, 1, nullifFunc ),
FUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
FUNCTION(sqlite_log, 2, 0, 0, logFunc ),
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
FUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
FUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),