mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Experimental implementation of sqlite3_result_subtype() and
sqlite3_value_subtype() interfaces. FossilOrigin-Name: 7b5be299c617a3d3ed327ed30ef0a66a62c85b1f
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user