aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2023-12-11 19:00:44 +0000
committerdrh <>2023-12-11 19:00:44 +0000
commitba5505657f94d5eb6bb7f0bd294e0c0b35b50dae (patch)
tree1c92679f271cd3397cd20e7a868341891bfe16c0 /src
parent7d2eaae83e46ef5f41419bdd4934f7ed4217529b (diff)
downloadsqlite-ba5505657f94d5eb6bb7f0bd294e0c0b35b50dae.tar.gz
sqlite-ba5505657f94d5eb6bb7f0bd294e0c0b35b50dae.zip
Rename the new test-control to SQLITE_TESTCTRL_JSON_SELFCHECK. Make it so
that the current value of the setting can be interrogated. FossilOrigin-Name: 7aff1d9a4cb17ecd5abab21ab032f35a78741dd641ddd8cbcc85fc4a81a0707d
Diffstat (limited to 'src')
-rw-r--r--src/global.c2
-rw-r--r--src/json.c2
-rw-r--r--src/main.c15
-rw-r--r--src/shell.c.in12
-rw-r--r--src/sqlite.h.in2
-rw-r--r--src/sqliteInt.h2
6 files changed, 24 insertions, 11 deletions
diff --git a/src/global.c b/src/global.c
index 5db5565bf..7f27d91d1 100644
--- a/src/global.c
+++ b/src/global.c
@@ -245,7 +245,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
1, /* bExtraSchemaChecks */
sizeof(LONGDOUBLE_TYPE)>8, /* bUseLongDouble */
#ifdef SQLITE_DEBUG
- 0, /* bJsonbValidate */
+ 0, /* bJsonSelfcheck */
#endif
0x7ffffffe, /* mxStrlen */
0, /* neverCorrupt */
diff --git a/src/json.c b/src/json.c
index f800dc931..407705c01 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1876,7 +1876,7 @@ static int jsonConvertTextToBlob(
if( i>0 ){
#ifdef SQLITE_DEBUG
assert( pParse->iDepth==0 );
- if( sqlite3Config.bJsonbValidate ){
+ if( sqlite3Config.bJsonSelfcheck ){
assert( jsonbValidityCheck(pParse, 0, pParse->nBlob, 0)==0 );
}
#endif
diff --git a/src/main.c b/src/main.c
index 553e3dc2d..50572ef87 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4660,15 +4660,24 @@ int sqlite3_test_control(int op, ...){
}
#endif
- /* sqlite3_test_control(SQLITE_TESTCTRL_VALIDATE_JSONB, (u8)trueFalse);
+ /* sqlite3_test_control(SQLITE_TESTCTRL_JSON_SELFCHECK, &onOff);
**
** Activate or deactivate validation of JSONB that is generated from
** text. Off by default, as the validation is slow. Validation is
** only available if compiled using SQLITE_DEBUG.
+ **
+ ** If onOff is initially 1, then turn it on. If onOff is initially
+ ** off, turn it off. If onOff is initially -1, then change onOff
+ ** to be the current setting.
*/
- case SQLITE_TESTCTRL_VALIDATE_JSONB: {
+ case SQLITE_TESTCTRL_JSON_SELFCHECK: {
#if defined(SQLITE_DEBUG)
- sqlite3Config.bJsonbValidate = (u8)(va_arg(ap, int)&0xff);
+ int *pOnOff = va_arg(ap, int*);
+ if( *pOnOff<0 ){
+ *pOnOff = sqlite3Config.bJsonSelfcheck;
+ }else{
+ sqlite3Config.bJsonSelfcheck = (u8)((*pOnOff)&0xff);
+ }
#endif
break;
}
diff --git a/src/shell.c.in b/src/shell.c.in
index af7b1b6cf..35ed0cb5c 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -10756,6 +10756,7 @@ static int do_meta_command(char *zLine, ShellState *p){
{"fk_no_action", SQLITE_TESTCTRL_FK_NO_ACTION, 0, "BOOLEAN" },
{"imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
{"internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
+ {"json_selfcheck", SQLITE_TESTCTRL_JSON_SELFCHECK ,0,"BOOLEAN" },
{"localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" },
{"never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT,1, "BOOLEAN" },
{"optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS,0,"DISABLE-MASK" },
@@ -10770,7 +10771,6 @@ static int do_meta_command(char *zLine, ShellState *p){
{"sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
{"tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
{"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"?BOOLEAN|\"default\"?"},
- {"validate_jsonb", SQLITE_TESTCTRL_VALIDATE_JSONB,0, "BOOLEAN" },
};
int testctrl = -1;
int iCtrl = -1;
@@ -10975,11 +10975,15 @@ static int do_meta_command(char *zLine, ShellState *p){
isOk = 3;
}
break;
- case SQLITE_TESTCTRL_VALIDATE_JSONB:
- if( nArg==3 ){
- sqlite3_test_control(testctrl, booleanValue(azArg[2]));
+ case SQLITE_TESTCTRL_JSON_SELFCHECK:
+ if( nArg==2 ){
+ rc2 = -1;
+ isOk = 1;
+ }else{
+ rc2 = booleanValue(azArg[2]);
isOk = 3;
}
+ sqlite3_test_control(testctrl, &rc2);
break;
}
}
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 84af1c54e..1f5343814 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -8300,7 +8300,7 @@ int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_ASSERT 12
#define SQLITE_TESTCTRL_ALWAYS 13
#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
-#define SQLITE_TESTCTRL_VALIDATE_JSONB 14
+#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index f2846ca6d..83226b575 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -4178,7 +4178,7 @@ struct Sqlite3Config {
u8 bExtraSchemaChecks; /* Verify type,name,tbl_name in schema */
u8 bUseLongDouble; /* Make use of long double */
#ifdef SQLITE_DEBUG
- u8 bJsonbValidate; /* Double-check JSONB parsing */
+ u8 bJsonSelfcheck; /* Double-check JSON parsing */
#endif
int mxStrlen; /* Maximum string length */
int neverCorrupt; /* Database is always well-formed */