sqlite-amalgamation-3430100.zip

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4459 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-09-13 21:19:37 +00:00
parent 2b94704916
commit d2485583fd
2 changed files with 101 additions and 92 deletions

67
deps/sqlite/sqlite3.c vendored
View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite ** This file is an amalgamation of many separate C source files from SQLite
** version 3.43.0. By combining all the individual C code files into this ** version 3.43.1. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation ** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be ** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements ** possible if the files were compiled separately. Performance improvements
@ -18,7 +18,7 @@
** separate file. This file contains only code for the core SQLite library. ** separate file. This file contains only code for the core SQLite library.
** **
** The content in this amalgamation comes from Fossil check-in ** The content in this amalgamation comes from Fossil check-in
** f80b798b3f4b81a7bb4233c58294edd0f11. ** d3a40c05c49e1a49264912b1a05bc2143ac.
*/ */
#define SQLITE_CORE 1 #define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1 #define SQLITE_AMALGAMATION 1
@ -459,9 +459,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.43.0" #define SQLITE_VERSION "3.43.1"
#define SQLITE_VERSION_NUMBER 3043000 #define SQLITE_VERSION_NUMBER 3043001
#define SQLITE_SOURCE_ID "2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c" #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -128461,8 +128461,10 @@ static void sumFinalize(sqlite3_context *context){
if( p->approx ){ if( p->approx ){
if( p->ovrfl ){ if( p->ovrfl ){
sqlite3_result_error(context,"integer overflow",-1); sqlite3_result_error(context,"integer overflow",-1);
}else{ }else if( !sqlite3IsNaN(p->rErr) ){
sqlite3_result_double(context, p->rSum+p->rErr); sqlite3_result_double(context, p->rSum+p->rErr);
}else{
sqlite3_result_double(context, p->rSum);
} }
}else{ }else{
sqlite3_result_int64(context, p->iSum); sqlite3_result_int64(context, p->iSum);
@ -128475,7 +128477,8 @@ static void avgFinalize(sqlite3_context *context){
if( p && p->cnt>0 ){ if( p && p->cnt>0 ){
double r; double r;
if( p->approx ){ if( p->approx ){
r = p->rSum+p->rErr; r = p->rSum;
if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
}else{ }else{
r = (double)(p->iSum); r = (double)(p->iSum);
} }
@ -128488,7 +128491,8 @@ static void totalFinalize(sqlite3_context *context){
p = sqlite3_aggregate_context(context, 0); p = sqlite3_aggregate_context(context, 0);
if( p ){ if( p ){
if( p->approx ){ if( p->approx ){
r = p->rSum+p->rErr; r = p->rSum;
if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
}else{ }else{
r = (double)(p->iSum); r = (double)(p->iSum);
} }
@ -145691,12 +145695,12 @@ static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
assert( pItem->pSelect!=0 ); assert( pItem->pSelect!=0 );
pSub = pItem->pSelect; pSub = pItem->pSelect;
assert( pSub->pEList->nExpr==pTab->nCol ); assert( pSub->pEList->nExpr==pTab->nCol );
if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){ for(pX=pSub; pX; pX=pX->pPrior){
testcase( pSub->selFlags & SF_Distinct ); if( (pX->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
testcase( pSub->selFlags & SF_Aggregate ); testcase( pX->selFlags & SF_Distinct );
testcase( pX->selFlags & SF_Aggregate );
return 0; return 0;
} }
for(pX=pSub; pX; pX=pX->pPrior){
if( pX->pPrior && pX->op!=TK_ALL ){ if( pX->pPrior && pX->op!=TK_ALL ){
/* This optimization does not work for compound subqueries that /* This optimization does not work for compound subqueries that
** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */ ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
@ -198084,7 +198088,7 @@ static u64 fts3ChecksumIndex(
int rc; int rc;
u64 cksum = 0; u64 cksum = 0;
assert( *pRc==SQLITE_OK ); if( *pRc ) return 0;
memset(&filter, 0, sizeof(filter)); memset(&filter, 0, sizeof(filter));
memset(&csr, 0, sizeof(csr)); memset(&csr, 0, sizeof(csr));
@ -203714,7 +203718,9 @@ static void jsonArrayLengthFunc(
} }
if( pNode->eType==JSON_ARRAY ){ if( pNode->eType==JSON_ARRAY ){
while( 1 /*exit-by-break*/ ){ while( 1 /*exit-by-break*/ ){
for(i=1; i<=pNode->n; n++){ i = 1;
while( i<=pNode->n ){
if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++;
i += jsonNodeSize(&pNode[i]); i += jsonNodeSize(&pNode[i]);
} }
if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
@ -222986,6 +222992,9 @@ static int sessionReadRecord(
} }
} }
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
if( (pIn->nData-pIn->iNext)<8 ){
rc = SQLITE_CORRUPT_BKPT;
}else{
sqlite3_int64 v = sessionGetI64(aVal); sqlite3_int64 v = sessionGetI64(aVal);
if( eType==SQLITE_INTEGER ){ if( eType==SQLITE_INTEGER ){
sqlite3VdbeMemSetInt64(apOut[i], v); sqlite3VdbeMemSetInt64(apOut[i], v);
@ -222998,6 +223007,7 @@ static int sessionReadRecord(
} }
} }
} }
}
return rc; return rc;
} }
@ -239863,26 +239873,25 @@ static void fts5DoSecureDelete(
} }
if( p->rc==SQLITE_OK ){ if( p->rc==SQLITE_OK ){
const int nMove = nPg - iNextOff; const int nMove = nPg - iNextOff; /* Number of bytes to move */
int nShift = 0; int nShift = iNextOff - iOff; /* Distance to move them */
int iPrevKeyOut = 0;
int iKeyIn = 0;
memmove(&aPg[iOff], &aPg[iNextOff], nMove); memmove(&aPg[iOff], &aPg[iNextOff], nMove);
iPgIdx -= (iNextOff - iOff); iPgIdx -= nShift;
nPg = iPgIdx; nPg = iPgIdx;
fts5PutU16(&aPg[2], iPgIdx); fts5PutU16(&aPg[2], iPgIdx);
nShift = iNextOff - iOff; for(iIdx=0; iIdx<nIdx; /* no-op */){
for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
u32 iVal = 0; u32 iVal = 0;
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal); iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
iKeyOff += iVal; iKeyIn += iVal;
if( iKeyOff!=iDelKeyOff ){ if( iKeyIn!=iDelKeyOff ){
if( iKeyOff>iOff ){ int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
iKeyOff -= nShift; nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
nShift = 0; iPrevKeyOut = iKeyOut;
}
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
iPrevKeyOff = iKeyOff;
} }
} }
@ -239891,7 +239900,7 @@ static void fts5DoSecureDelete(
} }
assert_nc( nPg>4 || fts5GetU16(aPg)==0 ); assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg,nPg); fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
} }
sqlite3_free(aIdx); sqlite3_free(aIdx);
} }
@ -245745,7 +245754,7 @@ static void fts5SourceIdFunc(
){ ){
assert( nArg==0 ); assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused); UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c", -1, SQLITE_TRANSIENT); sqlite3_result_text(pCtx, "fts5: 2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0", -1, SQLITE_TRANSIENT);
} }
/* /*

View File

@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.43.0" #define SQLITE_VERSION "3.43.1"
#define SQLITE_VERSION_NUMBER 3043000 #define SQLITE_VERSION_NUMBER 3043001
#define SQLITE_SOURCE_ID "2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c" #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers