diff options
Diffstat (limited to 'lib/libsqlite3/src/test_func.c')
-rw-r--r-- | lib/libsqlite3/src/test_func.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/libsqlite3/src/test_func.c b/lib/libsqlite3/src/test_func.c index 2e34fa074ef..63cf18e3f76 100644 --- a/lib/libsqlite3/src/test_func.c +++ b/lib/libsqlite3/src/test_func.c @@ -462,7 +462,7 @@ static void real2hex( } /* -** tclcmd: test_extract(record, field) +** test_extract(record, field) ** ** This function implements an SQL user-function that accepts a blob ** containing a formatted database record as the first argument. The @@ -509,7 +509,7 @@ static void test_extract( } /* -** tclcmd: test_decode(record) +** test_decode(record) ** ** This function implements an SQL user-function that accepts a blob ** containing a formatted database record as its only argument. It returns @@ -601,6 +601,8 @@ static void test_decode( } /* +** test_zeroblob(N) +** ** 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 @@ -615,6 +617,31 @@ static void test_zeroblob( sqlite3_result_zeroblob(context, nZero); } +/* test_getsubtype(V) +** +** Return the subtype for value V. +*/ +static void test_getsubtype( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + sqlite3_result_int(context, (int)sqlite3_value_subtype(argv[0])); +} + +/* test_setsubtype(V, T) +** +** Return the value V with its subtype changed to T +*/ +static void test_setsubtype( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + sqlite3_result_value(context, argv[0]); + sqlite3_result_subtype(context, (unsigned int)sqlite3_value_int(argv[1])); +} + static int registerTestFunctions(sqlite3 *db){ static const struct { char *zName; @@ -641,6 +668,8 @@ static int registerTestFunctions(sqlite3 *db){ { "test_decode", 1, SQLITE_UTF8, test_decode}, { "test_extract", 2, SQLITE_UTF8, test_extract}, { "test_zeroblob", 1, SQLITE_UTF8|SQLITE_DETERMINISTIC, test_zeroblob}, + { "test_getsubtype", 1, SQLITE_UTF8, test_getsubtype}, + { "test_setsubtype", 2, SQLITE_UTF8, test_setsubtype}, }; int i; |