summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/src/test_func.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libsqlite3/src/test_func.c')
-rw-r--r--lib/libsqlite3/src/test_func.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libsqlite3/src/test_func.c b/lib/libsqlite3/src/test_func.c
index c7850631d7b..2e34fa074ef 100644
--- a/lib/libsqlite3/src/test_func.c
+++ b/lib/libsqlite3/src/test_func.c
@@ -600,12 +600,26 @@ static void test_decode(
Tcl_DecrRefCount(pRet);
}
+/*
+** The implementation of scalar SQL function "test_zeroblob()". This is
+** similar to the built-in zeroblob() function, except that it does not
+** check that the integer parameter is within range before passing it
+** to sqlite3_result_zeroblob().
+*/
+static void test_zeroblob(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ int nZero = sqlite3_value_int(argv[0]);
+ sqlite3_result_zeroblob(context, nZero);
+}
static int registerTestFunctions(sqlite3 *db){
static const struct {
char *zName;
signed char nArg;
- unsigned char eTextRep; /* 1: UTF-16. 0: UTF-8 */
+ unsigned int eTextRep; /* 1: UTF-16. 0: UTF-8 */
void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
} aFuncs[] = {
{ "randstr", 2, SQLITE_UTF8, randStr },
@@ -626,6 +640,7 @@ static int registerTestFunctions(sqlite3 *db){
{ "real2hex", 1, SQLITE_UTF8, real2hex},
{ "test_decode", 1, SQLITE_UTF8, test_decode},
{ "test_extract", 2, SQLITE_UTF8, test_extract},
+ { "test_zeroblob", 1, SQLITE_UTF8|SQLITE_DETERMINISTIC, test_zeroblob},
};
int i;