Fossil SCM

Update the built-in SQLite to the latest trunk version.

drh 2025-04-30 14:50 trunk
Commit 22b38448bd276676a8e02b8388ea7aba57b9e5efbcc979549f79133efb3c58a3
+37 -25
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -1622,34 +1622,10 @@
16221622
if( n>350 ) n = 350;
16231623
sqlite3_snprintf(sizeof(z), z, "%#+.*e", n, r);
16241624
sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
16251625
}
16261626
1627
-
1628
-/*
1629
-** SQL function: shell_module_schema(X)
1630
-**
1631
-** Return a fake schema for the table-valued function or eponymous virtual
1632
-** table X.
1633
-*/
1634
-static void shellModuleSchema(
1635
- sqlite3_context *pCtx,
1636
- int nVal,
1637
- sqlite3_value **apVal
1638
-){
1639
- const char *zName;
1640
- char *zFake;
1641
- UNUSED_PARAMETER(nVal);
1642
- zName = (const char*)sqlite3_value_text(apVal[0]);
1643
- zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
1644
- if( zFake ){
1645
- sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
1646
- -1, sqlite3_free);
1647
- free(zFake);
1648
- }
1649
-}
1650
-
16511627
/*
16521628
** SQL function: shell_add_schema(S,X)
16531629
**
16541630
** Add the schema name X to the CREATE statement in S and return the result.
16551631
** Examples:
@@ -18709,10 +18685,13 @@
1870918685
rc = sqlite3_create_module(db, "sqlite_dbptr", &dbdata_module, (void*)1);
1871018686
}
1871118687
return rc;
1871218688
}
1871318689
18690
+#ifdef _WIN32
18691
+
18692
+#endif
1871418693
int sqlite3_dbdata_init(
1871518694
sqlite3 *db,
1871618695
char **pzErrMsg,
1871718696
const sqlite3_api_routines *pApi
1871818697
){
@@ -25937,10 +25916,43 @@
2593725916
int sleep = sqlite3_value_int(argv[0]);
2593825917
(void)argcUnused;
2593925918
sqlite3_sleep(sleep/1000);
2594025919
sqlite3_result_int(context, sleep);
2594125920
}
25921
+
25922
+/*
25923
+** SQL function: shell_module_schema(X)
25924
+**
25925
+** Return a fake schema for the table-valued function or eponymous virtual
25926
+** table X.
25927
+*/
25928
+static void shellModuleSchema(
25929
+ sqlite3_context *pCtx,
25930
+ int nVal,
25931
+ sqlite3_value **apVal
25932
+){
25933
+ const char *zName;
25934
+ char *zFake;
25935
+ ShellState *p = (ShellState*)sqlite3_user_data(pCtx);
25936
+ FILE *pSavedLog = p->pLog;
25937
+ UNUSED_PARAMETER(nVal);
25938
+ zName = (const char*)sqlite3_value_text(apVal[0]);
25939
+
25940
+ /* Temporarily disable the ".log" when calling shellFakeSchema() because
25941
+ ** shellFakeSchema() might generate failures for some ephemeral virtual
25942
+ ** tables due to missing arguments. Example: fts4aux.
25943
+ ** https://sqlite.org/forum/forumpost/42fe6520b803be51 */
25944
+ p->pLog = 0;
25945
+ zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
25946
+ p->pLog = pSavedLog;
25947
+
25948
+ if( zFake ){
25949
+ sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
25950
+ -1, sqlite3_free);
25951
+ free(zFake);
25952
+ }
25953
+}
2594225954
2594325955
/* Flags for open_db().
2594425956
**
2594525957
** The default behavior of open_db() is to exit(1) if the database fails to
2594625958
** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
@@ -26081,11 +26093,11 @@
2608126093
shellDtostr, 0, 0);
2608226094
sqlite3_create_function(p->db, "dtostr", 2, SQLITE_UTF8, 0,
2608326095
shellDtostr, 0, 0);
2608426096
sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
2608526097
shellAddSchemaName, 0, 0);
26086
- sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
26098
+ sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, p,
2608726099
shellModuleSchema, 0, 0);
2608826100
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
2608926101
shellPutsFunc, 0, 0);
2609026102
sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
2609126103
shellUSleepFunc, 0, 0);
2609226104
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -1622,34 +1622,10 @@
1622 if( n>350 ) n = 350;
1623 sqlite3_snprintf(sizeof(z), z, "%#+.*e", n, r);
1624 sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
1625 }
1626
1627
1628 /*
1629 ** SQL function: shell_module_schema(X)
1630 **
1631 ** Return a fake schema for the table-valued function or eponymous virtual
1632 ** table X.
1633 */
1634 static void shellModuleSchema(
1635 sqlite3_context *pCtx,
1636 int nVal,
1637 sqlite3_value **apVal
1638 ){
1639 const char *zName;
1640 char *zFake;
1641 UNUSED_PARAMETER(nVal);
1642 zName = (const char*)sqlite3_value_text(apVal[0]);
1643 zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
1644 if( zFake ){
1645 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
1646 -1, sqlite3_free);
1647 free(zFake);
1648 }
1649 }
1650
1651 /*
1652 ** SQL function: shell_add_schema(S,X)
1653 **
1654 ** Add the schema name X to the CREATE statement in S and return the result.
1655 ** Examples:
@@ -18709,10 +18685,13 @@
18709 rc = sqlite3_create_module(db, "sqlite_dbptr", &dbdata_module, (void*)1);
18710 }
18711 return rc;
18712 }
18713
 
 
 
18714 int sqlite3_dbdata_init(
18715 sqlite3 *db,
18716 char **pzErrMsg,
18717 const sqlite3_api_routines *pApi
18718 ){
@@ -25937,10 +25916,43 @@
25937 int sleep = sqlite3_value_int(argv[0]);
25938 (void)argcUnused;
25939 sqlite3_sleep(sleep/1000);
25940 sqlite3_result_int(context, sleep);
25941 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25942
25943 /* Flags for open_db().
25944 **
25945 ** The default behavior of open_db() is to exit(1) if the database fails to
25946 ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
@@ -26081,11 +26093,11 @@
26081 shellDtostr, 0, 0);
26082 sqlite3_create_function(p->db, "dtostr", 2, SQLITE_UTF8, 0,
26083 shellDtostr, 0, 0);
26084 sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
26085 shellAddSchemaName, 0, 0);
26086 sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
26087 shellModuleSchema, 0, 0);
26088 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
26089 shellPutsFunc, 0, 0);
26090 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
26091 shellUSleepFunc, 0, 0);
26092
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -1622,34 +1622,10 @@
1622 if( n>350 ) n = 350;
1623 sqlite3_snprintf(sizeof(z), z, "%#+.*e", n, r);
1624 sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
1625 }
1626
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1627 /*
1628 ** SQL function: shell_add_schema(S,X)
1629 **
1630 ** Add the schema name X to the CREATE statement in S and return the result.
1631 ** Examples:
@@ -18709,10 +18685,13 @@
18685 rc = sqlite3_create_module(db, "sqlite_dbptr", &dbdata_module, (void*)1);
18686 }
18687 return rc;
18688 }
18689
18690 #ifdef _WIN32
18691
18692 #endif
18693 int sqlite3_dbdata_init(
18694 sqlite3 *db,
18695 char **pzErrMsg,
18696 const sqlite3_api_routines *pApi
18697 ){
@@ -25937,10 +25916,43 @@
25916 int sleep = sqlite3_value_int(argv[0]);
25917 (void)argcUnused;
25918 sqlite3_sleep(sleep/1000);
25919 sqlite3_result_int(context, sleep);
25920 }
25921
25922 /*
25923 ** SQL function: shell_module_schema(X)
25924 **
25925 ** Return a fake schema for the table-valued function or eponymous virtual
25926 ** table X.
25927 */
25928 static void shellModuleSchema(
25929 sqlite3_context *pCtx,
25930 int nVal,
25931 sqlite3_value **apVal
25932 ){
25933 const char *zName;
25934 char *zFake;
25935 ShellState *p = (ShellState*)sqlite3_user_data(pCtx);
25936 FILE *pSavedLog = p->pLog;
25937 UNUSED_PARAMETER(nVal);
25938 zName = (const char*)sqlite3_value_text(apVal[0]);
25939
25940 /* Temporarily disable the ".log" when calling shellFakeSchema() because
25941 ** shellFakeSchema() might generate failures for some ephemeral virtual
25942 ** tables due to missing arguments. Example: fts4aux.
25943 ** https://sqlite.org/forum/forumpost/42fe6520b803be51 */
25944 p->pLog = 0;
25945 zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
25946 p->pLog = pSavedLog;
25947
25948 if( zFake ){
25949 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
25950 -1, sqlite3_free);
25951 free(zFake);
25952 }
25953 }
25954
25955 /* Flags for open_db().
25956 **
25957 ** The default behavior of open_db() is to exit(1) if the database fails to
25958 ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
@@ -26081,11 +26093,11 @@
26093 shellDtostr, 0, 0);
26094 sqlite3_create_function(p->db, "dtostr", 2, SQLITE_UTF8, 0,
26095 shellDtostr, 0, 0);
26096 sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
26097 shellAddSchemaName, 0, 0);
26098 sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, p,
26099 shellModuleSchema, 0, 0);
26100 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
26101 shellPutsFunc, 0, 0);
26102 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
26103 shellUSleepFunc, 0, 0);
26104
+165 -115
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** d22475b81c4e26ccc50f3b5626d43b32f7a2 with changes in files:
21
+** 20abf1ec107f942e4527901685d61283c9c2 with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465465
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466466
** [sqlite_version()] and [sqlite_source_id()].
467467
*/
468468
#define SQLITE_VERSION "3.50.0"
469469
#define SQLITE_VERSION_NUMBER 3050000
470
-#define SQLITE_SOURCE_ID "2025-04-15 21:59:38 d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5"
470
+#define SQLITE_SOURCE_ID "2025-04-30 14:37:00 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849"
471471
472472
/*
473473
** CAPI3REF: Run-Time Library Version Numbers
474474
** KEYWORDS: sqlite3_version sqlite3_sourceid
475475
**
@@ -11872,13 +11872,14 @@
1187211872
** This may appear to have some counter-intuitive effects if a single row
1187311873
** is written to more than once during a session. For example, if a row
1187411874
** is inserted while a session object is enabled, then later deleted while
1187511875
** the same session object is disabled, no INSERT record will appear in the
1187611876
** changeset, even though the delete took place while the session was disabled.
11877
-** Or, if one field of a row is updated while a session is disabled, and
11878
-** another field of the same row is updated while the session is enabled, the
11879
-** resulting changeset will contain an UPDATE change that updates both fields.
11877
+** Or, if one field of a row is updated while a session is enabled, and
11878
+** then another field of the same row is updated while the session is disabled,
11879
+** the resulting changeset will contain an UPDATE change that updates both
11880
+** fields.
1188011881
*/
1188111882
SQLITE_API int sqlite3session_changeset(
1188211883
sqlite3_session *pSession, /* Session object */
1188311884
int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
1188411885
void **ppChangeset /* OUT: Buffer containing changeset */
@@ -32987,10 +32988,19 @@
3298732988
va_end(ap);
3298832989
zBuf[acc.nChar] = 0;
3298932990
return zBuf;
3299032991
}
3299132992
32993
+/* Maximum size of an sqlite3_log() message. */
32994
+#if defined(SQLITE_MAX_LOG_MESSAGE)
32995
+ /* Leave the definition as supplied */
32996
+#elif SQLITE_PRINT_BUF_SIZE*10>10000
32997
+# define SQLITE_MAX_LOG_MESSAGE 10000
32998
+#else
32999
+# define SQLITE_MAX_LOG_MESSAGE (SQLITE_PRINT_BUF_SIZE*10)
33000
+#endif
33001
+
3299233002
/*
3299333003
** This is the routine that actually formats the sqlite3_log() message.
3299433004
** We house it in a separate routine from sqlite3_log() to avoid using
3299533005
** stack space on small-stack systems when logging is disabled.
3299633006
**
@@ -33003,11 +33013,11 @@
3300333013
** Care must be taken that any sqlite3_log() calls that occur while the
3300433014
** memory mutex is held do not use these mechanisms.
3300533015
*/
3300633016
static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
3300733017
StrAccum acc; /* String accumulator */
33008
- char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
33018
+ char zMsg[SQLITE_MAX_LOG_MESSAGE]; /* Complete log message */
3300933019
3301033020
sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
3301133021
sqlite3_str_vappendf(&acc, zFormat, ap);
3301233022
sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,
3301333023
sqlite3StrAccumFinish(&acc));
@@ -95716,11 +95726,11 @@
9571695726
}
9571795727
}else{
9571895728
sqlite3VdbeError(p, "%s", pOp->p4.z);
9571995729
}
9572095730
pcx = (int)(pOp - aOp);
95721
- sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg);
95731
+ sqlite3_log(pOp->p1, "abort at %d: %s; [%s]", pcx, p->zErrMsg, p->zSql);
9572295732
}
9572395733
rc = sqlite3VdbeHalt(p);
9572495734
assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );
9572595735
if( rc==SQLITE_BUSY ){
9572695736
p->rc = SQLITE_BUSY;
@@ -97042,11 +97052,11 @@
9704297052
pOut->u.i = ~sqlite3VdbeIntValue(pIn1);
9704397053
}
9704497054
break;
9704597055
}
9704697056
97047
-/* Opcode: Once P1 P2 * * *
97057
+/* Opcode: Once P1 P2 P3 * *
9704897058
**
9704997059
** Fall through to the next instruction the first time this opcode is
9705097060
** encountered on each invocation of the byte-code program. Jump to P2
9705197061
** on the second and all subsequent encounters during the same invocation.
9705297062
**
@@ -97058,10 +97068,16 @@
9705897068
**
9705997069
** For subprograms, there is a bitmask in the VdbeFrame that determines
9706097070
** whether or not the jump should be taken. The bitmask is necessary
9706197071
** because the self-altering code trick does not work for recursive
9706297072
** triggers.
97073
+**
97074
+** The P3 operand is not used directly by this opcode. However P3 is
97075
+** used by the code generator as follows: If this opcode is the start
97076
+** of a subroutine and that subroutine uses a Bloom filter, then P3 will
97077
+** be the register that holds that Bloom filter. See tag-202407032019
97078
+** in the source code for implementation details.
9706397079
*/
9706497080
case OP_Once: { /* jump */
9706597081
u32 iAddr; /* Address of this instruction */
9706697082
assert( p->aOp[0].opcode==OP_Init );
9706797083
if( p->pFrame ){
@@ -103551,12 +103567,12 @@
103551103567
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
103552103568
}
103553103569
p->rc = rc;
103554103570
sqlite3SystemError(db, rc);
103555103571
testcase( sqlite3GlobalConfig.xLog!=0 );
103556
- sqlite3_log(rc, "statement aborts at %d: [%s] %s",
103557
- (int)(pOp - aOp), p->zSql, p->zErrMsg);
103572
+ sqlite3_log(rc, "statement aborts at %d: %s; [%s]",
103573
+ (int)(pOp - aOp), p->zErrMsg, p->zSql);
103558103574
if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
103559103575
if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
103560103576
if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){
103561103577
db->flags |= SQLITE_CorruptRdOnly;
103562103578
}
@@ -114022,15 +114038,16 @@
114022114038
pCopy = sqlite3SelectDup(pParse->db, pSelect, 0);
114023114039
rc = pParse->db->mallocFailed ? 1 :sqlite3Select(pParse, pCopy, &dest);
114024114040
sqlite3SelectDelete(pParse->db, pCopy);
114025114041
sqlite3DbFree(pParse->db, dest.zAffSdst);
114026114042
if( addrBloom ){
114043
+ /* Remember that location of the Bloom filter in the P3 operand
114044
+ ** of the OP_Once that began this subroutine. tag-202407032019 */
114027114045
sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2;
114028114046
if( dest.iSDParm2==0 ){
114029
- sqlite3VdbeChangeToNoop(v, addrBloom);
114030
- }else{
114031
- sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2;
114047
+ /* If the Bloom filter won't actually be used, keep it small */
114048
+ sqlite3VdbeGetOp(v, addrBloom)->p1 = 10;
114032114049
}
114033114050
}
114034114051
if( rc ){
114035114052
sqlite3KeyInfoUnref(pKeyInfo);
114036114053
return;
@@ -114473,11 +114490,11 @@
114473114490
if( destIfFalse==destIfNull ){
114474114491
/* Combine Step 3 and Step 5 into a single opcode */
114475114492
if( ExprHasProperty(pExpr, EP_Subrtn) ){
114476114493
const VdbeOp *pOp = sqlite3VdbeGetOp(v, pExpr->y.sub.iAddr);
114477114494
assert( pOp->opcode==OP_Once || pParse->nErr );
114478
- if( pOp->opcode==OP_Once && pOp->p3>0 ){
114495
+ if( pOp->opcode==OP_Once && pOp->p3>0 ){ /* tag-202407032019 */
114479114496
assert( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) );
114480114497
sqlite3VdbeAddOp4Int(v, OP_Filter, pOp->p3, destIfFalse,
114481114498
rLhs, nVector); VdbeCoverage(v);
114482114499
}
114483114500
}
@@ -124091,11 +124108,11 @@
124091124108
*/
124092124109
SQLITE_PRIVATE int sqlite3TableColumnToIndex(Index *pIdx, int iCol){
124093124110
int i;
124094124111
i16 iCol16;
124095124112
assert( iCol>=(-1) && iCol<=SQLITE_MAX_COLUMN );
124096
- assert( pIdx->nColumn<=SQLITE_MAX_COLUMN );
124113
+ assert( pIdx->nColumn<=SQLITE_MAX_COLUMN+1 );
124097124114
iCol16 = iCol;
124098124115
for(i=0; i<pIdx->nColumn; i++){
124099124116
if( iCol16==pIdx->aiColumn[i] ){
124100124117
return i;
124101124118
}
@@ -207968,60 +207985,113 @@
207968207985
** Growing our own isspace() routine this way is twice as fast as
207969207986
** the library isspace() function, resulting in a 7% overall performance
207970207987
** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
207971207988
*/
207972207989
static const char jsonIsSpace[] = {
207973
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
207974
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207975
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207976
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207977
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207978
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207979
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207980
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207981
-
207982
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207983
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207984
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207985
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207986
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207987
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207988
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207989
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207990
+#ifdef SQLITE_ASCII
207991
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
207992
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, /* 0 */
207993
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
207994
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
207995
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3 */
207996
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4 */
207997
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5 */
207998
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6 */
207999
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7 */
208000
+
208001
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 8 */
208002
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9 */
208003
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a */
208004
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b */
208005
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c */
208006
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */
208007
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e */
208008
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f */
208009
+#endif
208010
+#ifdef SQLITE_EBCDIC
208011
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
208012
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, /* 0 */
208013
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
208014
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
208015
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3 */
208016
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4 */
208017
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5 */
208018
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6 */
208019
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7 */
208020
+
208021
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 8 */
208022
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9 */
208023
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a */
208024
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b */
208025
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c */
208026
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */
208027
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e */
208028
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f */
208029
+#endif
208030
+
207990208031
};
207991208032
#define jsonIsspace(x) (jsonIsSpace[(unsigned char)x])
207992208033
207993208034
/*
207994208035
** The set of all space characters recognized by jsonIsspace().
207995208036
** Useful as the second argument to strspn().
207996208037
*/
208038
+#ifdef SQLITE_ASCII
207997208039
static const char jsonSpaces[] = "\011\012\015\040";
208040
+#endif
208041
+#ifdef SQLITE_EBCDIC
208042
+static const char jsonSpaces[] = "\005\045\015\100";
208043
+#endif
208044
+
207998208045
207999208046
/*
208000208047
** Characters that are special to JSON. Control characters,
208001208048
** '"' and '\\' and '\''. Actually, '\'' is not special to
208002208049
** canonical JSON, but it is special in JSON-5, so we include
208003208050
** it in the set of special characters.
208004208051
*/
208005208052
static const char jsonIsOk[256] = {
208006
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208007
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208008
- 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
208009
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208010
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208011
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
208012
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208013
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208014
-
208015
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208016
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208017
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208018
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208019
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208020
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208021
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208022
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
208053
+#ifdef SQLITE_ASCII
208054
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
208055
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 */
208056
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
208057
+ 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 2 */
208058
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 3 */
208059
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */
208060
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, /* 5 */
208061
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */
208062
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */
208063
+
208064
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */
208065
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */
208066
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */
208067
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */
208068
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */
208069
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */
208070
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */
208071
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f */
208072
+#endif
208073
+#ifdef SQLITE_EBCDIC
208074
+/*0 1 2 3 4 5 6 7 8 9 a b c d e f */
208075
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 */
208076
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
208077
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
208078
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* 3 */
208079
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */
208080
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 5 */
208081
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */
208082
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, /* 7 */
208083
+
208084
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */
208085
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */
208086
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */
208087
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */
208088
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */
208089
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */
208090
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */
208091
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f */
208092
+#endif
208023208093
};
208024208094
208025208095
/* Objects */
208026208096
typedef struct JsonCache JsonCache;
208027208097
typedef struct JsonString JsonString;
@@ -208162,11 +208232,11 @@
208162208232
208163208233
/**************************************************************************
208164208234
** Forward references
208165208235
**************************************************************************/
208166208236
static void jsonReturnStringAsBlob(JsonString*);
208167
-static int jsonFuncArgMightBeBinary(sqlite3_value *pJson);
208237
+static int jsonArgIsJsonb(sqlite3_value *pJson, JsonParse *p);
208168208238
static u32 jsonTranslateBlobToText(const JsonParse*,u32,JsonString*);
208169208239
static void jsonReturnParse(sqlite3_context*,JsonParse*);
208170208240
static JsonParse *jsonParseFuncArg(sqlite3_context*,sqlite3_value*,u32);
208171208241
static void jsonParseFree(JsonParse*);
208172208242
static u32 jsonbPayloadSize(const JsonParse*, u32, u32*);
@@ -208580,15 +208650,13 @@
208580208650
jsonAppendString(p, z, n);
208581208651
}
208582208652
break;
208583208653
}
208584208654
default: {
208585
- if( jsonFuncArgMightBeBinary(pValue) ){
208586
- JsonParse px;
208587
- memset(&px, 0, sizeof(px));
208588
- px.aBlob = (u8*)sqlite3_value_blob(pValue);
208589
- px.nBlob = sqlite3_value_bytes(pValue);
208655
+ JsonParse px;
208656
+ memset(&px, 0, sizeof(px));
208657
+ if( jsonArgIsJsonb(pValue, &px) ){
208590208658
jsonTranslateBlobToText(&px, 0, p);
208591208659
}else if( p->eErr==0 ){
208592208660
sqlite3_result_error(p->pCtx, "JSON cannot hold BLOB values", -1);
208593208661
p->eErr = JSTRING_ERR;
208594208662
jsonStringReset(p);
@@ -210258,37 +210326,10 @@
210258210326
}
210259210327
}
210260210328
return i;
210261210329
}
210262210330
210263
-
210264
-/* Return true if the input pJson
210265
-**
210266
-** For performance reasons, this routine does not do a detailed check of the
210267
-** input BLOB to ensure that it is well-formed. Hence, false positives are
210268
-** possible. False negatives should never occur, however.
210269
-*/
210270
-static int jsonFuncArgMightBeBinary(sqlite3_value *pJson){
210271
- u32 sz, n;
210272
- const u8 *aBlob;
210273
- int nBlob;
210274
- JsonParse s;
210275
- if( sqlite3_value_type(pJson)!=SQLITE_BLOB ) return 0;
210276
- aBlob = sqlite3_value_blob(pJson);
210277
- nBlob = sqlite3_value_bytes(pJson);
210278
- if( nBlob<1 ) return 0;
210279
- if( NEVER(aBlob==0) || (aBlob[0] & 0x0f)>JSONB_OBJECT ) return 0;
210280
- memset(&s, 0, sizeof(s));
210281
- s.aBlob = (u8*)aBlob;
210282
- s.nBlob = nBlob;
210283
- n = jsonbPayloadSize(&s, 0, &sz);
210284
- if( n==0 ) return 0;
210285
- if( sz+n!=(u32)nBlob ) return 0;
210286
- if( (aBlob[0] & 0x0f)<=JSONB_FALSE && sz>0 ) return 0;
210287
- return sz+n==(u32)nBlob;
210288
-}
210289
-
210290210331
/*
210291210332
** Given that a JSONB_ARRAY object starts at offset i, return
210292210333
** the number of entries in that array.
210293210334
*/
210294210335
static u32 jsonbArrayCount(JsonParse *pParse, u32 iRoot){
@@ -211112,14 +211153,11 @@
211112211153
pParse->aBlob = aNull;
211113211154
pParse->nBlob = 1;
211114211155
return 0;
211115211156
}
211116211157
case SQLITE_BLOB: {
211117
- if( jsonFuncArgMightBeBinary(pArg) ){
211118
- pParse->aBlob = (u8*)sqlite3_value_blob(pArg);
211119
- pParse->nBlob = sqlite3_value_bytes(pArg);
211120
- }else{
211158
+ if( !jsonArgIsJsonb(pArg, pParse) ){
211121211159
sqlite3_result_error(ctx, "JSON cannot hold BLOB values", -1);
211122211160
return 1;
211123211161
}
211124211162
break;
211125211163
}
@@ -211266,31 +211304,50 @@
211266211304
}
211267211305
211268211306
/*
211269211307
** If pArg is a blob that seems like a JSONB blob, then initialize
211270211308
** p to point to that JSONB and return TRUE. If pArg does not seem like
211271
-** a JSONB blob, then return FALSE;
211309
+** a JSONB blob, then return FALSE.
211272211310
**
211273
-** This routine is only called if it is already known that pArg is a
211274
-** blob. The only open question is whether or not the blob appears
211275
-** to be a JSONB blob.
211311
+** For small BLOBs (having no more than 7 bytes of payload) a full
211312
+** validity check is done. So for small BLOBs this routine only returns
211313
+** true if the value is guaranteed to be a valid JSONB. For larger BLOBs
211314
+** (8 byte or more of payload) only the size of the outermost element is
211315
+** checked to verify that the BLOB is superficially valid JSONB.
211316
+**
211317
+** A full JSONB validation is done on smaller BLOBs because those BLOBs might
211318
+** also be text JSON that has been incorrectly cast into a BLOB.
211319
+** (See tag-20240123-a and https://sqlite.org/forum/forumpost/012136abd5)
211320
+** If the BLOB is 9 bytes are larger, then it is not possible for the
211321
+** superficial size check done here to pass if the input is really text
211322
+** JSON so we do not need to look deeper in that case.
211323
+**
211324
+** Why we only need to do full JSONB validation for smaller BLOBs:
211325
+**
211326
+** The first byte of valid JSON text must be one of: '{', '[', '"', ' ', '\n',
211327
+** '\r', '\t', '-', or a digit '0' through '9'. Of these, only a subset
211328
+** can also be the first byte of JSONB: '{', '[', and digits '3'
211329
+** through '9'. In every one of those cases, the payload size is 7 bytes
211330
+** or less. So if we do full JSONB validation for every BLOB where the
211331
+** payload is less than 7 bytes, we will never get a false positive for
211332
+** JSONB on an input that is really text JSON.
211276211333
*/
211277211334
static int jsonArgIsJsonb(sqlite3_value *pArg, JsonParse *p){
211278211335
u32 n, sz = 0;
211336
+ u8 c;
211337
+ if( sqlite3_value_type(pArg)!=SQLITE_BLOB ) return 0;
211279211338
p->aBlob = (u8*)sqlite3_value_blob(pArg);
211280211339
p->nBlob = (u32)sqlite3_value_bytes(pArg);
211281
- if( p->nBlob==0 ){
211282
- p->aBlob = 0;
211283
- return 0;
211284
- }
211285
- if( NEVER(p->aBlob==0) ){
211286
- return 0;
211287
- }
211288
- if( (p->aBlob[0] & 0x0f)<=JSONB_OBJECT
211340
+ if( p->nBlob>0
211341
+ && ALWAYS(p->aBlob!=0)
211342
+ && ((c = p->aBlob[0]) & 0x0f)<=JSONB_OBJECT
211289211343
&& (n = jsonbPayloadSize(p, 0, &sz))>0
211290211344
&& sz+n==p->nBlob
211291
- && ((p->aBlob[0] & 0x0f)>JSONB_FALSE || sz==0)
211345
+ && ((c & 0x0f)>JSONB_FALSE || sz==0)
211346
+ && (sz>7
211347
+ || (c!=0x7b && c!=0x5b && !sqlite3Isdigit(c))
211348
+ || jsonbValidityCheck(p, 0, p->nBlob, 1)==0)
211292211349
){
211293211350
return 1;
211294211351
}
211295211352
p->aBlob = 0;
211296211353
p->nBlob = 0;
@@ -212379,25 +212436,21 @@
212379212436
sqlite3_result_int(ctx, 0);
212380212437
#endif
212381212438
return;
212382212439
}
212383212440
case SQLITE_BLOB: {
212384
- if( jsonFuncArgMightBeBinary(argv[0]) ){
212441
+ JsonParse py;
212442
+ memset(&py, 0, sizeof(py));
212443
+ if( jsonArgIsJsonb(argv[0], &py) ){
212385212444
if( flags & 0x04 ){
212386212445
/* Superficial checking only - accomplished by the
212387
- ** jsonFuncArgMightBeBinary() call above. */
212446
+ ** jsonArgIsJsonb() call above. */
212388212447
res = 1;
212389212448
}else if( flags & 0x08 ){
212390212449
/* Strict checking. Check by translating BLOB->TEXT->BLOB. If
212391212450
** no errors occur, call that a "strict check". */
212392
- JsonParse px;
212393
- u32 iErr;
212394
- memset(&px, 0, sizeof(px));
212395
- px.aBlob = (u8*)sqlite3_value_blob(argv[0]);
212396
- px.nBlob = sqlite3_value_bytes(argv[0]);
212397
- iErr = jsonbValidityCheck(&px, 0, px.nBlob, 1);
212398
- res = iErr==0;
212451
+ res = 0==jsonbValidityCheck(&py, 0, py.nBlob, 1);
212399212452
}
212400212453
break;
212401212454
}
212402212455
/* Fall through into interpreting the input as text. See note
212403212456
** above at tag-20240123-a. */
@@ -212451,13 +212504,11 @@
212451212504
212452212505
assert( argc==1 );
212453212506
UNUSED_PARAMETER(argc);
212454212507
memset(&s, 0, sizeof(s));
212455212508
s.db = sqlite3_context_db_handle(ctx);
212456
- if( jsonFuncArgMightBeBinary(argv[0]) ){
212457
- s.aBlob = (u8*)sqlite3_value_blob(argv[0]);
212458
- s.nBlob = sqlite3_value_bytes(argv[0]);
212509
+ if( jsonArgIsJsonb(argv[0], &s) ){
212459212510
iErrPos = (i64)jsonbValidityCheck(&s, 0, s.nBlob, 1);
212460212511
}else{
212461212512
s.zJson = (char*)sqlite3_value_text(argv[0]);
212462212513
if( s.zJson==0 ) return; /* NULL input or OOM */
212463212514
s.nJson = sqlite3_value_bytes(argv[0]);
@@ -213138,13 +213189,12 @@
213138213189
jsonEachCursorReset(p);
213139213190
if( idxNum==0 ) return SQLITE_OK;
213140213191
memset(&p->sParse, 0, sizeof(p->sParse));
213141213192
p->sParse.nJPRef = 1;
213142213193
p->sParse.db = p->db;
213143
- if( jsonFuncArgMightBeBinary(argv[0]) ){
213144
- p->sParse.nBlob = sqlite3_value_bytes(argv[0]);
213145
- p->sParse.aBlob = (u8*)sqlite3_value_blob(argv[0]);
213194
+ if( jsonArgIsJsonb(argv[0], &p->sParse) ){
213195
+ /* We have JSONB */
213146213196
}else{
213147213197
p->sParse.zJson = (char*)sqlite3_value_text(argv[0]);
213148213198
p->sParse.nJson = sqlite3_value_bytes(argv[0]);
213149213199
if( p->sParse.zJson==0 ){
213150213200
p->i = p->iEnd = 0;
@@ -257213,11 +257263,11 @@
257213257263
int nArg, /* Number of args */
257214257264
sqlite3_value **apUnused /* Function arguments */
257215257265
){
257216257266
assert( nArg==0 );
257217257267
UNUSED_PARAM2(nArg, apUnused);
257218
- sqlite3_result_text(pCtx, "fts5: 2025-04-15 21:59:38 d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5", -1, SQLITE_TRANSIENT);
257268
+ sqlite3_result_text(pCtx, "fts5: 2025-04-30 14:37:00 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849", -1, SQLITE_TRANSIENT);
257219257269
}
257220257270
257221257271
/*
257222257272
** Implementation of fts5_locale(LOCALE, TEXT) function.
257223257273
**
257224257274
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** d22475b81c4e26ccc50f3b5626d43b32f7a2 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.50.0"
469 #define SQLITE_VERSION_NUMBER 3050000
470 #define SQLITE_SOURCE_ID "2025-04-15 21:59:38 d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -11872,13 +11872,14 @@
11872 ** This may appear to have some counter-intuitive effects if a single row
11873 ** is written to more than once during a session. For example, if a row
11874 ** is inserted while a session object is enabled, then later deleted while
11875 ** the same session object is disabled, no INSERT record will appear in the
11876 ** changeset, even though the delete took place while the session was disabled.
11877 ** Or, if one field of a row is updated while a session is disabled, and
11878 ** another field of the same row is updated while the session is enabled, the
11879 ** resulting changeset will contain an UPDATE change that updates both fields.
 
11880 */
11881 SQLITE_API int sqlite3session_changeset(
11882 sqlite3_session *pSession, /* Session object */
11883 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
11884 void **ppChangeset /* OUT: Buffer containing changeset */
@@ -32987,10 +32988,19 @@
32987 va_end(ap);
32988 zBuf[acc.nChar] = 0;
32989 return zBuf;
32990 }
32991
 
 
 
 
 
 
 
 
 
32992 /*
32993 ** This is the routine that actually formats the sqlite3_log() message.
32994 ** We house it in a separate routine from sqlite3_log() to avoid using
32995 ** stack space on small-stack systems when logging is disabled.
32996 **
@@ -33003,11 +33013,11 @@
33003 ** Care must be taken that any sqlite3_log() calls that occur while the
33004 ** memory mutex is held do not use these mechanisms.
33005 */
33006 static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
33007 StrAccum acc; /* String accumulator */
33008 char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
33009
33010 sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
33011 sqlite3_str_vappendf(&acc, zFormat, ap);
33012 sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,
33013 sqlite3StrAccumFinish(&acc));
@@ -95716,11 +95726,11 @@
95716 }
95717 }else{
95718 sqlite3VdbeError(p, "%s", pOp->p4.z);
95719 }
95720 pcx = (int)(pOp - aOp);
95721 sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg);
95722 }
95723 rc = sqlite3VdbeHalt(p);
95724 assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );
95725 if( rc==SQLITE_BUSY ){
95726 p->rc = SQLITE_BUSY;
@@ -97042,11 +97052,11 @@
97042 pOut->u.i = ~sqlite3VdbeIntValue(pIn1);
97043 }
97044 break;
97045 }
97046
97047 /* Opcode: Once P1 P2 * * *
97048 **
97049 ** Fall through to the next instruction the first time this opcode is
97050 ** encountered on each invocation of the byte-code program. Jump to P2
97051 ** on the second and all subsequent encounters during the same invocation.
97052 **
@@ -97058,10 +97068,16 @@
97058 **
97059 ** For subprograms, there is a bitmask in the VdbeFrame that determines
97060 ** whether or not the jump should be taken. The bitmask is necessary
97061 ** because the self-altering code trick does not work for recursive
97062 ** triggers.
 
 
 
 
 
 
97063 */
97064 case OP_Once: { /* jump */
97065 u32 iAddr; /* Address of this instruction */
97066 assert( p->aOp[0].opcode==OP_Init );
97067 if( p->pFrame ){
@@ -103551,12 +103567,12 @@
103551 sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
103552 }
103553 p->rc = rc;
103554 sqlite3SystemError(db, rc);
103555 testcase( sqlite3GlobalConfig.xLog!=0 );
103556 sqlite3_log(rc, "statement aborts at %d: [%s] %s",
103557 (int)(pOp - aOp), p->zSql, p->zErrMsg);
103558 if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
103559 if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
103560 if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){
103561 db->flags |= SQLITE_CorruptRdOnly;
103562 }
@@ -114022,15 +114038,16 @@
114022 pCopy = sqlite3SelectDup(pParse->db, pSelect, 0);
114023 rc = pParse->db->mallocFailed ? 1 :sqlite3Select(pParse, pCopy, &dest);
114024 sqlite3SelectDelete(pParse->db, pCopy);
114025 sqlite3DbFree(pParse->db, dest.zAffSdst);
114026 if( addrBloom ){
 
 
114027 sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2;
114028 if( dest.iSDParm2==0 ){
114029 sqlite3VdbeChangeToNoop(v, addrBloom);
114030 }else{
114031 sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2;
114032 }
114033 }
114034 if( rc ){
114035 sqlite3KeyInfoUnref(pKeyInfo);
114036 return;
@@ -114473,11 +114490,11 @@
114473 if( destIfFalse==destIfNull ){
114474 /* Combine Step 3 and Step 5 into a single opcode */
114475 if( ExprHasProperty(pExpr, EP_Subrtn) ){
114476 const VdbeOp *pOp = sqlite3VdbeGetOp(v, pExpr->y.sub.iAddr);
114477 assert( pOp->opcode==OP_Once || pParse->nErr );
114478 if( pOp->opcode==OP_Once && pOp->p3>0 ){
114479 assert( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) );
114480 sqlite3VdbeAddOp4Int(v, OP_Filter, pOp->p3, destIfFalse,
114481 rLhs, nVector); VdbeCoverage(v);
114482 }
114483 }
@@ -124091,11 +124108,11 @@
124091 */
124092 SQLITE_PRIVATE int sqlite3TableColumnToIndex(Index *pIdx, int iCol){
124093 int i;
124094 i16 iCol16;
124095 assert( iCol>=(-1) && iCol<=SQLITE_MAX_COLUMN );
124096 assert( pIdx->nColumn<=SQLITE_MAX_COLUMN );
124097 iCol16 = iCol;
124098 for(i=0; i<pIdx->nColumn; i++){
124099 if( iCol16==pIdx->aiColumn[i] ){
124100 return i;
124101 }
@@ -207968,60 +207985,113 @@
207968 ** Growing our own isspace() routine this way is twice as fast as
207969 ** the library isspace() function, resulting in a 7% overall performance
207970 ** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
207971 */
207972 static const char jsonIsSpace[] = {
207973 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
207974 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207975 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207976 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207977 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207978 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207979 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207980 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207981
207982 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207983 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207984 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207985 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207986 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207987 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207988 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207990 };
207991 #define jsonIsspace(x) (jsonIsSpace[(unsigned char)x])
207992
207993 /*
207994 ** The set of all space characters recognized by jsonIsspace().
207995 ** Useful as the second argument to strspn().
207996 */
 
207997 static const char jsonSpaces[] = "\011\012\015\040";
 
 
 
 
 
207998
207999 /*
208000 ** Characters that are special to JSON. Control characters,
208001 ** '"' and '\\' and '\''. Actually, '\'' is not special to
208002 ** canonical JSON, but it is special in JSON-5, so we include
208003 ** it in the set of special characters.
208004 */
208005 static const char jsonIsOk[256] = {
208006 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208008 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
208009 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208010 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208011 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
208012 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208013 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208014
208015 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208016 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208017 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208018 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208019 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208020 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208021 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208022 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208023 };
208024
208025 /* Objects */
208026 typedef struct JsonCache JsonCache;
208027 typedef struct JsonString JsonString;
@@ -208162,11 +208232,11 @@
208162
208163 /**************************************************************************
208164 ** Forward references
208165 **************************************************************************/
208166 static void jsonReturnStringAsBlob(JsonString*);
208167 static int jsonFuncArgMightBeBinary(sqlite3_value *pJson);
208168 static u32 jsonTranslateBlobToText(const JsonParse*,u32,JsonString*);
208169 static void jsonReturnParse(sqlite3_context*,JsonParse*);
208170 static JsonParse *jsonParseFuncArg(sqlite3_context*,sqlite3_value*,u32);
208171 static void jsonParseFree(JsonParse*);
208172 static u32 jsonbPayloadSize(const JsonParse*, u32, u32*);
@@ -208580,15 +208650,13 @@
208580 jsonAppendString(p, z, n);
208581 }
208582 break;
208583 }
208584 default: {
208585 if( jsonFuncArgMightBeBinary(pValue) ){
208586 JsonParse px;
208587 memset(&px, 0, sizeof(px));
208588 px.aBlob = (u8*)sqlite3_value_blob(pValue);
208589 px.nBlob = sqlite3_value_bytes(pValue);
208590 jsonTranslateBlobToText(&px, 0, p);
208591 }else if( p->eErr==0 ){
208592 sqlite3_result_error(p->pCtx, "JSON cannot hold BLOB values", -1);
208593 p->eErr = JSTRING_ERR;
208594 jsonStringReset(p);
@@ -210258,37 +210326,10 @@
210258 }
210259 }
210260 return i;
210261 }
210262
210263
210264 /* Return true if the input pJson
210265 **
210266 ** For performance reasons, this routine does not do a detailed check of the
210267 ** input BLOB to ensure that it is well-formed. Hence, false positives are
210268 ** possible. False negatives should never occur, however.
210269 */
210270 static int jsonFuncArgMightBeBinary(sqlite3_value *pJson){
210271 u32 sz, n;
210272 const u8 *aBlob;
210273 int nBlob;
210274 JsonParse s;
210275 if( sqlite3_value_type(pJson)!=SQLITE_BLOB ) return 0;
210276 aBlob = sqlite3_value_blob(pJson);
210277 nBlob = sqlite3_value_bytes(pJson);
210278 if( nBlob<1 ) return 0;
210279 if( NEVER(aBlob==0) || (aBlob[0] & 0x0f)>JSONB_OBJECT ) return 0;
210280 memset(&s, 0, sizeof(s));
210281 s.aBlob = (u8*)aBlob;
210282 s.nBlob = nBlob;
210283 n = jsonbPayloadSize(&s, 0, &sz);
210284 if( n==0 ) return 0;
210285 if( sz+n!=(u32)nBlob ) return 0;
210286 if( (aBlob[0] & 0x0f)<=JSONB_FALSE && sz>0 ) return 0;
210287 return sz+n==(u32)nBlob;
210288 }
210289
210290 /*
210291 ** Given that a JSONB_ARRAY object starts at offset i, return
210292 ** the number of entries in that array.
210293 */
210294 static u32 jsonbArrayCount(JsonParse *pParse, u32 iRoot){
@@ -211112,14 +211153,11 @@
211112 pParse->aBlob = aNull;
211113 pParse->nBlob = 1;
211114 return 0;
211115 }
211116 case SQLITE_BLOB: {
211117 if( jsonFuncArgMightBeBinary(pArg) ){
211118 pParse->aBlob = (u8*)sqlite3_value_blob(pArg);
211119 pParse->nBlob = sqlite3_value_bytes(pArg);
211120 }else{
211121 sqlite3_result_error(ctx, "JSON cannot hold BLOB values", -1);
211122 return 1;
211123 }
211124 break;
211125 }
@@ -211266,31 +211304,50 @@
211266 }
211267
211268 /*
211269 ** If pArg is a blob that seems like a JSONB blob, then initialize
211270 ** p to point to that JSONB and return TRUE. If pArg does not seem like
211271 ** a JSONB blob, then return FALSE;
211272 **
211273 ** This routine is only called if it is already known that pArg is a
211274 ** blob. The only open question is whether or not the blob appears
211275 ** to be a JSONB blob.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211276 */
211277 static int jsonArgIsJsonb(sqlite3_value *pArg, JsonParse *p){
211278 u32 n, sz = 0;
 
 
211279 p->aBlob = (u8*)sqlite3_value_blob(pArg);
211280 p->nBlob = (u32)sqlite3_value_bytes(pArg);
211281 if( p->nBlob==0 ){
211282 p->aBlob = 0;
211283 return 0;
211284 }
211285 if( NEVER(p->aBlob==0) ){
211286 return 0;
211287 }
211288 if( (p->aBlob[0] & 0x0f)<=JSONB_OBJECT
211289 && (n = jsonbPayloadSize(p, 0, &sz))>0
211290 && sz+n==p->nBlob
211291 && ((p->aBlob[0] & 0x0f)>JSONB_FALSE || sz==0)
 
 
 
211292 ){
211293 return 1;
211294 }
211295 p->aBlob = 0;
211296 p->nBlob = 0;
@@ -212379,25 +212436,21 @@
212379 sqlite3_result_int(ctx, 0);
212380 #endif
212381 return;
212382 }
212383 case SQLITE_BLOB: {
212384 if( jsonFuncArgMightBeBinary(argv[0]) ){
 
 
212385 if( flags & 0x04 ){
212386 /* Superficial checking only - accomplished by the
212387 ** jsonFuncArgMightBeBinary() call above. */
212388 res = 1;
212389 }else if( flags & 0x08 ){
212390 /* Strict checking. Check by translating BLOB->TEXT->BLOB. If
212391 ** no errors occur, call that a "strict check". */
212392 JsonParse px;
212393 u32 iErr;
212394 memset(&px, 0, sizeof(px));
212395 px.aBlob = (u8*)sqlite3_value_blob(argv[0]);
212396 px.nBlob = sqlite3_value_bytes(argv[0]);
212397 iErr = jsonbValidityCheck(&px, 0, px.nBlob, 1);
212398 res = iErr==0;
212399 }
212400 break;
212401 }
212402 /* Fall through into interpreting the input as text. See note
212403 ** above at tag-20240123-a. */
@@ -212451,13 +212504,11 @@
212451
212452 assert( argc==1 );
212453 UNUSED_PARAMETER(argc);
212454 memset(&s, 0, sizeof(s));
212455 s.db = sqlite3_context_db_handle(ctx);
212456 if( jsonFuncArgMightBeBinary(argv[0]) ){
212457 s.aBlob = (u8*)sqlite3_value_blob(argv[0]);
212458 s.nBlob = sqlite3_value_bytes(argv[0]);
212459 iErrPos = (i64)jsonbValidityCheck(&s, 0, s.nBlob, 1);
212460 }else{
212461 s.zJson = (char*)sqlite3_value_text(argv[0]);
212462 if( s.zJson==0 ) return; /* NULL input or OOM */
212463 s.nJson = sqlite3_value_bytes(argv[0]);
@@ -213138,13 +213189,12 @@
213138 jsonEachCursorReset(p);
213139 if( idxNum==0 ) return SQLITE_OK;
213140 memset(&p->sParse, 0, sizeof(p->sParse));
213141 p->sParse.nJPRef = 1;
213142 p->sParse.db = p->db;
213143 if( jsonFuncArgMightBeBinary(argv[0]) ){
213144 p->sParse.nBlob = sqlite3_value_bytes(argv[0]);
213145 p->sParse.aBlob = (u8*)sqlite3_value_blob(argv[0]);
213146 }else{
213147 p->sParse.zJson = (char*)sqlite3_value_text(argv[0]);
213148 p->sParse.nJson = sqlite3_value_bytes(argv[0]);
213149 if( p->sParse.zJson==0 ){
213150 p->i = p->iEnd = 0;
@@ -257213,11 +257263,11 @@
257213 int nArg, /* Number of args */
257214 sqlite3_value **apUnused /* Function arguments */
257215 ){
257216 assert( nArg==0 );
257217 UNUSED_PARAM2(nArg, apUnused);
257218 sqlite3_result_text(pCtx, "fts5: 2025-04-15 21:59:38 d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5", -1, SQLITE_TRANSIENT);
257219 }
257220
257221 /*
257222 ** Implementation of fts5_locale(LOCALE, TEXT) function.
257223 **
257224
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** 20abf1ec107f942e4527901685d61283c9c2 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.50.0"
469 #define SQLITE_VERSION_NUMBER 3050000
470 #define SQLITE_SOURCE_ID "2025-04-30 14:37:00 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -11872,13 +11872,14 @@
11872 ** This may appear to have some counter-intuitive effects if a single row
11873 ** is written to more than once during a session. For example, if a row
11874 ** is inserted while a session object is enabled, then later deleted while
11875 ** the same session object is disabled, no INSERT record will appear in the
11876 ** changeset, even though the delete took place while the session was disabled.
11877 ** Or, if one field of a row is updated while a session is enabled, and
11878 ** then another field of the same row is updated while the session is disabled,
11879 ** the resulting changeset will contain an UPDATE change that updates both
11880 ** fields.
11881 */
11882 SQLITE_API int sqlite3session_changeset(
11883 sqlite3_session *pSession, /* Session object */
11884 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
11885 void **ppChangeset /* OUT: Buffer containing changeset */
@@ -32987,10 +32988,19 @@
32988 va_end(ap);
32989 zBuf[acc.nChar] = 0;
32990 return zBuf;
32991 }
32992
32993 /* Maximum size of an sqlite3_log() message. */
32994 #if defined(SQLITE_MAX_LOG_MESSAGE)
32995 /* Leave the definition as supplied */
32996 #elif SQLITE_PRINT_BUF_SIZE*10>10000
32997 # define SQLITE_MAX_LOG_MESSAGE 10000
32998 #else
32999 # define SQLITE_MAX_LOG_MESSAGE (SQLITE_PRINT_BUF_SIZE*10)
33000 #endif
33001
33002 /*
33003 ** This is the routine that actually formats the sqlite3_log() message.
33004 ** We house it in a separate routine from sqlite3_log() to avoid using
33005 ** stack space on small-stack systems when logging is disabled.
33006 **
@@ -33003,11 +33013,11 @@
33013 ** Care must be taken that any sqlite3_log() calls that occur while the
33014 ** memory mutex is held do not use these mechanisms.
33015 */
33016 static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
33017 StrAccum acc; /* String accumulator */
33018 char zMsg[SQLITE_MAX_LOG_MESSAGE]; /* Complete log message */
33019
33020 sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
33021 sqlite3_str_vappendf(&acc, zFormat, ap);
33022 sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,
33023 sqlite3StrAccumFinish(&acc));
@@ -95716,11 +95726,11 @@
95726 }
95727 }else{
95728 sqlite3VdbeError(p, "%s", pOp->p4.z);
95729 }
95730 pcx = (int)(pOp - aOp);
95731 sqlite3_log(pOp->p1, "abort at %d: %s; [%s]", pcx, p->zErrMsg, p->zSql);
95732 }
95733 rc = sqlite3VdbeHalt(p);
95734 assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );
95735 if( rc==SQLITE_BUSY ){
95736 p->rc = SQLITE_BUSY;
@@ -97042,11 +97052,11 @@
97052 pOut->u.i = ~sqlite3VdbeIntValue(pIn1);
97053 }
97054 break;
97055 }
97056
97057 /* Opcode: Once P1 P2 P3 * *
97058 **
97059 ** Fall through to the next instruction the first time this opcode is
97060 ** encountered on each invocation of the byte-code program. Jump to P2
97061 ** on the second and all subsequent encounters during the same invocation.
97062 **
@@ -97058,10 +97068,16 @@
97068 **
97069 ** For subprograms, there is a bitmask in the VdbeFrame that determines
97070 ** whether or not the jump should be taken. The bitmask is necessary
97071 ** because the self-altering code trick does not work for recursive
97072 ** triggers.
97073 **
97074 ** The P3 operand is not used directly by this opcode. However P3 is
97075 ** used by the code generator as follows: If this opcode is the start
97076 ** of a subroutine and that subroutine uses a Bloom filter, then P3 will
97077 ** be the register that holds that Bloom filter. See tag-202407032019
97078 ** in the source code for implementation details.
97079 */
97080 case OP_Once: { /* jump */
97081 u32 iAddr; /* Address of this instruction */
97082 assert( p->aOp[0].opcode==OP_Init );
97083 if( p->pFrame ){
@@ -103551,12 +103567,12 @@
103567 sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
103568 }
103569 p->rc = rc;
103570 sqlite3SystemError(db, rc);
103571 testcase( sqlite3GlobalConfig.xLog!=0 );
103572 sqlite3_log(rc, "statement aborts at %d: %s; [%s]",
103573 (int)(pOp - aOp), p->zErrMsg, p->zSql);
103574 if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
103575 if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
103576 if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){
103577 db->flags |= SQLITE_CorruptRdOnly;
103578 }
@@ -114022,15 +114038,16 @@
114038 pCopy = sqlite3SelectDup(pParse->db, pSelect, 0);
114039 rc = pParse->db->mallocFailed ? 1 :sqlite3Select(pParse, pCopy, &dest);
114040 sqlite3SelectDelete(pParse->db, pCopy);
114041 sqlite3DbFree(pParse->db, dest.zAffSdst);
114042 if( addrBloom ){
114043 /* Remember that location of the Bloom filter in the P3 operand
114044 ** of the OP_Once that began this subroutine. tag-202407032019 */
114045 sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2;
114046 if( dest.iSDParm2==0 ){
114047 /* If the Bloom filter won't actually be used, keep it small */
114048 sqlite3VdbeGetOp(v, addrBloom)->p1 = 10;
 
114049 }
114050 }
114051 if( rc ){
114052 sqlite3KeyInfoUnref(pKeyInfo);
114053 return;
@@ -114473,11 +114490,11 @@
114490 if( destIfFalse==destIfNull ){
114491 /* Combine Step 3 and Step 5 into a single opcode */
114492 if( ExprHasProperty(pExpr, EP_Subrtn) ){
114493 const VdbeOp *pOp = sqlite3VdbeGetOp(v, pExpr->y.sub.iAddr);
114494 assert( pOp->opcode==OP_Once || pParse->nErr );
114495 if( pOp->opcode==OP_Once && pOp->p3>0 ){ /* tag-202407032019 */
114496 assert( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) );
114497 sqlite3VdbeAddOp4Int(v, OP_Filter, pOp->p3, destIfFalse,
114498 rLhs, nVector); VdbeCoverage(v);
114499 }
114500 }
@@ -124091,11 +124108,11 @@
124108 */
124109 SQLITE_PRIVATE int sqlite3TableColumnToIndex(Index *pIdx, int iCol){
124110 int i;
124111 i16 iCol16;
124112 assert( iCol>=(-1) && iCol<=SQLITE_MAX_COLUMN );
124113 assert( pIdx->nColumn<=SQLITE_MAX_COLUMN+1 );
124114 iCol16 = iCol;
124115 for(i=0; i<pIdx->nColumn; i++){
124116 if( iCol16==pIdx->aiColumn[i] ){
124117 return i;
124118 }
@@ -207968,60 +207985,113 @@
207985 ** Growing our own isspace() routine this way is twice as fast as
207986 ** the library isspace() function, resulting in a 7% overall performance
207987 ** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
207988 */
207989 static const char jsonIsSpace[] = {
207990 #ifdef SQLITE_ASCII
207991 /*0 1 2 3 4 5 6 7 8 9 a b c d e f */
207992 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, /* 0 */
207993 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
207994 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
207995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3 */
207996 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4 */
207997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5 */
207998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6 */
207999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7 */
208000
208001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 8 */
208002 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9 */
208003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a */
208004 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b */
208005 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c */
208006 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */
208007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e */
208008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f */
208009 #endif
208010 #ifdef SQLITE_EBCDIC
208011 /*0 1 2 3 4 5 6 7 8 9 a b c d e f */
208012 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, /* 0 */
208013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
208014 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
208015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3 */
208016 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4 */
208017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5 */
208018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6 */
208019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7 */
208020
208021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 8 */
208022 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9 */
208023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a */
208024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b */
208025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c */
208026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */
208027 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e */
208028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f */
208029 #endif
208030
208031 };
208032 #define jsonIsspace(x) (jsonIsSpace[(unsigned char)x])
208033
208034 /*
208035 ** The set of all space characters recognized by jsonIsspace().
208036 ** Useful as the second argument to strspn().
208037 */
208038 #ifdef SQLITE_ASCII
208039 static const char jsonSpaces[] = "\011\012\015\040";
208040 #endif
208041 #ifdef SQLITE_EBCDIC
208042 static const char jsonSpaces[] = "\005\045\015\100";
208043 #endif
208044
208045
208046 /*
208047 ** Characters that are special to JSON. Control characters,
208048 ** '"' and '\\' and '\''. Actually, '\'' is not special to
208049 ** canonical JSON, but it is special in JSON-5, so we include
208050 ** it in the set of special characters.
208051 */
208052 static const char jsonIsOk[256] = {
208053 #ifdef SQLITE_ASCII
208054 /*0 1 2 3 4 5 6 7 8 9 a b c d e f */
208055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 */
208056 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
208057 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 2 */
208058 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 3 */
208059 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */
208060 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, /* 5 */
208061 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */
208062 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */
208063
208064 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */
208065 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */
208066 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */
208067 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */
208068 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */
208069 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */
208070 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */
208071 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f */
208072 #endif
208073 #ifdef SQLITE_EBCDIC
208074 /*0 1 2 3 4 5 6 7 8 9 a b c d e f */
208075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 */
208076 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1 */
208077 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2 */
208078 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* 3 */
208079 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */
208080 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 5 */
208081 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */
208082 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, /* 7 */
208083
208084 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */
208085 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */
208086 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */
208087 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */
208088 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */
208089 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */
208090 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */
208091 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f */
208092 #endif
208093 };
208094
208095 /* Objects */
208096 typedef struct JsonCache JsonCache;
208097 typedef struct JsonString JsonString;
@@ -208162,11 +208232,11 @@
208232
208233 /**************************************************************************
208234 ** Forward references
208235 **************************************************************************/
208236 static void jsonReturnStringAsBlob(JsonString*);
208237 static int jsonArgIsJsonb(sqlite3_value *pJson, JsonParse *p);
208238 static u32 jsonTranslateBlobToText(const JsonParse*,u32,JsonString*);
208239 static void jsonReturnParse(sqlite3_context*,JsonParse*);
208240 static JsonParse *jsonParseFuncArg(sqlite3_context*,sqlite3_value*,u32);
208241 static void jsonParseFree(JsonParse*);
208242 static u32 jsonbPayloadSize(const JsonParse*, u32, u32*);
@@ -208580,15 +208650,13 @@
208650 jsonAppendString(p, z, n);
208651 }
208652 break;
208653 }
208654 default: {
208655 JsonParse px;
208656 memset(&px, 0, sizeof(px));
208657 if( jsonArgIsJsonb(pValue, &px) ){
 
 
208658 jsonTranslateBlobToText(&px, 0, p);
208659 }else if( p->eErr==0 ){
208660 sqlite3_result_error(p->pCtx, "JSON cannot hold BLOB values", -1);
208661 p->eErr = JSTRING_ERR;
208662 jsonStringReset(p);
@@ -210258,37 +210326,10 @@
210326 }
210327 }
210328 return i;
210329 }
210330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210331 /*
210332 ** Given that a JSONB_ARRAY object starts at offset i, return
210333 ** the number of entries in that array.
210334 */
210335 static u32 jsonbArrayCount(JsonParse *pParse, u32 iRoot){
@@ -211112,14 +211153,11 @@
211153 pParse->aBlob = aNull;
211154 pParse->nBlob = 1;
211155 return 0;
211156 }
211157 case SQLITE_BLOB: {
211158 if( !jsonArgIsJsonb(pArg, pParse) ){
 
 
 
211159 sqlite3_result_error(ctx, "JSON cannot hold BLOB values", -1);
211160 return 1;
211161 }
211162 break;
211163 }
@@ -211266,31 +211304,50 @@
211304 }
211305
211306 /*
211307 ** If pArg is a blob that seems like a JSONB blob, then initialize
211308 ** p to point to that JSONB and return TRUE. If pArg does not seem like
211309 ** a JSONB blob, then return FALSE.
211310 **
211311 ** For small BLOBs (having no more than 7 bytes of payload) a full
211312 ** validity check is done. So for small BLOBs this routine only returns
211313 ** true if the value is guaranteed to be a valid JSONB. For larger BLOBs
211314 ** (8 byte or more of payload) only the size of the outermost element is
211315 ** checked to verify that the BLOB is superficially valid JSONB.
211316 **
211317 ** A full JSONB validation is done on smaller BLOBs because those BLOBs might
211318 ** also be text JSON that has been incorrectly cast into a BLOB.
211319 ** (See tag-20240123-a and https://sqlite.org/forum/forumpost/012136abd5)
211320 ** If the BLOB is 9 bytes are larger, then it is not possible for the
211321 ** superficial size check done here to pass if the input is really text
211322 ** JSON so we do not need to look deeper in that case.
211323 **
211324 ** Why we only need to do full JSONB validation for smaller BLOBs:
211325 **
211326 ** The first byte of valid JSON text must be one of: '{', '[', '"', ' ', '\n',
211327 ** '\r', '\t', '-', or a digit '0' through '9'. Of these, only a subset
211328 ** can also be the first byte of JSONB: '{', '[', and digits '3'
211329 ** through '9'. In every one of those cases, the payload size is 7 bytes
211330 ** or less. So if we do full JSONB validation for every BLOB where the
211331 ** payload is less than 7 bytes, we will never get a false positive for
211332 ** JSONB on an input that is really text JSON.
211333 */
211334 static int jsonArgIsJsonb(sqlite3_value *pArg, JsonParse *p){
211335 u32 n, sz = 0;
211336 u8 c;
211337 if( sqlite3_value_type(pArg)!=SQLITE_BLOB ) return 0;
211338 p->aBlob = (u8*)sqlite3_value_blob(pArg);
211339 p->nBlob = (u32)sqlite3_value_bytes(pArg);
211340 if( p->nBlob>0
211341 && ALWAYS(p->aBlob!=0)
211342 && ((c = p->aBlob[0]) & 0x0f)<=JSONB_OBJECT
 
 
 
 
 
211343 && (n = jsonbPayloadSize(p, 0, &sz))>0
211344 && sz+n==p->nBlob
211345 && ((c & 0x0f)>JSONB_FALSE || sz==0)
211346 && (sz>7
211347 || (c!=0x7b && c!=0x5b && !sqlite3Isdigit(c))
211348 || jsonbValidityCheck(p, 0, p->nBlob, 1)==0)
211349 ){
211350 return 1;
211351 }
211352 p->aBlob = 0;
211353 p->nBlob = 0;
@@ -212379,25 +212436,21 @@
212436 sqlite3_result_int(ctx, 0);
212437 #endif
212438 return;
212439 }
212440 case SQLITE_BLOB: {
212441 JsonParse py;
212442 memset(&py, 0, sizeof(py));
212443 if( jsonArgIsJsonb(argv[0], &py) ){
212444 if( flags & 0x04 ){
212445 /* Superficial checking only - accomplished by the
212446 ** jsonArgIsJsonb() call above. */
212447 res = 1;
212448 }else if( flags & 0x08 ){
212449 /* Strict checking. Check by translating BLOB->TEXT->BLOB. If
212450 ** no errors occur, call that a "strict check". */
212451 res = 0==jsonbValidityCheck(&py, 0, py.nBlob, 1);
 
 
 
 
 
 
212452 }
212453 break;
212454 }
212455 /* Fall through into interpreting the input as text. See note
212456 ** above at tag-20240123-a. */
@@ -212451,13 +212504,11 @@
212504
212505 assert( argc==1 );
212506 UNUSED_PARAMETER(argc);
212507 memset(&s, 0, sizeof(s));
212508 s.db = sqlite3_context_db_handle(ctx);
212509 if( jsonArgIsJsonb(argv[0], &s) ){
 
 
212510 iErrPos = (i64)jsonbValidityCheck(&s, 0, s.nBlob, 1);
212511 }else{
212512 s.zJson = (char*)sqlite3_value_text(argv[0]);
212513 if( s.zJson==0 ) return; /* NULL input or OOM */
212514 s.nJson = sqlite3_value_bytes(argv[0]);
@@ -213138,13 +213189,12 @@
213189 jsonEachCursorReset(p);
213190 if( idxNum==0 ) return SQLITE_OK;
213191 memset(&p->sParse, 0, sizeof(p->sParse));
213192 p->sParse.nJPRef = 1;
213193 p->sParse.db = p->db;
213194 if( jsonArgIsJsonb(argv[0], &p->sParse) ){
213195 /* We have JSONB */
 
213196 }else{
213197 p->sParse.zJson = (char*)sqlite3_value_text(argv[0]);
213198 p->sParse.nJson = sqlite3_value_bytes(argv[0]);
213199 if( p->sParse.zJson==0 ){
213200 p->i = p->iEnd = 0;
@@ -257213,11 +257263,11 @@
257263 int nArg, /* Number of args */
257264 sqlite3_value **apUnused /* Function arguments */
257265 ){
257266 assert( nArg==0 );
257267 UNUSED_PARAM2(nArg, apUnused);
257268 sqlite3_result_text(pCtx, "fts5: 2025-04-30 14:37:00 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849", -1, SQLITE_TRANSIENT);
257269 }
257270
257271 /*
257272 ** Implementation of fts5_locale(LOCALE, TEXT) function.
257273 **
257274
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.50.0"
150150
#define SQLITE_VERSION_NUMBER 3050000
151
-#define SQLITE_SOURCE_ID "2025-04-15 21:59:38 d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5"
151
+#define SQLITE_SOURCE_ID "2025-04-30 14:37:00 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -11553,13 +11553,14 @@
1155311553
** This may appear to have some counter-intuitive effects if a single row
1155411554
** is written to more than once during a session. For example, if a row
1155511555
** is inserted while a session object is enabled, then later deleted while
1155611556
** the same session object is disabled, no INSERT record will appear in the
1155711557
** changeset, even though the delete took place while the session was disabled.
11558
-** Or, if one field of a row is updated while a session is disabled, and
11559
-** another field of the same row is updated while the session is enabled, the
11560
-** resulting changeset will contain an UPDATE change that updates both fields.
11558
+** Or, if one field of a row is updated while a session is enabled, and
11559
+** then another field of the same row is updated while the session is disabled,
11560
+** the resulting changeset will contain an UPDATE change that updates both
11561
+** fields.
1156111562
*/
1156211563
SQLITE_API int sqlite3session_changeset(
1156311564
sqlite3_session *pSession, /* Session object */
1156411565
int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
1156511566
void **ppChangeset /* OUT: Buffer containing changeset */
1156611567
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.50.0"
150 #define SQLITE_VERSION_NUMBER 3050000
151 #define SQLITE_SOURCE_ID "2025-04-15 21:59:38 d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -11553,13 +11553,14 @@
11553 ** This may appear to have some counter-intuitive effects if a single row
11554 ** is written to more than once during a session. For example, if a row
11555 ** is inserted while a session object is enabled, then later deleted while
11556 ** the same session object is disabled, no INSERT record will appear in the
11557 ** changeset, even though the delete took place while the session was disabled.
11558 ** Or, if one field of a row is updated while a session is disabled, and
11559 ** another field of the same row is updated while the session is enabled, the
11560 ** resulting changeset will contain an UPDATE change that updates both fields.
 
11561 */
11562 SQLITE_API int sqlite3session_changeset(
11563 sqlite3_session *pSession, /* Session object */
11564 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
11565 void **ppChangeset /* OUT: Buffer containing changeset */
11566
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.50.0"
150 #define SQLITE_VERSION_NUMBER 3050000
151 #define SQLITE_SOURCE_ID "2025-04-30 14:37:00 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -11553,13 +11553,14 @@
11553 ** This may appear to have some counter-intuitive effects if a single row
11554 ** is written to more than once during a session. For example, if a row
11555 ** is inserted while a session object is enabled, then later deleted while
11556 ** the same session object is disabled, no INSERT record will appear in the
11557 ** changeset, even though the delete took place while the session was disabled.
11558 ** Or, if one field of a row is updated while a session is enabled, and
11559 ** then another field of the same row is updated while the session is disabled,
11560 ** the resulting changeset will contain an UPDATE change that updates both
11561 ** fields.
11562 */
11563 SQLITE_API int sqlite3session_changeset(
11564 sqlite3_session *pSession, /* Session object */
11565 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
11566 void **ppChangeset /* OUT: Buffer containing changeset */
11567

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button