Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Unified Diff: third_party/sqlite/src/src/test_func.c

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/src/test_fs.c ('k') | third_party/sqlite/src/src/test_intarray.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/src/test_func.c
diff --git a/third_party/sqlite/src/src/test_func.c b/third_party/sqlite/src/src/test_func.c
index c7850631d7b213a8ff5346a0a215be1b748b36c6..63cf18e3f7639e585792f05260503894d092eb70 100644
--- a/third_party/sqlite/src/src/test_func.c
+++ b/third_party/sqlite/src/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
@@ -600,12 +600,53 @@ static void test_decode(
Tcl_DecrRefCount(pRet);
}
+/*
+** 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
+** 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);
+}
+
+/* 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;
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 +667,9 @@ 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},
+ { "test_getsubtype", 1, SQLITE_UTF8, test_getsubtype},
+ { "test_setsubtype", 2, SQLITE_UTF8, test_setsubtype},
};
int i;
« no previous file with comments | « third_party/sqlite/src/src/test_fs.c ('k') | third_party/sqlite/src/src/test_intarray.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698