diff options
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/func.c b/src/func.c index 688f50cff..2f30619de 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.39 2004/02/11 09:46:32 drh Exp $ +** $Id: func.c,v 1.40 2004/02/20 22:53:39 rdc Exp $ */ #include <ctype.h> #include <math.h> @@ -209,6 +209,16 @@ static void last_insert_rowid(sqlite_func *context, int arg, const char **argv){ sqlite_set_result_int(context, sqlite_last_insert_rowid(db)); } +static void change_count(sqlite_func *context, int arg, const char **argv){ + sqlite *db = sqlite_user_data(context); + sqlite_set_result_int(context, sqlite_changes(db)); +} +static void last_statement_change_count(sqlite_func *context, int arg, + const char **argv){ + sqlite *db = sqlite_user_data(context); + sqlite_set_result_int(context, sqlite_last_statement_changes(db)); +} + /* ** Implementation of the like() SQL function. This function implements ** the build-in LIKE operator. The first argument to the function is the @@ -613,6 +623,12 @@ void sqliteRegisterBuiltinFunctions(sqlite *db){ sqlite_create_function(db, "last_insert_rowid", 0, last_insert_rowid, db); sqlite_function_type(db, "last_insert_rowid", SQLITE_NUMERIC); + sqlite_create_function(db, "change_count", 0, change_count, db); + sqlite_function_type(db, "change_count", SQLITE_NUMERIC); + sqlite_create_function(db, "last_statement_change_count", 0, + last_statement_change_count, db); + sqlite_function_type(db, "last_statement_change_count", SQLITE_NUMERIC); + for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){ sqlite_create_aggregate(db, aAggs[i].zName, aAggs[i].nArg, aAggs[i].xStep, aAggs[i].xFinalize, 0); |