Fossil SCM

Update the built-in SQLite to version 3.43.1.

danield 2023-09-14 08:04 trunk
Commit 1fea5c2ce9d791f32486f76be43591e55d86035e693bf18a090132717c147605
+4 -4
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -3488,19 +3488,19 @@
34883488
return pA;
34893489
}
34903490
34913491
/*
34923492
** SQL Function: decimal(X)
3493
-** OR: decimal_sci(X)
3493
+** OR: decimal_exp(X)
34943494
**
34953495
** Convert input X into decimal and then back into text.
34963496
**
34973497
** If X is originally a float, then a full decimal expansion of that floating
34983498
** point value is done. Or if X is an 8-byte blob, it is interpreted
34993499
** as a float and similarly expanded.
35003500
**
3501
-** The decimal_sci(X) function returns the result in scientific notation.
3501
+** The decimal_exp(X) function returns the result in exponential notation.
35023502
** decimal(X) returns a complete decimal, without the e+NNN at the end.
35033503
*/
35043504
static void decimalFunc(
35053505
sqlite3_context *context,
35063506
int argc,
@@ -3699,11 +3699,11 @@
36993699
int nArg;
37003700
int iArg;
37013701
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
37023702
} aFunc[] = {
37033703
{ "decimal", 1, 0, decimalFunc },
3704
- { "decimal_sci", 1, 1, decimalFunc },
3704
+ { "decimal_exp", 1, 1, decimalFunc },
37053705
{ "decimal_cmp", 2, 0, decimalCmpFunc },
37063706
{ "decimal_add", 2, 0, decimalAddFunc },
37073707
{ "decimal_sub", 2, 0, decimalSubFunc },
37083708
{ "decimal_mul", 2, 0, decimalMulFunc },
37093709
{ "decimal_pow2", 1, 0, decimalPow2Func },
@@ -20590,11 +20590,11 @@
2059020590
".check GLOB Fail if output since .testcase does not match",
2059120591
".clone NEWDB Clone data into NEWDB from the existing database",
2059220592
#endif
2059320593
".connection [close] [#] Open or close an auxiliary database connection",
2059420594
#if defined(_WIN32) || defined(WIN32)
20595
- ".crnl on|off Turn translate \\n to \\r\\n. Default ON",
20595
+ ".crnl on|off Translate \\n to \\r\\n. Default ON",
2059620596
#endif
2059720597
".databases List names and files of attached databases",
2059820598
".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
2059920599
#if SQLITE_SHELL_HAVE_RECOVER
2060020600
".dbinfo ?DB? Show status information about the database",
2060120601
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -3488,19 +3488,19 @@
3488 return pA;
3489 }
3490
3491 /*
3492 ** SQL Function: decimal(X)
3493 ** OR: decimal_sci(X)
3494 **
3495 ** Convert input X into decimal and then back into text.
3496 **
3497 ** If X is originally a float, then a full decimal expansion of that floating
3498 ** point value is done. Or if X is an 8-byte blob, it is interpreted
3499 ** as a float and similarly expanded.
3500 **
3501 ** The decimal_sci(X) function returns the result in scientific notation.
3502 ** decimal(X) returns a complete decimal, without the e+NNN at the end.
3503 */
3504 static void decimalFunc(
3505 sqlite3_context *context,
3506 int argc,
@@ -3699,11 +3699,11 @@
3699 int nArg;
3700 int iArg;
3701 void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
3702 } aFunc[] = {
3703 { "decimal", 1, 0, decimalFunc },
3704 { "decimal_sci", 1, 1, decimalFunc },
3705 { "decimal_cmp", 2, 0, decimalCmpFunc },
3706 { "decimal_add", 2, 0, decimalAddFunc },
3707 { "decimal_sub", 2, 0, decimalSubFunc },
3708 { "decimal_mul", 2, 0, decimalMulFunc },
3709 { "decimal_pow2", 1, 0, decimalPow2Func },
@@ -20590,11 +20590,11 @@
20590 ".check GLOB Fail if output since .testcase does not match",
20591 ".clone NEWDB Clone data into NEWDB from the existing database",
20592 #endif
20593 ".connection [close] [#] Open or close an auxiliary database connection",
20594 #if defined(_WIN32) || defined(WIN32)
20595 ".crnl on|off Turn translate \\n to \\r\\n. Default ON",
20596 #endif
20597 ".databases List names and files of attached databases",
20598 ".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
20599 #if SQLITE_SHELL_HAVE_RECOVER
20600 ".dbinfo ?DB? Show status information about the database",
20601
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -3488,19 +3488,19 @@
3488 return pA;
3489 }
3490
3491 /*
3492 ** SQL Function: decimal(X)
3493 ** OR: decimal_exp(X)
3494 **
3495 ** Convert input X into decimal and then back into text.
3496 **
3497 ** If X is originally a float, then a full decimal expansion of that floating
3498 ** point value is done. Or if X is an 8-byte blob, it is interpreted
3499 ** as a float and similarly expanded.
3500 **
3501 ** The decimal_exp(X) function returns the result in exponential notation.
3502 ** decimal(X) returns a complete decimal, without the e+NNN at the end.
3503 */
3504 static void decimalFunc(
3505 sqlite3_context *context,
3506 int argc,
@@ -3699,11 +3699,11 @@
3699 int nArg;
3700 int iArg;
3701 void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
3702 } aFunc[] = {
3703 { "decimal", 1, 0, decimalFunc },
3704 { "decimal_exp", 1, 1, decimalFunc },
3705 { "decimal_cmp", 2, 0, decimalCmpFunc },
3706 { "decimal_add", 2, 0, decimalAddFunc },
3707 { "decimal_sub", 2, 0, decimalSubFunc },
3708 { "decimal_mul", 2, 0, decimalMulFunc },
3709 { "decimal_pow2", 1, 0, decimalPow2Func },
@@ -20590,11 +20590,11 @@
20590 ".check GLOB Fail if output since .testcase does not match",
20591 ".clone NEWDB Clone data into NEWDB from the existing database",
20592 #endif
20593 ".connection [close] [#] Open or close an auxiliary database connection",
20594 #if defined(_WIN32) || defined(WIN32)
20595 ".crnl on|off Translate \\n to \\r\\n. Default ON",
20596 #endif
20597 ".databases List names and files of attached databases",
20598 ".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
20599 #if SQLITE_SHELL_HAVE_RECOVER
20600 ".dbinfo ?DB? Show status information about the database",
20601
+124 -103
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.43.0. By combining all the individual C code files into this
3
+** version 3.43.1. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -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
-** c7eeb055bfb0e5a4467d8a45fa53d84bb8a.
21
+** d3a40c05c49e1a49264912b1a05bc2143ac.
2222
*/
2323
#define SQLITE_CORE 1
2424
#define SQLITE_AMALGAMATION 1
2525
#ifndef SQLITE_PRIVATE
2626
# define SQLITE_PRIVATE static
@@ -457,13 +457,13 @@
457457
**
458458
** See also: [sqlite3_libversion()],
459459
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460460
** [sqlite_version()] and [sqlite_source_id()].
461461
*/
462
-#define SQLITE_VERSION "3.43.0"
463
-#define SQLITE_VERSION_NUMBER 3043000
464
-#define SQLITE_SOURCE_ID "2023-08-18 12:15:44 ec7eeb055bfb0e5a4467d8a45fa53d84bb8ae80ca0474b687e2783e971648008"
462
+#define SQLITE_VERSION "3.43.1"
463
+#define SQLITE_VERSION_NUMBER 3043001
464
+#define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
465465
466466
/*
467467
** CAPI3REF: Run-Time Library Version Numbers
468468
** KEYWORDS: sqlite3_version sqlite3_sourceid
469469
**
@@ -15655,11 +15655,11 @@
1565515655
#else
1565615656
# define disable_simulated_io_errors()
1565715657
# define enable_simulated_io_errors()
1565815658
#endif
1565915659
15660
-#ifdef SQLITE_USE_SEH
15660
+#if defined(SQLITE_USE_SEH) && !defined(SQLITE_OMIT_WAL)
1566115661
SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager*);
1566215662
#endif
1566315663
1566415664
#endif /* SQLITE_PAGER_H */
1566515665
@@ -35178,11 +35178,11 @@
3517835178
** precision.
3517935179
**
3518035180
** The error terms on constants like 1.0e+100 computed using the
3518135181
** decimal extension, for example as follows:
3518235182
**
35183
- ** SELECT decimal_sci(decimal_sub('1.0e+100',decimal(1.0e+100)));
35183
+ ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100)));
3518435184
*/
3518535185
double rr[2];
3518635186
rr[0] = r;
3518735187
rr[1] = 0.0;
3518835188
if( rr[0]>1.84e+19 ){
@@ -53452,18 +53452,28 @@
5345253452
5345353453
/*
5345453454
** Return 1 if pPg is on the dirty list for pCache. Return 0 if not.
5345553455
** This routine runs inside of assert() statements only.
5345653456
*/
53457
-#ifdef SQLITE_DEBUG
53457
+#if defined(SQLITE_ENABLE_EXPENSIVE_ASSERT)
5345853458
static int pageOnDirtyList(PCache *pCache, PgHdr *pPg){
5345953459
PgHdr *p;
5346053460
for(p=pCache->pDirty; p; p=p->pDirtyNext){
5346153461
if( p==pPg ) return 1;
5346253462
}
5346353463
return 0;
5346453464
}
53465
+static int pageNotOnDirtyList(PCache *pCache, PgHdr *pPg){
53466
+ PgHdr *p;
53467
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
53468
+ if( p==pPg ) return 0;
53469
+ }
53470
+ return 1;
53471
+}
53472
+#else
53473
+# define pageOnDirtyList(A,B) 1
53474
+# define pageNotOnDirtyList(A,B) 1
5346553475
#endif
5346653476
5346753477
/*
5346853478
** Check invariants on a PgHdr entry. Return true if everything is OK.
5346953479
** Return false if any invariant is violated.
@@ -53480,11 +53490,11 @@
5348053490
assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
5348153491
pCache = pPg->pCache;
5348253492
assert( pCache!=0 ); /* Every page has an associated PCache */
5348353493
if( pPg->flags & PGHDR_CLEAN ){
5348453494
assert( (pPg->flags & PGHDR_DIRTY)==0 );/* Cannot be both CLEAN and DIRTY */
53485
- assert( !pageOnDirtyList(pCache, pPg) );/* CLEAN pages not on dirty list */
53495
+ assert( pageNotOnDirtyList(pCache, pPg) );/* CLEAN pages not on dirtylist */
5348653496
}else{
5348753497
assert( (pPg->flags & PGHDR_DIRTY)!=0 );/* If not CLEAN must be DIRTY */
5348853498
assert( pPg->pDirtyNext==0 || pPg->pDirtyNext->pDirtyPrev==pPg );
5348953499
assert( pPg->pDirtyPrev==0 || pPg->pDirtyPrev->pDirtyNext==pPg );
5349053500
assert( pPg->pDirtyPrev!=0 || pCache->pDirty==pPg );
@@ -56130,10 +56140,11 @@
5613056140
# define sqlite3WalExclusiveMode(y,z) 0
5613156141
# define sqlite3WalHeapMemory(z) 0
5613256142
# define sqlite3WalFramesize(z) 0
5613356143
# define sqlite3WalFindFrame(x,y,z) 0
5613456144
# define sqlite3WalFile(x) 0
56145
+# undef SQLITE_USE_SEH
5613556146
#else
5613656147
5613756148
#define WAL_SAVEPOINT_NDATA 4
5613856149
5613956150
/* Connection to a write-ahead log (WAL) file.
@@ -128448,12 +128459,14 @@
128448128459
p = sqlite3_aggregate_context(context, 0);
128449128460
if( p && p->cnt>0 ){
128450128461
if( p->approx ){
128451128462
if( p->ovrfl ){
128452128463
sqlite3_result_error(context,"integer overflow",-1);
128453
- }else{
128464
+ }else if( !sqlite3IsNaN(p->rErr) ){
128454128465
sqlite3_result_double(context, p->rSum+p->rErr);
128466
+ }else{
128467
+ sqlite3_result_double(context, p->rSum);
128455128468
}
128456128469
}else{
128457128470
sqlite3_result_int64(context, p->iSum);
128458128471
}
128459128472
}
@@ -128462,11 +128475,12 @@
128462128475
SumCtx *p;
128463128476
p = sqlite3_aggregate_context(context, 0);
128464128477
if( p && p->cnt>0 ){
128465128478
double r;
128466128479
if( p->approx ){
128467
- r = p->rSum+p->rErr;
128480
+ r = p->rSum;
128481
+ if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
128468128482
}else{
128469128483
r = (double)(p->iSum);
128470128484
}
128471128485
sqlite3_result_double(context, r/(double)p->cnt);
128472128486
}
@@ -128475,11 +128489,12 @@
128475128489
SumCtx *p;
128476128490
double r = 0.0;
128477128491
p = sqlite3_aggregate_context(context, 0);
128478128492
if( p ){
128479128493
if( p->approx ){
128480
- r = p->rSum+p->rErr;
128494
+ r = p->rSum;
128495
+ if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
128481128496
}else{
128482128497
r = (double)(p->iSum);
128483128498
}
128484128499
}
128485128500
sqlite3_result_double(context, r);
@@ -145678,16 +145693,16 @@
145678145693
assert( pItem->pTab!=0 );
145679145694
pTab = pItem->pTab;
145680145695
assert( pItem->pSelect!=0 );
145681145696
pSub = pItem->pSelect;
145682145697
assert( pSub->pEList->nExpr==pTab->nCol );
145683
- if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
145684
- testcase( pSub->selFlags & SF_Distinct );
145685
- testcase( pSub->selFlags & SF_Aggregate );
145686
- return 0;
145687
- }
145688145698
for(pX=pSub; pX; pX=pX->pPrior){
145699
+ if( (pX->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
145700
+ testcase( pX->selFlags & SF_Distinct );
145701
+ testcase( pX->selFlags & SF_Aggregate );
145702
+ return 0;
145703
+ }
145689145704
if( pX->pPrior && pX->op!=TK_ALL ){
145690145705
/* This optimization does not work for compound subqueries that
145691145706
** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
145692145707
return 0;
145693145708
}
@@ -198071,11 +198086,11 @@
198071198086
Fts3SegFilter filter;
198072198087
Fts3MultiSegReader csr;
198073198088
int rc;
198074198089
u64 cksum = 0;
198075198090
198076
- assert( *pRc==SQLITE_OK );
198091
+ if( *pRc ) return 0;
198077198092
198078198093
memset(&filter, 0, sizeof(filter));
198079198094
memset(&csr, 0, sizeof(csr));
198080198095
filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
198081198096
filter.flags |= FTS3_SEGMENT_SCAN;
@@ -203701,11 +203716,13 @@
203701203716
if( pNode==0 ){
203702203717
return;
203703203718
}
203704203719
if( pNode->eType==JSON_ARRAY ){
203705203720
while( 1 /*exit-by-break*/ ){
203706
- for(i=1; i<=pNode->n; n++){
203721
+ i = 1;
203722
+ while( i<=pNode->n ){
203723
+ if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++;
203707203724
i += jsonNodeSize(&pNode[i]);
203708203725
}
203709203726
if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
203710203727
if( p->useMod==0 ) break;
203711203728
assert( pNode->eU==2 );
@@ -206989,11 +207006,11 @@
206989207006
#ifdef SQLITE_RTREE_INT_ONLY
206990207007
p->u.rValue = iVal;
206991207008
#else
206992207009
p->u.rValue = (double)iVal;
206993207010
if( iVal>=((sqlite3_int64)1)<<48
206994
- || -iVal>=((sqlite3_int64)1)<<48
207011
+ || iVal<=-(((sqlite3_int64)1)<<48)
206995207012
){
206996207013
if( p->op==RTREE_LT ) p->op = RTREE_LE;
206997207014
if( p->op==RTREE_GT ) p->op = RTREE_GE;
206998207015
}
206999207016
#endif
@@ -222973,19 +222990,23 @@
222973222990
pIn->iNext += nByte;
222974222991
}
222975222992
}
222976222993
}
222977222994
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
222978
- sqlite3_int64 v = sessionGetI64(aVal);
222979
- if( eType==SQLITE_INTEGER ){
222980
- sqlite3VdbeMemSetInt64(apOut[i], v);
222995
+ if( (pIn->nData-pIn->iNext)<8 ){
222996
+ rc = SQLITE_CORRUPT_BKPT;
222981222997
}else{
222982
- double d;
222983
- memcpy(&d, &v, 8);
222984
- sqlite3VdbeMemSetDouble(apOut[i], d);
222998
+ sqlite3_int64 v = sessionGetI64(aVal);
222999
+ if( eType==SQLITE_INTEGER ){
223000
+ sqlite3VdbeMemSetInt64(apOut[i], v);
223001
+ }else{
223002
+ double d;
223003
+ memcpy(&d, &v, 8);
223004
+ sqlite3VdbeMemSetDouble(apOut[i], d);
223005
+ }
223006
+ pIn->iNext += 8;
222985223007
}
222986
- pIn->iNext += 8;
222987223008
}
222988223009
}
222989223010
}
222990223011
222991223012
return rc;
@@ -239807,84 +239828,83 @@
239807239828
iOff += nSuffix2;
239808239829
iNextOff += nSuffix2;
239809239830
}
239810239831
}
239811239832
}else if( iStart==4 ){
239812
- int iPgno;
239813
-
239814
- assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
239815
- /* The entry being removed may be the only position list in
239816
- ** its doclist. */
239817
- for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
239818
- Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
239819
- int bEmpty = (pPg && pPg->nn==4);
239820
- fts5DataRelease(pPg);
239821
- if( bEmpty==0 ) break;
239822
- }
239823
-
239824
- if( iPgno==pSeg->iTermLeafPgno ){
239825
- i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
239826
- Fts5Data *pTerm = fts5DataRead(p, iId);
239827
- if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
239828
- u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
239829
- int nTermIdx = pTerm->nn - pTerm->szLeaf;
239830
- int iTermIdx = 0;
239831
- int iTermOff = 0;
239832
-
239833
- while( 1 ){
239834
- u32 iVal = 0;
239835
- int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
239836
- iTermOff += iVal;
239837
- if( (iTermIdx+nByte)>=nTermIdx ) break;
239838
- iTermIdx += nByte;
239839
- }
239840
- nTermIdx = iTermIdx;
239841
-
239842
- memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
239843
- fts5PutU16(&pTerm->p[2], iTermOff);
239844
-
239845
- fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
239846
- if( nTermIdx==0 ){
239847
- fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
239848
- }
239849
- }
239850
- fts5DataRelease(pTerm);
239851
- }
239852
- }
239853
-
239854
- if( p->rc==SQLITE_OK ){
239855
- const int nMove = nPg - iNextOff;
239856
- int nShift = 0;
239857
-
239858
- memmove(&aPg[iOff], &aPg[iNextOff], nMove);
239859
- iPgIdx -= (iNextOff - iOff);
239860
- nPg = iPgIdx;
239861
- fts5PutU16(&aPg[2], iPgIdx);
239862
-
239863
- nShift = iNextOff - iOff;
239864
- for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
239865
- u32 iVal = 0;
239866
- iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
239867
- iKeyOff += iVal;
239868
- if( iKeyOff!=iDelKeyOff ){
239869
- if( iKeyOff>iOff ){
239870
- iKeyOff -= nShift;
239871
- nShift = 0;
239872
- }
239873
- nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
239874
- iPrevKeyOff = iKeyOff;
239875
- }
239876
- }
239877
-
239878
- if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
239879
- fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
239880
- }
239881
-
239882
- assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
239883
- fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg,nPg);
239884
- }
239885
- sqlite3_free(aIdx);
239833
+ int iPgno;
239834
+
239835
+ assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
239836
+ /* The entry being removed may be the only position list in
239837
+ ** its doclist. */
239838
+ for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
239839
+ Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
239840
+ int bEmpty = (pPg && pPg->nn==4);
239841
+ fts5DataRelease(pPg);
239842
+ if( bEmpty==0 ) break;
239843
+ }
239844
+
239845
+ if( iPgno==pSeg->iTermLeafPgno ){
239846
+ i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
239847
+ Fts5Data *pTerm = fts5DataRead(p, iId);
239848
+ if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
239849
+ u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
239850
+ int nTermIdx = pTerm->nn - pTerm->szLeaf;
239851
+ int iTermIdx = 0;
239852
+ int iTermOff = 0;
239853
+
239854
+ while( 1 ){
239855
+ u32 iVal = 0;
239856
+ int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
239857
+ iTermOff += iVal;
239858
+ if( (iTermIdx+nByte)>=nTermIdx ) break;
239859
+ iTermIdx += nByte;
239860
+ }
239861
+ nTermIdx = iTermIdx;
239862
+
239863
+ memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
239864
+ fts5PutU16(&pTerm->p[2], iTermOff);
239865
+
239866
+ fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
239867
+ if( nTermIdx==0 ){
239868
+ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
239869
+ }
239870
+ }
239871
+ fts5DataRelease(pTerm);
239872
+ }
239873
+ }
239874
+
239875
+ if( p->rc==SQLITE_OK ){
239876
+ const int nMove = nPg - iNextOff; /* Number of bytes to move */
239877
+ int nShift = iNextOff - iOff; /* Distance to move them */
239878
+
239879
+ int iPrevKeyOut = 0;
239880
+ int iKeyIn = 0;
239881
+
239882
+ memmove(&aPg[iOff], &aPg[iNextOff], nMove);
239883
+ iPgIdx -= nShift;
239884
+ nPg = iPgIdx;
239885
+ fts5PutU16(&aPg[2], iPgIdx);
239886
+
239887
+ for(iIdx=0; iIdx<nIdx; /* no-op */){
239888
+ u32 iVal = 0;
239889
+ iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
239890
+ iKeyIn += iVal;
239891
+ if( iKeyIn!=iDelKeyOff ){
239892
+ int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
239893
+ nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
239894
+ iPrevKeyOut = iKeyOut;
239895
+ }
239896
+ }
239897
+
239898
+ if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
239899
+ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
239900
+ }
239901
+
239902
+ assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
239903
+ fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
239904
+ }
239905
+ sqlite3_free(aIdx);
239886239906
}
239887239907
239888239908
/*
239889239909
** This is called as part of flushing a delete to disk in 'secure-delete'
239890239910
** mode. It edits the segments within the database described by argument
@@ -240030,11 +240050,12 @@
240030240050
fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
240031240051
pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid);
240032240052
writer.bFirstRowidInPage = 0;
240033240053
fts5WriteDlidxAppend(p, &writer, iRowid);
240034240054
}else{
240035
- pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid-iPrev);
240055
+ u64 iRowidDelta = (u64)iRowid - (u64)iPrev;
240056
+ pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowidDelta);
240036240057
}
240037240058
if( p->rc!=SQLITE_OK ) break;
240038240059
assert( pBuf->n<=pBuf->nSpace );
240039240060
iPrev = iRowid;
240040240061
@@ -245731,11 +245752,11 @@
245731245752
int nArg, /* Number of args */
245732245753
sqlite3_value **apUnused /* Function arguments */
245733245754
){
245734245755
assert( nArg==0 );
245735245756
UNUSED_PARAM2(nArg, apUnused);
245736
- sqlite3_result_text(pCtx, "fts5: 2023-08-17 17:48:20 3c06709335eb4b98e3a684e3ebbae69eeb6a21b452bce29159c82bb632d6a042", -1, SQLITE_TRANSIENT);
245757
+ sqlite3_result_text(pCtx, "fts5: 2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0", -1, SQLITE_TRANSIENT);
245737245758
}
245738245759
245739245760
/*
245740245761
** Return true if zName is the extension on one of the shadow tables used
245741245762
** by this module.
245742245763
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.43.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -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 ** c7eeb055bfb0e5a4467d8a45fa53d84bb8a.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -457,13 +457,13 @@
457 **
458 ** See also: [sqlite3_libversion()],
459 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460 ** [sqlite_version()] and [sqlite_source_id()].
461 */
462 #define SQLITE_VERSION "3.43.0"
463 #define SQLITE_VERSION_NUMBER 3043000
464 #define SQLITE_SOURCE_ID "2023-08-18 12:15:44 ec7eeb055bfb0e5a4467d8a45fa53d84bb8ae80ca0474b687e2783e971648008"
465
466 /*
467 ** CAPI3REF: Run-Time Library Version Numbers
468 ** KEYWORDS: sqlite3_version sqlite3_sourceid
469 **
@@ -15655,11 +15655,11 @@
15655 #else
15656 # define disable_simulated_io_errors()
15657 # define enable_simulated_io_errors()
15658 #endif
15659
15660 #ifdef SQLITE_USE_SEH
15661 SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager*);
15662 #endif
15663
15664 #endif /* SQLITE_PAGER_H */
15665
@@ -35178,11 +35178,11 @@
35178 ** precision.
35179 **
35180 ** The error terms on constants like 1.0e+100 computed using the
35181 ** decimal extension, for example as follows:
35182 **
35183 ** SELECT decimal_sci(decimal_sub('1.0e+100',decimal(1.0e+100)));
35184 */
35185 double rr[2];
35186 rr[0] = r;
35187 rr[1] = 0.0;
35188 if( rr[0]>1.84e+19 ){
@@ -53452,18 +53452,28 @@
53452
53453 /*
53454 ** Return 1 if pPg is on the dirty list for pCache. Return 0 if not.
53455 ** This routine runs inside of assert() statements only.
53456 */
53457 #ifdef SQLITE_DEBUG
53458 static int pageOnDirtyList(PCache *pCache, PgHdr *pPg){
53459 PgHdr *p;
53460 for(p=pCache->pDirty; p; p=p->pDirtyNext){
53461 if( p==pPg ) return 1;
53462 }
53463 return 0;
53464 }
 
 
 
 
 
 
 
 
 
 
53465 #endif
53466
53467 /*
53468 ** Check invariants on a PgHdr entry. Return true if everything is OK.
53469 ** Return false if any invariant is violated.
@@ -53480,11 +53490,11 @@
53480 assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
53481 pCache = pPg->pCache;
53482 assert( pCache!=0 ); /* Every page has an associated PCache */
53483 if( pPg->flags & PGHDR_CLEAN ){
53484 assert( (pPg->flags & PGHDR_DIRTY)==0 );/* Cannot be both CLEAN and DIRTY */
53485 assert( !pageOnDirtyList(pCache, pPg) );/* CLEAN pages not on dirty list */
53486 }else{
53487 assert( (pPg->flags & PGHDR_DIRTY)!=0 );/* If not CLEAN must be DIRTY */
53488 assert( pPg->pDirtyNext==0 || pPg->pDirtyNext->pDirtyPrev==pPg );
53489 assert( pPg->pDirtyPrev==0 || pPg->pDirtyPrev->pDirtyNext==pPg );
53490 assert( pPg->pDirtyPrev!=0 || pCache->pDirty==pPg );
@@ -56130,10 +56140,11 @@
56130 # define sqlite3WalExclusiveMode(y,z) 0
56131 # define sqlite3WalHeapMemory(z) 0
56132 # define sqlite3WalFramesize(z) 0
56133 # define sqlite3WalFindFrame(x,y,z) 0
56134 # define sqlite3WalFile(x) 0
 
56135 #else
56136
56137 #define WAL_SAVEPOINT_NDATA 4
56138
56139 /* Connection to a write-ahead log (WAL) file.
@@ -128448,12 +128459,14 @@
128448 p = sqlite3_aggregate_context(context, 0);
128449 if( p && p->cnt>0 ){
128450 if( p->approx ){
128451 if( p->ovrfl ){
128452 sqlite3_result_error(context,"integer overflow",-1);
128453 }else{
128454 sqlite3_result_double(context, p->rSum+p->rErr);
 
 
128455 }
128456 }else{
128457 sqlite3_result_int64(context, p->iSum);
128458 }
128459 }
@@ -128462,11 +128475,12 @@
128462 SumCtx *p;
128463 p = sqlite3_aggregate_context(context, 0);
128464 if( p && p->cnt>0 ){
128465 double r;
128466 if( p->approx ){
128467 r = p->rSum+p->rErr;
 
128468 }else{
128469 r = (double)(p->iSum);
128470 }
128471 sqlite3_result_double(context, r/(double)p->cnt);
128472 }
@@ -128475,11 +128489,12 @@
128475 SumCtx *p;
128476 double r = 0.0;
128477 p = sqlite3_aggregate_context(context, 0);
128478 if( p ){
128479 if( p->approx ){
128480 r = p->rSum+p->rErr;
 
128481 }else{
128482 r = (double)(p->iSum);
128483 }
128484 }
128485 sqlite3_result_double(context, r);
@@ -145678,16 +145693,16 @@
145678 assert( pItem->pTab!=0 );
145679 pTab = pItem->pTab;
145680 assert( pItem->pSelect!=0 );
145681 pSub = pItem->pSelect;
145682 assert( pSub->pEList->nExpr==pTab->nCol );
145683 if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
145684 testcase( pSub->selFlags & SF_Distinct );
145685 testcase( pSub->selFlags & SF_Aggregate );
145686 return 0;
145687 }
145688 for(pX=pSub; pX; pX=pX->pPrior){
 
 
 
 
 
145689 if( pX->pPrior && pX->op!=TK_ALL ){
145690 /* This optimization does not work for compound subqueries that
145691 ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
145692 return 0;
145693 }
@@ -198071,11 +198086,11 @@
198071 Fts3SegFilter filter;
198072 Fts3MultiSegReader csr;
198073 int rc;
198074 u64 cksum = 0;
198075
198076 assert( *pRc==SQLITE_OK );
198077
198078 memset(&filter, 0, sizeof(filter));
198079 memset(&csr, 0, sizeof(csr));
198080 filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
198081 filter.flags |= FTS3_SEGMENT_SCAN;
@@ -203701,11 +203716,13 @@
203701 if( pNode==0 ){
203702 return;
203703 }
203704 if( pNode->eType==JSON_ARRAY ){
203705 while( 1 /*exit-by-break*/ ){
203706 for(i=1; i<=pNode->n; n++){
 
 
203707 i += jsonNodeSize(&pNode[i]);
203708 }
203709 if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
203710 if( p->useMod==0 ) break;
203711 assert( pNode->eU==2 );
@@ -206989,11 +207006,11 @@
206989 #ifdef SQLITE_RTREE_INT_ONLY
206990 p->u.rValue = iVal;
206991 #else
206992 p->u.rValue = (double)iVal;
206993 if( iVal>=((sqlite3_int64)1)<<48
206994 || -iVal>=((sqlite3_int64)1)<<48
206995 ){
206996 if( p->op==RTREE_LT ) p->op = RTREE_LE;
206997 if( p->op==RTREE_GT ) p->op = RTREE_GE;
206998 }
206999 #endif
@@ -222973,19 +222990,23 @@
222973 pIn->iNext += nByte;
222974 }
222975 }
222976 }
222977 if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
222978 sqlite3_int64 v = sessionGetI64(aVal);
222979 if( eType==SQLITE_INTEGER ){
222980 sqlite3VdbeMemSetInt64(apOut[i], v);
222981 }else{
222982 double d;
222983 memcpy(&d, &v, 8);
222984 sqlite3VdbeMemSetDouble(apOut[i], d);
 
 
 
 
 
 
222985 }
222986 pIn->iNext += 8;
222987 }
222988 }
222989 }
222990
222991 return rc;
@@ -239807,84 +239828,83 @@
239807 iOff += nSuffix2;
239808 iNextOff += nSuffix2;
239809 }
239810 }
239811 }else if( iStart==4 ){
239812 int iPgno;
239813
239814 assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
239815 /* The entry being removed may be the only position list in
239816 ** its doclist. */
239817 for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
239818 Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
239819 int bEmpty = (pPg && pPg->nn==4);
239820 fts5DataRelease(pPg);
239821 if( bEmpty==0 ) break;
239822 }
239823
239824 if( iPgno==pSeg->iTermLeafPgno ){
239825 i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
239826 Fts5Data *pTerm = fts5DataRead(p, iId);
239827 if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
239828 u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
239829 int nTermIdx = pTerm->nn - pTerm->szLeaf;
239830 int iTermIdx = 0;
239831 int iTermOff = 0;
239832
239833 while( 1 ){
239834 u32 iVal = 0;
239835 int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
239836 iTermOff += iVal;
239837 if( (iTermIdx+nByte)>=nTermIdx ) break;
239838 iTermIdx += nByte;
239839 }
239840 nTermIdx = iTermIdx;
239841
239842 memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
239843 fts5PutU16(&pTerm->p[2], iTermOff);
239844
239845 fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
239846 if( nTermIdx==0 ){
239847 fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
239848 }
239849 }
239850 fts5DataRelease(pTerm);
239851 }
239852 }
239853
239854 if( p->rc==SQLITE_OK ){
239855 const int nMove = nPg - iNextOff;
239856 int nShift = 0;
239857
239858 memmove(&aPg[iOff], &aPg[iNextOff], nMove);
239859 iPgIdx -= (iNextOff - iOff);
239860 nPg = iPgIdx;
239861 fts5PutU16(&aPg[2], iPgIdx);
239862
239863 nShift = iNextOff - iOff;
239864 for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
239865 u32 iVal = 0;
239866 iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
239867 iKeyOff += iVal;
239868 if( iKeyOff!=iDelKeyOff ){
239869 if( iKeyOff>iOff ){
239870 iKeyOff -= nShift;
239871 nShift = 0;
239872 }
239873 nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
239874 iPrevKeyOff = iKeyOff;
239875 }
239876 }
239877
239878 if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
239879 fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
239880 }
239881
239882 assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
239883 fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg,nPg);
239884 }
239885 sqlite3_free(aIdx);
239886 }
239887
239888 /*
239889 ** This is called as part of flushing a delete to disk in 'secure-delete'
239890 ** mode. It edits the segments within the database described by argument
@@ -240030,11 +240050,12 @@
240030 fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
240031 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid);
240032 writer.bFirstRowidInPage = 0;
240033 fts5WriteDlidxAppend(p, &writer, iRowid);
240034 }else{
240035 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid-iPrev);
 
240036 }
240037 if( p->rc!=SQLITE_OK ) break;
240038 assert( pBuf->n<=pBuf->nSpace );
240039 iPrev = iRowid;
240040
@@ -245731,11 +245752,11 @@
245731 int nArg, /* Number of args */
245732 sqlite3_value **apUnused /* Function arguments */
245733 ){
245734 assert( nArg==0 );
245735 UNUSED_PARAM2(nArg, apUnused);
245736 sqlite3_result_text(pCtx, "fts5: 2023-08-17 17:48:20 3c06709335eb4b98e3a684e3ebbae69eeb6a21b452bce29159c82bb632d6a042", -1, SQLITE_TRANSIENT);
245737 }
245738
245739 /*
245740 ** Return true if zName is the extension on one of the shadow tables used
245741 ** by this module.
245742
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.43.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -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 ** d3a40c05c49e1a49264912b1a05bc2143ac.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -457,13 +457,13 @@
457 **
458 ** See also: [sqlite3_libversion()],
459 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460 ** [sqlite_version()] and [sqlite_source_id()].
461 */
462 #define SQLITE_VERSION "3.43.1"
463 #define SQLITE_VERSION_NUMBER 3043001
464 #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
465
466 /*
467 ** CAPI3REF: Run-Time Library Version Numbers
468 ** KEYWORDS: sqlite3_version sqlite3_sourceid
469 **
@@ -15655,11 +15655,11 @@
15655 #else
15656 # define disable_simulated_io_errors()
15657 # define enable_simulated_io_errors()
15658 #endif
15659
15660 #if defined(SQLITE_USE_SEH) && !defined(SQLITE_OMIT_WAL)
15661 SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager*);
15662 #endif
15663
15664 #endif /* SQLITE_PAGER_H */
15665
@@ -35178,11 +35178,11 @@
35178 ** precision.
35179 **
35180 ** The error terms on constants like 1.0e+100 computed using the
35181 ** decimal extension, for example as follows:
35182 **
35183 ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100)));
35184 */
35185 double rr[2];
35186 rr[0] = r;
35187 rr[1] = 0.0;
35188 if( rr[0]>1.84e+19 ){
@@ -53452,18 +53452,28 @@
53452
53453 /*
53454 ** Return 1 if pPg is on the dirty list for pCache. Return 0 if not.
53455 ** This routine runs inside of assert() statements only.
53456 */
53457 #if defined(SQLITE_ENABLE_EXPENSIVE_ASSERT)
53458 static int pageOnDirtyList(PCache *pCache, PgHdr *pPg){
53459 PgHdr *p;
53460 for(p=pCache->pDirty; p; p=p->pDirtyNext){
53461 if( p==pPg ) return 1;
53462 }
53463 return 0;
53464 }
53465 static int pageNotOnDirtyList(PCache *pCache, PgHdr *pPg){
53466 PgHdr *p;
53467 for(p=pCache->pDirty; p; p=p->pDirtyNext){
53468 if( p==pPg ) return 0;
53469 }
53470 return 1;
53471 }
53472 #else
53473 # define pageOnDirtyList(A,B) 1
53474 # define pageNotOnDirtyList(A,B) 1
53475 #endif
53476
53477 /*
53478 ** Check invariants on a PgHdr entry. Return true if everything is OK.
53479 ** Return false if any invariant is violated.
@@ -53480,11 +53490,11 @@
53490 assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
53491 pCache = pPg->pCache;
53492 assert( pCache!=0 ); /* Every page has an associated PCache */
53493 if( pPg->flags & PGHDR_CLEAN ){
53494 assert( (pPg->flags & PGHDR_DIRTY)==0 );/* Cannot be both CLEAN and DIRTY */
53495 assert( pageNotOnDirtyList(pCache, pPg) );/* CLEAN pages not on dirtylist */
53496 }else{
53497 assert( (pPg->flags & PGHDR_DIRTY)!=0 );/* If not CLEAN must be DIRTY */
53498 assert( pPg->pDirtyNext==0 || pPg->pDirtyNext->pDirtyPrev==pPg );
53499 assert( pPg->pDirtyPrev==0 || pPg->pDirtyPrev->pDirtyNext==pPg );
53500 assert( pPg->pDirtyPrev!=0 || pCache->pDirty==pPg );
@@ -56130,10 +56140,11 @@
56140 # define sqlite3WalExclusiveMode(y,z) 0
56141 # define sqlite3WalHeapMemory(z) 0
56142 # define sqlite3WalFramesize(z) 0
56143 # define sqlite3WalFindFrame(x,y,z) 0
56144 # define sqlite3WalFile(x) 0
56145 # undef SQLITE_USE_SEH
56146 #else
56147
56148 #define WAL_SAVEPOINT_NDATA 4
56149
56150 /* Connection to a write-ahead log (WAL) file.
@@ -128448,12 +128459,14 @@
128459 p = sqlite3_aggregate_context(context, 0);
128460 if( p && p->cnt>0 ){
128461 if( p->approx ){
128462 if( p->ovrfl ){
128463 sqlite3_result_error(context,"integer overflow",-1);
128464 }else if( !sqlite3IsNaN(p->rErr) ){
128465 sqlite3_result_double(context, p->rSum+p->rErr);
128466 }else{
128467 sqlite3_result_double(context, p->rSum);
128468 }
128469 }else{
128470 sqlite3_result_int64(context, p->iSum);
128471 }
128472 }
@@ -128462,11 +128475,12 @@
128475 SumCtx *p;
128476 p = sqlite3_aggregate_context(context, 0);
128477 if( p && p->cnt>0 ){
128478 double r;
128479 if( p->approx ){
128480 r = p->rSum;
128481 if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
128482 }else{
128483 r = (double)(p->iSum);
128484 }
128485 sqlite3_result_double(context, r/(double)p->cnt);
128486 }
@@ -128475,11 +128489,12 @@
128489 SumCtx *p;
128490 double r = 0.0;
128491 p = sqlite3_aggregate_context(context, 0);
128492 if( p ){
128493 if( p->approx ){
128494 r = p->rSum;
128495 if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
128496 }else{
128497 r = (double)(p->iSum);
128498 }
128499 }
128500 sqlite3_result_double(context, r);
@@ -145678,16 +145693,16 @@
145693 assert( pItem->pTab!=0 );
145694 pTab = pItem->pTab;
145695 assert( pItem->pSelect!=0 );
145696 pSub = pItem->pSelect;
145697 assert( pSub->pEList->nExpr==pTab->nCol );
 
 
 
 
 
145698 for(pX=pSub; pX; pX=pX->pPrior){
145699 if( (pX->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
145700 testcase( pX->selFlags & SF_Distinct );
145701 testcase( pX->selFlags & SF_Aggregate );
145702 return 0;
145703 }
145704 if( pX->pPrior && pX->op!=TK_ALL ){
145705 /* This optimization does not work for compound subqueries that
145706 ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
145707 return 0;
145708 }
@@ -198071,11 +198086,11 @@
198086 Fts3SegFilter filter;
198087 Fts3MultiSegReader csr;
198088 int rc;
198089 u64 cksum = 0;
198090
198091 if( *pRc ) return 0;
198092
198093 memset(&filter, 0, sizeof(filter));
198094 memset(&csr, 0, sizeof(csr));
198095 filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;
198096 filter.flags |= FTS3_SEGMENT_SCAN;
@@ -203701,11 +203716,13 @@
203716 if( pNode==0 ){
203717 return;
203718 }
203719 if( pNode->eType==JSON_ARRAY ){
203720 while( 1 /*exit-by-break*/ ){
203721 i = 1;
203722 while( i<=pNode->n ){
203723 if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++;
203724 i += jsonNodeSize(&pNode[i]);
203725 }
203726 if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
203727 if( p->useMod==0 ) break;
203728 assert( pNode->eU==2 );
@@ -206989,11 +207006,11 @@
207006 #ifdef SQLITE_RTREE_INT_ONLY
207007 p->u.rValue = iVal;
207008 #else
207009 p->u.rValue = (double)iVal;
207010 if( iVal>=((sqlite3_int64)1)<<48
207011 || iVal<=-(((sqlite3_int64)1)<<48)
207012 ){
207013 if( p->op==RTREE_LT ) p->op = RTREE_LE;
207014 if( p->op==RTREE_GT ) p->op = RTREE_GE;
207015 }
207016 #endif
@@ -222973,19 +222990,23 @@
222990 pIn->iNext += nByte;
222991 }
222992 }
222993 }
222994 if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
222995 if( (pIn->nData-pIn->iNext)<8 ){
222996 rc = SQLITE_CORRUPT_BKPT;
 
222997 }else{
222998 sqlite3_int64 v = sessionGetI64(aVal);
222999 if( eType==SQLITE_INTEGER ){
223000 sqlite3VdbeMemSetInt64(apOut[i], v);
223001 }else{
223002 double d;
223003 memcpy(&d, &v, 8);
223004 sqlite3VdbeMemSetDouble(apOut[i], d);
223005 }
223006 pIn->iNext += 8;
223007 }
 
223008 }
223009 }
223010 }
223011
223012 return rc;
@@ -239807,84 +239828,83 @@
239828 iOff += nSuffix2;
239829 iNextOff += nSuffix2;
239830 }
239831 }
239832 }else if( iStart==4 ){
239833 int iPgno;
239834
239835 assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
239836 /* The entry being removed may be the only position list in
239837 ** its doclist. */
239838 for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
239839 Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
239840 int bEmpty = (pPg && pPg->nn==4);
239841 fts5DataRelease(pPg);
239842 if( bEmpty==0 ) break;
239843 }
239844
239845 if( iPgno==pSeg->iTermLeafPgno ){
239846 i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
239847 Fts5Data *pTerm = fts5DataRead(p, iId);
239848 if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
239849 u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
239850 int nTermIdx = pTerm->nn - pTerm->szLeaf;
239851 int iTermIdx = 0;
239852 int iTermOff = 0;
239853
239854 while( 1 ){
239855 u32 iVal = 0;
239856 int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
239857 iTermOff += iVal;
239858 if( (iTermIdx+nByte)>=nTermIdx ) break;
239859 iTermIdx += nByte;
239860 }
239861 nTermIdx = iTermIdx;
239862
239863 memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
239864 fts5PutU16(&pTerm->p[2], iTermOff);
239865
239866 fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
239867 if( nTermIdx==0 ){
239868 fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
239869 }
239870 }
239871 fts5DataRelease(pTerm);
239872 }
239873 }
239874
239875 if( p->rc==SQLITE_OK ){
239876 const int nMove = nPg - iNextOff; /* Number of bytes to move */
239877 int nShift = iNextOff - iOff; /* Distance to move them */
239878
239879 int iPrevKeyOut = 0;
239880 int iKeyIn = 0;
239881
239882 memmove(&aPg[iOff], &aPg[iNextOff], nMove);
239883 iPgIdx -= nShift;
239884 nPg = iPgIdx;
239885 fts5PutU16(&aPg[2], iPgIdx);
239886
239887 for(iIdx=0; iIdx<nIdx; /* no-op */){
239888 u32 iVal = 0;
239889 iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
239890 iKeyIn += iVal;
239891 if( iKeyIn!=iDelKeyOff ){
239892 int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
239893 nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
239894 iPrevKeyOut = iKeyOut;
239895 }
239896 }
239897
239898 if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
239899 fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
239900 }
239901
239902 assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
239903 fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
239904 }
239905 sqlite3_free(aIdx);
 
239906 }
239907
239908 /*
239909 ** This is called as part of flushing a delete to disk in 'secure-delete'
239910 ** mode. It edits the segments within the database described by argument
@@ -240030,11 +240050,12 @@
240050 fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
240051 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid);
240052 writer.bFirstRowidInPage = 0;
240053 fts5WriteDlidxAppend(p, &writer, iRowid);
240054 }else{
240055 u64 iRowidDelta = (u64)iRowid - (u64)iPrev;
240056 pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowidDelta);
240057 }
240058 if( p->rc!=SQLITE_OK ) break;
240059 assert( pBuf->n<=pBuf->nSpace );
240060 iPrev = iRowid;
240061
@@ -245731,11 +245752,11 @@
245752 int nArg, /* Number of args */
245753 sqlite3_value **apUnused /* Function arguments */
245754 ){
245755 assert( nArg==0 );
245756 UNUSED_PARAM2(nArg, apUnused);
245757 sqlite3_result_text(pCtx, "fts5: 2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0", -1, SQLITE_TRANSIENT);
245758 }
245759
245760 /*
245761 ** Return true if zName is the extension on one of the shadow tables used
245762 ** by this module.
245763
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144144
**
145145
** See also: [sqlite3_libversion()],
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149
-#define SQLITE_VERSION "3.43.0"
150
-#define SQLITE_VERSION_NUMBER 3043000
151
-#define SQLITE_SOURCE_ID "2023-08-18 12:15:44 ec7eeb055bfb0e5a4467d8a45fa53d84bb8ae80ca0474b687e2783e971648008"
149
+#define SQLITE_VERSION "3.43.1"
150
+#define SQLITE_VERSION_NUMBER 3043001
151
+#define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.43.0"
150 #define SQLITE_VERSION_NUMBER 3043000
151 #define SQLITE_SOURCE_ID "2023-08-18 12:15:44 ec7eeb055bfb0e5a4467d8a45fa53d84bb8ae80ca0474b687e2783e971648008"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.43.1"
150 #define SQLITE_VERSION_NUMBER 3043001
151 #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
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