Fossil SCM

Update the built-in SQLite with the latest trunk check-in.

drh 2025-04-10 10:35 trunk
Commit e69720eae3cf0b4cd5bd934b7e6f0d8702243605924c6c95aa4d7854b6b0bc7e
+15 -6
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -6810,11 +6810,11 @@
68106810
68116811
68126812
for(i=0; i<argc; i++){
68136813
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
68146814
/* If any of the constraints have a NULL value, then return no rows.
6815
- ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
6815
+ ** See ticket https://sqlite.org/src/info/fac496b61722daf2 */
68166816
returnNoRows = 1;
68176817
break;
68186818
}
68196819
}
68206820
if( returnNoRows ){
@@ -25466,10 +25466,11 @@
2546625466
" --readonly Open FILE readonly",
2546725467
" --zip FILE is a ZIP archive",
2546825468
#ifndef SQLITE_SHELL_FIDDLE
2546925469
".output ?FILE? Send output to FILE or stdout if FILE is omitted",
2547025470
" If FILE begins with '|' then open it as a pipe.",
25471
+ " If FILE is 'off' then output is disabled.",
2547125472
" Options:",
2547225473
" --bom Prefix output with a UTF8 byte-order mark",
2547325474
" -e Send output to the system text editor",
2547425475
" --plain Use text/plain for -w option",
2547525476
" -w Send output to a web browser",
@@ -30461,13 +30462,13 @@
3046130462
|| (c=='e' && n==5 && cli_strcmp(azArg[0],"excel")==0)
3046230463
|| (c=='w' && n==3 && cli_strcmp(azArg[0],"www")==0)
3046330464
){
3046430465
char *zFile = 0;
3046530466
int i;
30466
- int eMode = 0;
30467
- int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
30468
- int bPlain = 0; /* --plain option */
30467
+ int eMode = 0; /* 0: .outout/.once, 'x'=.excel, 'w'=.www */
30468
+ int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
30469
+ int bPlain = 0; /* --plain option */
3046930470
static const char *zBomUtf8 = "\357\273\277";
3047030471
const char *zBom = 0;
3047130472
3047230473
failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]);
3047330474
if( c=='e' ){
@@ -30492,18 +30493,26 @@
3049230493
}else if( c=='o' && cli_strcmp(z,"-e")==0 ){
3049330494
eMode = 'e'; /* text editor */
3049430495
}else if( c=='o' && cli_strcmp(z,"-w")==0 ){
3049530496
eMode = 'w'; /* Web browser */
3049630497
}else{
30497
- sqlite3_fprintf(p->out,
30498
+ sqlite3_fprintf(p->out,
3049830499
"ERROR: unknown option: \"%s\". Usage:\n", azArg[i]);
3049930500
showHelp(p->out, azArg[0]);
3050030501
rc = 1;
3050130502
goto meta_command_exit;
3050230503
}
3050330504
}else if( zFile==0 && eMode==0 ){
30504
- zFile = sqlite3_mprintf("%s", z);
30505
+ if( cli_strcmp(z, "off")==0 ){
30506
+#ifdef _WIN32
30507
+ zFile = sqlite3_mprintf("nul");
30508
+#else
30509
+ zFile = sqlite3_mprintf("/dev/null");
30510
+#endif
30511
+ }else{
30512
+ zFile = sqlite3_mprintf("%s", z);
30513
+ }
3050530514
if( zFile && zFile[0]=='|' ){
3050630515
while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
3050730516
break;
3050830517
}
3050930518
}else{
3051030519
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -6810,11 +6810,11 @@
6810
6811
6812 for(i=0; i<argc; i++){
6813 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
6814 /* If any of the constraints have a NULL value, then return no rows.
6815 ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
6816 returnNoRows = 1;
6817 break;
6818 }
6819 }
6820 if( returnNoRows ){
@@ -25466,10 +25466,11 @@
25466 " --readonly Open FILE readonly",
25467 " --zip FILE is a ZIP archive",
25468 #ifndef SQLITE_SHELL_FIDDLE
25469 ".output ?FILE? Send output to FILE or stdout if FILE is omitted",
25470 " If FILE begins with '|' then open it as a pipe.",
 
25471 " Options:",
25472 " --bom Prefix output with a UTF8 byte-order mark",
25473 " -e Send output to the system text editor",
25474 " --plain Use text/plain for -w option",
25475 " -w Send output to a web browser",
@@ -30461,13 +30462,13 @@
30461 || (c=='e' && n==5 && cli_strcmp(azArg[0],"excel")==0)
30462 || (c=='w' && n==3 && cli_strcmp(azArg[0],"www")==0)
30463 ){
30464 char *zFile = 0;
30465 int i;
30466 int eMode = 0;
30467 int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
30468 int bPlain = 0; /* --plain option */
30469 static const char *zBomUtf8 = "\357\273\277";
30470 const char *zBom = 0;
30471
30472 failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]);
30473 if( c=='e' ){
@@ -30492,18 +30493,26 @@
30492 }else if( c=='o' && cli_strcmp(z,"-e")==0 ){
30493 eMode = 'e'; /* text editor */
30494 }else if( c=='o' && cli_strcmp(z,"-w")==0 ){
30495 eMode = 'w'; /* Web browser */
30496 }else{
30497 sqlite3_fprintf(p->out,
30498 "ERROR: unknown option: \"%s\". Usage:\n", azArg[i]);
30499 showHelp(p->out, azArg[0]);
30500 rc = 1;
30501 goto meta_command_exit;
30502 }
30503 }else if( zFile==0 && eMode==0 ){
30504 zFile = sqlite3_mprintf("%s", z);
 
 
 
 
 
 
 
 
30505 if( zFile && zFile[0]=='|' ){
30506 while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
30507 break;
30508 }
30509 }else{
30510
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -6810,11 +6810,11 @@
6810
6811
6812 for(i=0; i<argc; i++){
6813 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
6814 /* If any of the constraints have a NULL value, then return no rows.
6815 ** See ticket https://sqlite.org/src/info/fac496b61722daf2 */
6816 returnNoRows = 1;
6817 break;
6818 }
6819 }
6820 if( returnNoRows ){
@@ -25466,10 +25466,11 @@
25466 " --readonly Open FILE readonly",
25467 " --zip FILE is a ZIP archive",
25468 #ifndef SQLITE_SHELL_FIDDLE
25469 ".output ?FILE? Send output to FILE or stdout if FILE is omitted",
25470 " If FILE begins with '|' then open it as a pipe.",
25471 " If FILE is 'off' then output is disabled.",
25472 " Options:",
25473 " --bom Prefix output with a UTF8 byte-order mark",
25474 " -e Send output to the system text editor",
25475 " --plain Use text/plain for -w option",
25476 " -w Send output to a web browser",
@@ -30461,13 +30462,13 @@
30462 || (c=='e' && n==5 && cli_strcmp(azArg[0],"excel")==0)
30463 || (c=='w' && n==3 && cli_strcmp(azArg[0],"www")==0)
30464 ){
30465 char *zFile = 0;
30466 int i;
30467 int eMode = 0; /* 0: .outout/.once, 'x'=.excel, 'w'=.www */
30468 int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */
30469 int bPlain = 0; /* --plain option */
30470 static const char *zBomUtf8 = "\357\273\277";
30471 const char *zBom = 0;
30472
30473 failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]);
30474 if( c=='e' ){
@@ -30492,18 +30493,26 @@
30493 }else if( c=='o' && cli_strcmp(z,"-e")==0 ){
30494 eMode = 'e'; /* text editor */
30495 }else if( c=='o' && cli_strcmp(z,"-w")==0 ){
30496 eMode = 'w'; /* Web browser */
30497 }else{
30498 sqlite3_fprintf(p->out,
30499 "ERROR: unknown option: \"%s\". Usage:\n", azArg[i]);
30500 showHelp(p->out, azArg[0]);
30501 rc = 1;
30502 goto meta_command_exit;
30503 }
30504 }else if( zFile==0 && eMode==0 ){
30505 if( cli_strcmp(z, "off")==0 ){
30506 #ifdef _WIN32
30507 zFile = sqlite3_mprintf("nul");
30508 #else
30509 zFile = sqlite3_mprintf("/dev/null");
30510 #endif
30511 }else{
30512 zFile = sqlite3_mprintf("%s", z);
30513 }
30514 if( zFile && zFile[0]=='|' ){
30515 while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
30516 break;
30517 }
30518 }else{
30519
+105 -21
--- 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
-** 121f4d97f9a855131859d342bc2ade5f8c34 with changes in files:
21
+** 20acd630b91609725794ce84f9eda01d5f3c 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-03-27 23:29:25 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85"
470
+#define SQLITE_SOURCE_ID "2025-04-10 10:18:07 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6"
471471
472472
/*
473473
** CAPI3REF: Run-Time Library Version Numbers
474474
** KEYWORDS: sqlite3_version sqlite3_sourceid
475475
**
@@ -35446,11 +35446,11 @@
3544635446
unsigned char const *z = zIn;
3544735447
unsigned char const *zEnd = &z[nByte-1];
3544835448
int n = 0;
3544935449
3545035450
if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
35451
- while( n<nChar && ALWAYS(z<=zEnd) ){
35451
+ while( n<nChar && z<=zEnd ){
3545235452
c = z[0];
3545335453
z += 2;
3545435454
if( c>=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
3545535455
n++;
3545635456
}
@@ -84036,11 +84036,11 @@
8403684036
** many different strings can be converted into the same int or real.
8403784037
** If a table contains a numeric value and an index is based on the
8403884038
** corresponding string value, then it is important that the string be
8403984039
** derived from the numeric value, not the other way around, to ensure
8404084040
** that the index and table are consistent. See ticket
84041
-** https://www.sqlite.org/src/info/343634942dd54ab (2018-01-31) for
84041
+** https://sqlite.org/src/info/343634942dd54ab (2018-01-31) for
8404284042
** an example.
8404384043
**
8404484044
** This routine looks at pMem to verify that if it has both a numeric
8404584045
** representation and a string representation then the string rep has
8404684046
** been derived from the numeric and not the other way around. It returns
@@ -93324,11 +93324,11 @@
9332493324
unsigned char enc
9332593325
){
9332693326
assert( xDel!=SQLITE_DYNAMIC );
9332793327
if( enc!=SQLITE_UTF8 ){
9332893328
if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
93329
- nData &= ~(u16)1;
93329
+ nData &= ~(u64)1;
9333093330
}
9333193331
return bindText(pStmt, i, zData, nData, xDel, enc);
9333293332
}
9333393333
#ifndef SQLITE_OMIT_UTF16
9333493334
SQLITE_API int sqlite3_bind_text16(
@@ -125476,11 +125476,11 @@
125476125476
if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
125477125477
testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
125478125478
pIdx->aiColumn[j] = pPk->aiColumn[i];
125479125479
pIdx->azColl[j] = pPk->azColl[i];
125480125480
if( pPk->aSortOrder[i] ){
125481
- /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */
125481
+ /* See ticket https://sqlite.org/src/info/bba7b69f9849b5bf */
125482125482
pIdx->bAscKeyBug = 1;
125483125483
}
125484125484
j++;
125485125485
}
125486125486
}
@@ -126853,11 +126853,11 @@
126853126853
/* This OP_SeekEnd opcode makes index insert for a REINDEX go much
126854126854
** faster by avoiding unnecessary seeks. But the optimization does
126855126855
** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
126856126856
** with DESC primary keys, since those indexes have there keys in
126857126857
** a different order from the main table.
126858
- ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf
126858
+ ** See ticket: https://sqlite.org/src/info/bba7b69f9849b5bf
126859126859
*/
126860126860
sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
126861126861
}
126862126862
sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
126863126863
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
@@ -136942,11 +136942,11 @@
136942136942
** OE_Update guarantees that only a single row will change, so it
136943136943
** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
136944136944
** could happen in any order, but they are grouped up front for
136945136945
** convenience.
136946136946
**
136947
- ** 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43
136947
+ ** 2018-08-14: Ticket https://sqlite.org/src/info/908f001483982c43
136948136948
** The order of constraints used to have OE_Update as (2) and OE_Abort
136949136949
** and so forth as (1). But apparently PostgreSQL checks the OE_Update
136950136950
** constraint before any others, so it had to be moved.
136951136951
**
136952136952
** Constraint checking code is generated in this order:
@@ -150434,11 +150434,11 @@
150434150434
**
150435150435
** This transformation is necessary because the multiSelectOrderBy() routine
150436150436
** above that generates the code for a compound SELECT with an ORDER BY clause
150437150437
** uses a merge algorithm that requires the same collating sequence on the
150438150438
** result columns as on the ORDER BY clause. See ticket
150439
-** http://www.sqlite.org/src/info/6709574d2a
150439
+** http://sqlite.org/src/info/6709574d2a
150440150440
**
150441150441
** This transformation is only needed for EXCEPT, INTERSECT, and UNION.
150442150442
** The UNION ALL operator works fine with multiSelectOrderBy() even when
150443150443
** there are COLLATE terms in the ORDER BY.
150444150444
*/
@@ -157236,11 +157236,11 @@
157236157236
iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
157237157237
if( iDb<0 ) goto build_vacuum_end;
157238157238
#else
157239157239
/* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments
157240157240
** to VACUUM are silently ignored. This is a back-out of a bug fix that
157241
- ** occurred on 2016-08-19 (https://www.sqlite.org/src/info/083f9e6270).
157241
+ ** occurred on 2016-08-19 (https://sqlite.org/src/info/083f9e6270).
157242157242
** The buggy behavior is required for binary compatibility with some
157243157243
** legacy applications. */
157244157244
iDb = sqlite3FindDb(pParse->db, pNm);
157245157245
if( iDb<0 ) iDb = 0;
157246157246
#endif
@@ -161953,11 +161953,11 @@
161953161953
** ON or USING clause of a LEFT JOIN, and terms that are usable as
161954161954
** indices.
161955161955
**
161956161956
** This optimization also only applies if the (x1 OR x2 OR ...) term
161957161957
** is not contained in the ON clause of a LEFT JOIN.
161958
- ** See ticket http://www.sqlite.org/src/info/f2369304e4
161958
+ ** See ticket http://sqlite.org/src/info/f2369304e4
161959161959
**
161960161960
** 2022-02-04: Do not push down slices of a row-value comparison.
161961161961
** In other words, "w" or "y" may not be a slice of a vector. Otherwise,
161962161962
** the initialization of the right-hand operand of the vector comparison
161963161963
** might not occur, or might occur only in an OR branch that is not
@@ -199281,11 +199281,11 @@
199281199281
UNUSED_PARAMETER(nVal);
199282199282
199283199283
fts3tokResetCursor(pCsr);
199284199284
if( idxNum==1 ){
199285199285
const char *zByte = (const char *)sqlite3_value_text(apVal[0]);
199286
- int nByte = sqlite3_value_bytes(apVal[0]);
199286
+ sqlite3_int64 nByte = sqlite3_value_bytes(apVal[0]);
199287199287
pCsr->zInput = sqlite3_malloc64(nByte+1);
199288199288
if( pCsr->zInput==0 ){
199289199289
rc = SQLITE_NOMEM;
199290199290
}else{
199291199291
if( nByte>0 ) memcpy(pCsr->zInput, zByte, nByte);
@@ -207828,12 +207828,12 @@
207828207828
** with JSON-5 extensions is accepted as input.
207829207829
**
207830207830
** Beginning with version 3.45.0 (circa 2024-01-01), these routines also
207831207831
** accept BLOB values that have JSON encoded using a binary representation
207832207832
** called "JSONB". The name JSONB comes from PostgreSQL, however the on-disk
207833
-** format SQLite JSONB is completely different and incompatible with
207834
-** PostgreSQL JSONB.
207833
+** format for SQLite-JSONB is completely different and incompatible with
207834
+** PostgreSQL-JSONB.
207835207835
**
207836207836
** Decoding and interpreting JSONB is still O(N) where N is the size of
207837207837
** the input, the same as text JSON. However, the constant of proportionality
207838207838
** for JSONB is much smaller due to faster parsing. The size of each
207839207839
** element in JSONB is encoded in its header, so there is no need to search
@@ -207886,21 +207886,21 @@
207886207886
** 14 4 byte (0-4294967295) 5
207887207887
** 15 8 byte (0-1.8e19) 9
207888207888
**
207889207889
** The payload size need not be expressed in its minimal form. For example,
207890207890
** if the payload size is 10, the size can be expressed in any of 5 different
207891
-** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by on 0x0a byte,
207891
+** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by one 0x0a byte,
207892207892
** (3) (X>>4)==13 followed by 0x00 and 0x0a, (4) (X>>4)==14 followed by
207893207893
** 0x00 0x00 0x00 0x0a, or (5) (X>>4)==15 followed by 7 bytes of 0x00 and
207894207894
** a single byte of 0x0a. The shorter forms are preferred, of course, but
207895207895
** sometimes when generating JSONB, the payload size is not known in advance
207896207896
** and it is convenient to reserve sufficient header space to cover the
207897207897
** largest possible payload size and then come back later and patch up
207898207898
** the size when it becomes known, resulting in a non-minimal encoding.
207899207899
**
207900207900
** The value (X>>4)==15 is not actually used in the current implementation
207901
-** (as SQLite is currently unable handle BLOBs larger than about 2GB)
207901
+** (as SQLite is currently unable to handle BLOBs larger than about 2GB)
207902207902
** but is included in the design to allow for future enhancements.
207903207903
**
207904207904
** The payload follows the header. NULL, TRUE, and FALSE have no payload and
207905207905
** their payload size must always be zero. The payload for INT, INT5,
207906207906
** FLOAT, FLOAT5, TEXT, TEXTJ, TEXT5, and TEXTROW is text. Note that the
@@ -208970,11 +208970,11 @@
208970208970
if( jsonBlobExpand(pParse, pParse->nBlob+szPayload+9) ) return;
208971208971
jsonBlobAppendNode(pParse, eType, szPayload, aPayload);
208972208972
}
208973208973
208974208974
208975
-/* Append an node type byte together with the payload size and
208975
+/* Append a node type byte together with the payload size and
208976208976
** possibly also the payload.
208977208977
**
208978208978
** If aPayload is not NULL, then it is a pointer to the payload which
208979208979
** is also appended. If aPayload is NULL, the pParse->aBlob[] array
208980208980
** is resized (if necessary) so that it is big enough to hold the
@@ -210304,10 +210304,86 @@
210304210304
(void)jsonbPayloadSize(pParse, iRoot, &sz);
210305210305
pParse->nBlob = nBlob;
210306210306
sz += pParse->delta;
210307210307
pParse->delta += jsonBlobChangePayloadSize(pParse, iRoot, sz);
210308210308
}
210309
+
210310
+/*
210311
+** If the JSONB at aIns[0..nIns-1] can be expanded (by denormalizing the
210312
+** size field) by d bytes, then write the expansion into aOut[] and
210313
+** return true. In this way, an overwrite happens without changing the
210314
+** size of the JSONB, which reduces memcpy() operations and also make it
210315
+** faster and easier to update the B-Tree entry that contains the JSONB
210316
+** in the database.
210317
+**
210318
+** If the expansion of aIns[] by d bytes cannot be (easily) accomplished
210319
+** then return false.
210320
+**
210321
+** The d parameter is guaranteed to be between 1 and 8.
210322
+**
210323
+** This routine is an optimization. A correct answer is obtained if it
210324
+** always leaves the output unchanged and returns false.
210325
+*/
210326
+static int jsonBlobOverwrite(
210327
+ u8 *aOut, /* Overwrite here */
210328
+ const u8 *aIns, /* New content */
210329
+ u32 nIns, /* Bytes of new content */
210330
+ u32 d /* Need to expand new content by this much */
210331
+){
210332
+ u32 szPayload; /* Bytes of payload */
210333
+ u32 i; /* New header size, after expansion & a loop counter */
210334
+ u8 szHdr; /* Size of header before expansion */
210335
+
210336
+ /* Lookup table for finding the upper 4 bits of the first byte of the
210337
+ ** expanded aIns[], based on the size of the expanded aIns[] header:
210338
+ **
210339
+ ** 2 3 4 5 6 7 8 9 */
210340
+ static const u8 aType[] = { 0xc0, 0xd0, 0, 0xe0, 0, 0, 0, 0xf0 };
210341
+
210342
+ if( (aIns[0]&0x0f)<=2 ) return 0; /* Cannot enlarge NULL, true, false */
210343
+ switch( aIns[0]>>4 ){
210344
+ default: { /* aIns[] header size 1 */
210345
+ if( ((1<<d)&0x116)==0 ) return 0; /* d must be 1, 2, 4, or 8 */
210346
+ i = d + 1; /* New hdr sz: 2, 3, 5, or 9 */
210347
+ szHdr = 1;
210348
+ break;
210349
+ }
210350
+ case 12: { /* aIns[] header size is 2 */
210351
+ if( ((1<<d)&0x8a)==0) return 0; /* d must be 1, 3, or 7 */
210352
+ i = d + 2; /* New hdr sz: 2, 5, or 9 */
210353
+ szHdr = 2;
210354
+ break;
210355
+ }
210356
+ case 13: { /* aIns[] header size is 3 */
210357
+ if( d!=2 && d!=6 ) return 0; /* d must be 2 or 6 */
210358
+ i = d + 3; /* New hdr sz: 5 or 9 */
210359
+ szHdr = 3;
210360
+ break;
210361
+ }
210362
+ case 14: { /* aIns[] header size is 5 */
210363
+ if( d!=4 ) return 0; /* d must be 4 */
210364
+ i = 9; /* New hdr sz: 9 */
210365
+ szHdr = 5;
210366
+ break;
210367
+ }
210368
+ case 15: { /* aIns[] header size is 9 */
210369
+ return 0; /* No solution */
210370
+ }
210371
+ }
210372
+ assert( i>=2 && i<=9 && aType[i-2]!=0 );
210373
+ aOut[0] = (aIns[0] & 0x0f) | aType[i-2];
210374
+ memcpy(&aOut[i], &aIns[szHdr], nIns-szHdr);
210375
+ szPayload = nIns - szHdr;
210376
+ while( 1/*edit-by-break*/ ){
210377
+ i--;
210378
+ aOut[i] = szPayload & 0xff;
210379
+ if( i==1 ) break;
210380
+ szPayload >>= 8;
210381
+ }
210382
+ assert( (szPayload>>8)==0 );
210383
+ return 1;
210384
+}
210309210385
210310210386
/*
210311210387
** Modify the JSONB blob at pParse->aBlob by removing nDel bytes of
210312210388
** content beginning at iDel, and replacing them with nIns bytes of
210313210389
** content given by aIns.
@@ -210326,10 +210402,15 @@
210326210402
u32 nDel, /* Number of bytes to remove */
210327210403
const u8 *aIns, /* Content to insert */
210328210404
u32 nIns /* Bytes of content to insert */
210329210405
){
210330210406
i64 d = (i64)nIns - (i64)nDel;
210407
+ if( d<0 && d>=(-8) && aIns!=0
210408
+ && jsonBlobOverwrite(&pParse->aBlob[iDel], aIns, nIns, (int)-d)
210409
+ ){
210410
+ return;
210411
+ }
210331210412
if( d!=0 ){
210332210413
if( pParse->nBlob + d > pParse->nBlobAlloc ){
210333210414
jsonBlobExpand(pParse, pParse->nBlob+d);
210334210415
if( pParse->oom ) return;
210335210416
}
@@ -210337,11 +210418,13 @@
210337210418
&pParse->aBlob[iDel+nDel],
210338210419
pParse->nBlob - (iDel+nDel));
210339210420
pParse->nBlob += d;
210340210421
pParse->delta += d;
210341210422
}
210342
- if( nIns && aIns ) memcpy(&pParse->aBlob[iDel], aIns, nIns);
210423
+ if( nIns && aIns ){
210424
+ memcpy(&pParse->aBlob[iDel], aIns, nIns);
210425
+ }
210343210426
}
210344210427
210345210428
/*
210346210429
** Return the number of escaped newlines to be ignored.
210347210430
** An escaped newline is a one of the following byte sequences:
@@ -211100,11 +211183,11 @@
211100211183
}
211101211184
return 0;
211102211185
}
211103211186
211104211187
/* argv[0] is a BLOB that seems likely to be a JSONB. Subsequent
211105
-** arguments come in parse where each pair contains a JSON path and
211188
+** arguments come in pairs where each pair contains a JSON path and
211106211189
** content to insert or set at that patch. Do the updates
211107211190
** and return the result.
211108211191
**
211109211192
** The specific operation is determined by eEdit, which can be one
211110211193
** of JEDIT_INS, JEDIT_REPL, or JEDIT_SET.
@@ -230169,11 +230252,13 @@
230169230252
char *zExpr = 0;
230170230253
sqlite3 *db = pSession->db;
230171230254
SessionTable *pTo; /* Table zTbl */
230172230255
230173230256
/* Locate and if necessary initialize the target table object */
230257
+ pSession->bAutoAttach++;
230174230258
rc = sessionFindTable(pSession, zTbl, &pTo);
230259
+ pSession->bAutoAttach--;
230175230260
if( pTo==0 ) goto diff_out;
230176230261
if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){
230177230262
rc = pSession->rc;
230178230263
goto diff_out;
230179230264
}
@@ -257088,11 +257173,11 @@
257088257173
int nArg, /* Number of args */
257089257174
sqlite3_value **apUnused /* Function arguments */
257090257175
){
257091257176
assert( nArg==0 );
257092257177
UNUSED_PARAM2(nArg, apUnused);
257093
- sqlite3_result_text(pCtx, "fts5: 2025-03-27 23:29:25 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85", -1, SQLITE_TRANSIENT);
257178
+ sqlite3_result_text(pCtx, "fts5: 2025-04-10 10:18:07 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6", -1, SQLITE_TRANSIENT);
257094257179
}
257095257180
257096257181
/*
257097257182
** Implementation of fts5_locale(LOCALE, TEXT) function.
257098257183
**
@@ -261151,11 +261236,10 @@
261151261236
}
261152261237
iTbl++;
261153261238
}
261154261239
aAscii[0] = 0; /* 0x00 is never a token character */
261155261240
}
261156
-
261157261241
261158261242
/*
261159261243
** 2015 May 30
261160261244
**
261161261245
** The author disclaims copyright to this source code. In place of
261162261246
--- 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 ** 121f4d97f9a855131859d342bc2ade5f8c34 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-03-27 23:29:25 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -35446,11 +35446,11 @@
35446 unsigned char const *z = zIn;
35447 unsigned char const *zEnd = &z[nByte-1];
35448 int n = 0;
35449
35450 if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
35451 while( n<nChar && ALWAYS(z<=zEnd) ){
35452 c = z[0];
35453 z += 2;
35454 if( c>=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
35455 n++;
35456 }
@@ -84036,11 +84036,11 @@
84036 ** many different strings can be converted into the same int or real.
84037 ** If a table contains a numeric value and an index is based on the
84038 ** corresponding string value, then it is important that the string be
84039 ** derived from the numeric value, not the other way around, to ensure
84040 ** that the index and table are consistent. See ticket
84041 ** https://www.sqlite.org/src/info/343634942dd54ab (2018-01-31) for
84042 ** an example.
84043 **
84044 ** This routine looks at pMem to verify that if it has both a numeric
84045 ** representation and a string representation then the string rep has
84046 ** been derived from the numeric and not the other way around. It returns
@@ -93324,11 +93324,11 @@
93324 unsigned char enc
93325 ){
93326 assert( xDel!=SQLITE_DYNAMIC );
93327 if( enc!=SQLITE_UTF8 ){
93328 if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
93329 nData &= ~(u16)1;
93330 }
93331 return bindText(pStmt, i, zData, nData, xDel, enc);
93332 }
93333 #ifndef SQLITE_OMIT_UTF16
93334 SQLITE_API int sqlite3_bind_text16(
@@ -125476,11 +125476,11 @@
125476 if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
125477 testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
125478 pIdx->aiColumn[j] = pPk->aiColumn[i];
125479 pIdx->azColl[j] = pPk->azColl[i];
125480 if( pPk->aSortOrder[i] ){
125481 /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */
125482 pIdx->bAscKeyBug = 1;
125483 }
125484 j++;
125485 }
125486 }
@@ -126853,11 +126853,11 @@
126853 /* This OP_SeekEnd opcode makes index insert for a REINDEX go much
126854 ** faster by avoiding unnecessary seeks. But the optimization does
126855 ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
126856 ** with DESC primary keys, since those indexes have there keys in
126857 ** a different order from the main table.
126858 ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf
126859 */
126860 sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
126861 }
126862 sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
126863 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
@@ -136942,11 +136942,11 @@
136942 ** OE_Update guarantees that only a single row will change, so it
136943 ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
136944 ** could happen in any order, but they are grouped up front for
136945 ** convenience.
136946 **
136947 ** 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43
136948 ** The order of constraints used to have OE_Update as (2) and OE_Abort
136949 ** and so forth as (1). But apparently PostgreSQL checks the OE_Update
136950 ** constraint before any others, so it had to be moved.
136951 **
136952 ** Constraint checking code is generated in this order:
@@ -150434,11 +150434,11 @@
150434 **
150435 ** This transformation is necessary because the multiSelectOrderBy() routine
150436 ** above that generates the code for a compound SELECT with an ORDER BY clause
150437 ** uses a merge algorithm that requires the same collating sequence on the
150438 ** result columns as on the ORDER BY clause. See ticket
150439 ** http://www.sqlite.org/src/info/6709574d2a
150440 **
150441 ** This transformation is only needed for EXCEPT, INTERSECT, and UNION.
150442 ** The UNION ALL operator works fine with multiSelectOrderBy() even when
150443 ** there are COLLATE terms in the ORDER BY.
150444 */
@@ -157236,11 +157236,11 @@
157236 iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
157237 if( iDb<0 ) goto build_vacuum_end;
157238 #else
157239 /* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments
157240 ** to VACUUM are silently ignored. This is a back-out of a bug fix that
157241 ** occurred on 2016-08-19 (https://www.sqlite.org/src/info/083f9e6270).
157242 ** The buggy behavior is required for binary compatibility with some
157243 ** legacy applications. */
157244 iDb = sqlite3FindDb(pParse->db, pNm);
157245 if( iDb<0 ) iDb = 0;
157246 #endif
@@ -161953,11 +161953,11 @@
161953 ** ON or USING clause of a LEFT JOIN, and terms that are usable as
161954 ** indices.
161955 **
161956 ** This optimization also only applies if the (x1 OR x2 OR ...) term
161957 ** is not contained in the ON clause of a LEFT JOIN.
161958 ** See ticket http://www.sqlite.org/src/info/f2369304e4
161959 **
161960 ** 2022-02-04: Do not push down slices of a row-value comparison.
161961 ** In other words, "w" or "y" may not be a slice of a vector. Otherwise,
161962 ** the initialization of the right-hand operand of the vector comparison
161963 ** might not occur, or might occur only in an OR branch that is not
@@ -199281,11 +199281,11 @@
199281 UNUSED_PARAMETER(nVal);
199282
199283 fts3tokResetCursor(pCsr);
199284 if( idxNum==1 ){
199285 const char *zByte = (const char *)sqlite3_value_text(apVal[0]);
199286 int nByte = sqlite3_value_bytes(apVal[0]);
199287 pCsr->zInput = sqlite3_malloc64(nByte+1);
199288 if( pCsr->zInput==0 ){
199289 rc = SQLITE_NOMEM;
199290 }else{
199291 if( nByte>0 ) memcpy(pCsr->zInput, zByte, nByte);
@@ -207828,12 +207828,12 @@
207828 ** with JSON-5 extensions is accepted as input.
207829 **
207830 ** Beginning with version 3.45.0 (circa 2024-01-01), these routines also
207831 ** accept BLOB values that have JSON encoded using a binary representation
207832 ** called "JSONB". The name JSONB comes from PostgreSQL, however the on-disk
207833 ** format SQLite JSONB is completely different and incompatible with
207834 ** PostgreSQL JSONB.
207835 **
207836 ** Decoding and interpreting JSONB is still O(N) where N is the size of
207837 ** the input, the same as text JSON. However, the constant of proportionality
207838 ** for JSONB is much smaller due to faster parsing. The size of each
207839 ** element in JSONB is encoded in its header, so there is no need to search
@@ -207886,21 +207886,21 @@
207886 ** 14 4 byte (0-4294967295) 5
207887 ** 15 8 byte (0-1.8e19) 9
207888 **
207889 ** The payload size need not be expressed in its minimal form. For example,
207890 ** if the payload size is 10, the size can be expressed in any of 5 different
207891 ** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by on 0x0a byte,
207892 ** (3) (X>>4)==13 followed by 0x00 and 0x0a, (4) (X>>4)==14 followed by
207893 ** 0x00 0x00 0x00 0x0a, or (5) (X>>4)==15 followed by 7 bytes of 0x00 and
207894 ** a single byte of 0x0a. The shorter forms are preferred, of course, but
207895 ** sometimes when generating JSONB, the payload size is not known in advance
207896 ** and it is convenient to reserve sufficient header space to cover the
207897 ** largest possible payload size and then come back later and patch up
207898 ** the size when it becomes known, resulting in a non-minimal encoding.
207899 **
207900 ** The value (X>>4)==15 is not actually used in the current implementation
207901 ** (as SQLite is currently unable handle BLOBs larger than about 2GB)
207902 ** but is included in the design to allow for future enhancements.
207903 **
207904 ** The payload follows the header. NULL, TRUE, and FALSE have no payload and
207905 ** their payload size must always be zero. The payload for INT, INT5,
207906 ** FLOAT, FLOAT5, TEXT, TEXTJ, TEXT5, and TEXTROW is text. Note that the
@@ -208970,11 +208970,11 @@
208970 if( jsonBlobExpand(pParse, pParse->nBlob+szPayload+9) ) return;
208971 jsonBlobAppendNode(pParse, eType, szPayload, aPayload);
208972 }
208973
208974
208975 /* Append an node type byte together with the payload size and
208976 ** possibly also the payload.
208977 **
208978 ** If aPayload is not NULL, then it is a pointer to the payload which
208979 ** is also appended. If aPayload is NULL, the pParse->aBlob[] array
208980 ** is resized (if necessary) so that it is big enough to hold the
@@ -210304,10 +210304,86 @@
210304 (void)jsonbPayloadSize(pParse, iRoot, &sz);
210305 pParse->nBlob = nBlob;
210306 sz += pParse->delta;
210307 pParse->delta += jsonBlobChangePayloadSize(pParse, iRoot, sz);
210308 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210309
210310 /*
210311 ** Modify the JSONB blob at pParse->aBlob by removing nDel bytes of
210312 ** content beginning at iDel, and replacing them with nIns bytes of
210313 ** content given by aIns.
@@ -210326,10 +210402,15 @@
210326 u32 nDel, /* Number of bytes to remove */
210327 const u8 *aIns, /* Content to insert */
210328 u32 nIns /* Bytes of content to insert */
210329 ){
210330 i64 d = (i64)nIns - (i64)nDel;
 
 
 
 
 
210331 if( d!=0 ){
210332 if( pParse->nBlob + d > pParse->nBlobAlloc ){
210333 jsonBlobExpand(pParse, pParse->nBlob+d);
210334 if( pParse->oom ) return;
210335 }
@@ -210337,11 +210418,13 @@
210337 &pParse->aBlob[iDel+nDel],
210338 pParse->nBlob - (iDel+nDel));
210339 pParse->nBlob += d;
210340 pParse->delta += d;
210341 }
210342 if( nIns && aIns ) memcpy(&pParse->aBlob[iDel], aIns, nIns);
 
 
210343 }
210344
210345 /*
210346 ** Return the number of escaped newlines to be ignored.
210347 ** An escaped newline is a one of the following byte sequences:
@@ -211100,11 +211183,11 @@
211100 }
211101 return 0;
211102 }
211103
211104 /* argv[0] is a BLOB that seems likely to be a JSONB. Subsequent
211105 ** arguments come in parse where each pair contains a JSON path and
211106 ** content to insert or set at that patch. Do the updates
211107 ** and return the result.
211108 **
211109 ** The specific operation is determined by eEdit, which can be one
211110 ** of JEDIT_INS, JEDIT_REPL, or JEDIT_SET.
@@ -230169,11 +230252,13 @@
230169 char *zExpr = 0;
230170 sqlite3 *db = pSession->db;
230171 SessionTable *pTo; /* Table zTbl */
230172
230173 /* Locate and if necessary initialize the target table object */
 
230174 rc = sessionFindTable(pSession, zTbl, &pTo);
 
230175 if( pTo==0 ) goto diff_out;
230176 if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){
230177 rc = pSession->rc;
230178 goto diff_out;
230179 }
@@ -257088,11 +257173,11 @@
257088 int nArg, /* Number of args */
257089 sqlite3_value **apUnused /* Function arguments */
257090 ){
257091 assert( nArg==0 );
257092 UNUSED_PARAM2(nArg, apUnused);
257093 sqlite3_result_text(pCtx, "fts5: 2025-03-27 23:29:25 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85", -1, SQLITE_TRANSIENT);
257094 }
257095
257096 /*
257097 ** Implementation of fts5_locale(LOCALE, TEXT) function.
257098 **
@@ -261151,11 +261236,10 @@
261151 }
261152 iTbl++;
261153 }
261154 aAscii[0] = 0; /* 0x00 is never a token character */
261155 }
261156
261157
261158 /*
261159 ** 2015 May 30
261160 **
261161 ** The author disclaims copyright to this source code. In place of
261162
--- 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 ** 20acd630b91609725794ce84f9eda01d5f3c 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-10 10:18:07 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -35446,11 +35446,11 @@
35446 unsigned char const *z = zIn;
35447 unsigned char const *zEnd = &z[nByte-1];
35448 int n = 0;
35449
35450 if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
35451 while( n<nChar && z<=zEnd ){
35452 c = z[0];
35453 z += 2;
35454 if( c>=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
35455 n++;
35456 }
@@ -84036,11 +84036,11 @@
84036 ** many different strings can be converted into the same int or real.
84037 ** If a table contains a numeric value and an index is based on the
84038 ** corresponding string value, then it is important that the string be
84039 ** derived from the numeric value, not the other way around, to ensure
84040 ** that the index and table are consistent. See ticket
84041 ** https://sqlite.org/src/info/343634942dd54ab (2018-01-31) for
84042 ** an example.
84043 **
84044 ** This routine looks at pMem to verify that if it has both a numeric
84045 ** representation and a string representation then the string rep has
84046 ** been derived from the numeric and not the other way around. It returns
@@ -93324,11 +93324,11 @@
93324 unsigned char enc
93325 ){
93326 assert( xDel!=SQLITE_DYNAMIC );
93327 if( enc!=SQLITE_UTF8 ){
93328 if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
93329 nData &= ~(u64)1;
93330 }
93331 return bindText(pStmt, i, zData, nData, xDel, enc);
93332 }
93333 #ifndef SQLITE_OMIT_UTF16
93334 SQLITE_API int sqlite3_bind_text16(
@@ -125476,11 +125476,11 @@
125476 if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
125477 testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
125478 pIdx->aiColumn[j] = pPk->aiColumn[i];
125479 pIdx->azColl[j] = pPk->azColl[i];
125480 if( pPk->aSortOrder[i] ){
125481 /* See ticket https://sqlite.org/src/info/bba7b69f9849b5bf */
125482 pIdx->bAscKeyBug = 1;
125483 }
125484 j++;
125485 }
125486 }
@@ -126853,11 +126853,11 @@
126853 /* This OP_SeekEnd opcode makes index insert for a REINDEX go much
126854 ** faster by avoiding unnecessary seeks. But the optimization does
126855 ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
126856 ** with DESC primary keys, since those indexes have there keys in
126857 ** a different order from the main table.
126858 ** See ticket: https://sqlite.org/src/info/bba7b69f9849b5bf
126859 */
126860 sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
126861 }
126862 sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
126863 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
@@ -136942,11 +136942,11 @@
136942 ** OE_Update guarantees that only a single row will change, so it
136943 ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
136944 ** could happen in any order, but they are grouped up front for
136945 ** convenience.
136946 **
136947 ** 2018-08-14: Ticket https://sqlite.org/src/info/908f001483982c43
136948 ** The order of constraints used to have OE_Update as (2) and OE_Abort
136949 ** and so forth as (1). But apparently PostgreSQL checks the OE_Update
136950 ** constraint before any others, so it had to be moved.
136951 **
136952 ** Constraint checking code is generated in this order:
@@ -150434,11 +150434,11 @@
150434 **
150435 ** This transformation is necessary because the multiSelectOrderBy() routine
150436 ** above that generates the code for a compound SELECT with an ORDER BY clause
150437 ** uses a merge algorithm that requires the same collating sequence on the
150438 ** result columns as on the ORDER BY clause. See ticket
150439 ** http://sqlite.org/src/info/6709574d2a
150440 **
150441 ** This transformation is only needed for EXCEPT, INTERSECT, and UNION.
150442 ** The UNION ALL operator works fine with multiSelectOrderBy() even when
150443 ** there are COLLATE terms in the ORDER BY.
150444 */
@@ -157236,11 +157236,11 @@
157236 iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
157237 if( iDb<0 ) goto build_vacuum_end;
157238 #else
157239 /* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments
157240 ** to VACUUM are silently ignored. This is a back-out of a bug fix that
157241 ** occurred on 2016-08-19 (https://sqlite.org/src/info/083f9e6270).
157242 ** The buggy behavior is required for binary compatibility with some
157243 ** legacy applications. */
157244 iDb = sqlite3FindDb(pParse->db, pNm);
157245 if( iDb<0 ) iDb = 0;
157246 #endif
@@ -161953,11 +161953,11 @@
161953 ** ON or USING clause of a LEFT JOIN, and terms that are usable as
161954 ** indices.
161955 **
161956 ** This optimization also only applies if the (x1 OR x2 OR ...) term
161957 ** is not contained in the ON clause of a LEFT JOIN.
161958 ** See ticket http://sqlite.org/src/info/f2369304e4
161959 **
161960 ** 2022-02-04: Do not push down slices of a row-value comparison.
161961 ** In other words, "w" or "y" may not be a slice of a vector. Otherwise,
161962 ** the initialization of the right-hand operand of the vector comparison
161963 ** might not occur, or might occur only in an OR branch that is not
@@ -199281,11 +199281,11 @@
199281 UNUSED_PARAMETER(nVal);
199282
199283 fts3tokResetCursor(pCsr);
199284 if( idxNum==1 ){
199285 const char *zByte = (const char *)sqlite3_value_text(apVal[0]);
199286 sqlite3_int64 nByte = sqlite3_value_bytes(apVal[0]);
199287 pCsr->zInput = sqlite3_malloc64(nByte+1);
199288 if( pCsr->zInput==0 ){
199289 rc = SQLITE_NOMEM;
199290 }else{
199291 if( nByte>0 ) memcpy(pCsr->zInput, zByte, nByte);
@@ -207828,12 +207828,12 @@
207828 ** with JSON-5 extensions is accepted as input.
207829 **
207830 ** Beginning with version 3.45.0 (circa 2024-01-01), these routines also
207831 ** accept BLOB values that have JSON encoded using a binary representation
207832 ** called "JSONB". The name JSONB comes from PostgreSQL, however the on-disk
207833 ** format for SQLite-JSONB is completely different and incompatible with
207834 ** PostgreSQL-JSONB.
207835 **
207836 ** Decoding and interpreting JSONB is still O(N) where N is the size of
207837 ** the input, the same as text JSON. However, the constant of proportionality
207838 ** for JSONB is much smaller due to faster parsing. The size of each
207839 ** element in JSONB is encoded in its header, so there is no need to search
@@ -207886,21 +207886,21 @@
207886 ** 14 4 byte (0-4294967295) 5
207887 ** 15 8 byte (0-1.8e19) 9
207888 **
207889 ** The payload size need not be expressed in its minimal form. For example,
207890 ** if the payload size is 10, the size can be expressed in any of 5 different
207891 ** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by one 0x0a byte,
207892 ** (3) (X>>4)==13 followed by 0x00 and 0x0a, (4) (X>>4)==14 followed by
207893 ** 0x00 0x00 0x00 0x0a, or (5) (X>>4)==15 followed by 7 bytes of 0x00 and
207894 ** a single byte of 0x0a. The shorter forms are preferred, of course, but
207895 ** sometimes when generating JSONB, the payload size is not known in advance
207896 ** and it is convenient to reserve sufficient header space to cover the
207897 ** largest possible payload size and then come back later and patch up
207898 ** the size when it becomes known, resulting in a non-minimal encoding.
207899 **
207900 ** The value (X>>4)==15 is not actually used in the current implementation
207901 ** (as SQLite is currently unable to handle BLOBs larger than about 2GB)
207902 ** but is included in the design to allow for future enhancements.
207903 **
207904 ** The payload follows the header. NULL, TRUE, and FALSE have no payload and
207905 ** their payload size must always be zero. The payload for INT, INT5,
207906 ** FLOAT, FLOAT5, TEXT, TEXTJ, TEXT5, and TEXTROW is text. Note that the
@@ -208970,11 +208970,11 @@
208970 if( jsonBlobExpand(pParse, pParse->nBlob+szPayload+9) ) return;
208971 jsonBlobAppendNode(pParse, eType, szPayload, aPayload);
208972 }
208973
208974
208975 /* Append a node type byte together with the payload size and
208976 ** possibly also the payload.
208977 **
208978 ** If aPayload is not NULL, then it is a pointer to the payload which
208979 ** is also appended. If aPayload is NULL, the pParse->aBlob[] array
208980 ** is resized (if necessary) so that it is big enough to hold the
@@ -210304,10 +210304,86 @@
210304 (void)jsonbPayloadSize(pParse, iRoot, &sz);
210305 pParse->nBlob = nBlob;
210306 sz += pParse->delta;
210307 pParse->delta += jsonBlobChangePayloadSize(pParse, iRoot, sz);
210308 }
210309
210310 /*
210311 ** If the JSONB at aIns[0..nIns-1] can be expanded (by denormalizing the
210312 ** size field) by d bytes, then write the expansion into aOut[] and
210313 ** return true. In this way, an overwrite happens without changing the
210314 ** size of the JSONB, which reduces memcpy() operations and also make it
210315 ** faster and easier to update the B-Tree entry that contains the JSONB
210316 ** in the database.
210317 **
210318 ** If the expansion of aIns[] by d bytes cannot be (easily) accomplished
210319 ** then return false.
210320 **
210321 ** The d parameter is guaranteed to be between 1 and 8.
210322 **
210323 ** This routine is an optimization. A correct answer is obtained if it
210324 ** always leaves the output unchanged and returns false.
210325 */
210326 static int jsonBlobOverwrite(
210327 u8 *aOut, /* Overwrite here */
210328 const u8 *aIns, /* New content */
210329 u32 nIns, /* Bytes of new content */
210330 u32 d /* Need to expand new content by this much */
210331 ){
210332 u32 szPayload; /* Bytes of payload */
210333 u32 i; /* New header size, after expansion & a loop counter */
210334 u8 szHdr; /* Size of header before expansion */
210335
210336 /* Lookup table for finding the upper 4 bits of the first byte of the
210337 ** expanded aIns[], based on the size of the expanded aIns[] header:
210338 **
210339 ** 2 3 4 5 6 7 8 9 */
210340 static const u8 aType[] = { 0xc0, 0xd0, 0, 0xe0, 0, 0, 0, 0xf0 };
210341
210342 if( (aIns[0]&0x0f)<=2 ) return 0; /* Cannot enlarge NULL, true, false */
210343 switch( aIns[0]>>4 ){
210344 default: { /* aIns[] header size 1 */
210345 if( ((1<<d)&0x116)==0 ) return 0; /* d must be 1, 2, 4, or 8 */
210346 i = d + 1; /* New hdr sz: 2, 3, 5, or 9 */
210347 szHdr = 1;
210348 break;
210349 }
210350 case 12: { /* aIns[] header size is 2 */
210351 if( ((1<<d)&0x8a)==0) return 0; /* d must be 1, 3, or 7 */
210352 i = d + 2; /* New hdr sz: 2, 5, or 9 */
210353 szHdr = 2;
210354 break;
210355 }
210356 case 13: { /* aIns[] header size is 3 */
210357 if( d!=2 && d!=6 ) return 0; /* d must be 2 or 6 */
210358 i = d + 3; /* New hdr sz: 5 or 9 */
210359 szHdr = 3;
210360 break;
210361 }
210362 case 14: { /* aIns[] header size is 5 */
210363 if( d!=4 ) return 0; /* d must be 4 */
210364 i = 9; /* New hdr sz: 9 */
210365 szHdr = 5;
210366 break;
210367 }
210368 case 15: { /* aIns[] header size is 9 */
210369 return 0; /* No solution */
210370 }
210371 }
210372 assert( i>=2 && i<=9 && aType[i-2]!=0 );
210373 aOut[0] = (aIns[0] & 0x0f) | aType[i-2];
210374 memcpy(&aOut[i], &aIns[szHdr], nIns-szHdr);
210375 szPayload = nIns - szHdr;
210376 while( 1/*edit-by-break*/ ){
210377 i--;
210378 aOut[i] = szPayload & 0xff;
210379 if( i==1 ) break;
210380 szPayload >>= 8;
210381 }
210382 assert( (szPayload>>8)==0 );
210383 return 1;
210384 }
210385
210386 /*
210387 ** Modify the JSONB blob at pParse->aBlob by removing nDel bytes of
210388 ** content beginning at iDel, and replacing them with nIns bytes of
210389 ** content given by aIns.
@@ -210326,10 +210402,15 @@
210402 u32 nDel, /* Number of bytes to remove */
210403 const u8 *aIns, /* Content to insert */
210404 u32 nIns /* Bytes of content to insert */
210405 ){
210406 i64 d = (i64)nIns - (i64)nDel;
210407 if( d<0 && d>=(-8) && aIns!=0
210408 && jsonBlobOverwrite(&pParse->aBlob[iDel], aIns, nIns, (int)-d)
210409 ){
210410 return;
210411 }
210412 if( d!=0 ){
210413 if( pParse->nBlob + d > pParse->nBlobAlloc ){
210414 jsonBlobExpand(pParse, pParse->nBlob+d);
210415 if( pParse->oom ) return;
210416 }
@@ -210337,11 +210418,13 @@
210418 &pParse->aBlob[iDel+nDel],
210419 pParse->nBlob - (iDel+nDel));
210420 pParse->nBlob += d;
210421 pParse->delta += d;
210422 }
210423 if( nIns && aIns ){
210424 memcpy(&pParse->aBlob[iDel], aIns, nIns);
210425 }
210426 }
210427
210428 /*
210429 ** Return the number of escaped newlines to be ignored.
210430 ** An escaped newline is a one of the following byte sequences:
@@ -211100,11 +211183,11 @@
211183 }
211184 return 0;
211185 }
211186
211187 /* argv[0] is a BLOB that seems likely to be a JSONB. Subsequent
211188 ** arguments come in pairs where each pair contains a JSON path and
211189 ** content to insert or set at that patch. Do the updates
211190 ** and return the result.
211191 **
211192 ** The specific operation is determined by eEdit, which can be one
211193 ** of JEDIT_INS, JEDIT_REPL, or JEDIT_SET.
@@ -230169,11 +230252,13 @@
230252 char *zExpr = 0;
230253 sqlite3 *db = pSession->db;
230254 SessionTable *pTo; /* Table zTbl */
230255
230256 /* Locate and if necessary initialize the target table object */
230257 pSession->bAutoAttach++;
230258 rc = sessionFindTable(pSession, zTbl, &pTo);
230259 pSession->bAutoAttach--;
230260 if( pTo==0 ) goto diff_out;
230261 if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){
230262 rc = pSession->rc;
230263 goto diff_out;
230264 }
@@ -257088,11 +257173,11 @@
257173 int nArg, /* Number of args */
257174 sqlite3_value **apUnused /* Function arguments */
257175 ){
257176 assert( nArg==0 );
257177 UNUSED_PARAM2(nArg, apUnused);
257178 sqlite3_result_text(pCtx, "fts5: 2025-04-10 10:18:07 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6", -1, SQLITE_TRANSIENT);
257179 }
257180
257181 /*
257182 ** Implementation of fts5_locale(LOCALE, TEXT) function.
257183 **
@@ -261151,11 +261236,10 @@
261236 }
261237 iTbl++;
261238 }
261239 aAscii[0] = 0; /* 0x00 is never a token character */
261240 }
 
261241
261242 /*
261243 ** 2015 May 30
261244 **
261245 ** The author disclaims copyright to this source code. In place of
261246
--- 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-03-27 23:29:25 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85"
151
+#define SQLITE_SOURCE_ID "2025-04-10 10:18:07 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- 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-03-27 23:29:25 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- 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-10 10:18:07 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157

Keyboard Shortcuts

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