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:
parent
2b94704916
commit
d2485583fd
187
deps/sqlite/sqlite3.c
vendored
187
deps/sqlite/sqlite3.c
vendored
@ -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 ){
|
|
||||||
testcase( pSub->selFlags & SF_Distinct );
|
|
||||||
testcase( pSub->selFlags & SF_Aggregate );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
for(pX=pSub; pX; pX=pX->pPrior){
|
for(pX=pSub; pX; pX=pX->pPrior){
|
||||||
|
if( (pX->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
|
||||||
|
testcase( pX->selFlags & SF_Distinct );
|
||||||
|
testcase( pX->selFlags & SF_Aggregate );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
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,15 +222992,19 @@ static int sessionReadRecord(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
|
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
|
||||||
sqlite3_int64 v = sessionGetI64(aVal);
|
if( (pIn->nData-pIn->iNext)<8 ){
|
||||||
if( eType==SQLITE_INTEGER ){
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
sqlite3VdbeMemSetInt64(apOut[i], v);
|
|
||||||
}else{
|
}else{
|
||||||
double d;
|
sqlite3_int64 v = sessionGetI64(aVal);
|
||||||
memcpy(&d, &v, 8);
|
if( eType==SQLITE_INTEGER ){
|
||||||
sqlite3VdbeMemSetDouble(apOut[i], d);
|
sqlite3VdbeMemSetInt64(apOut[i], v);
|
||||||
|
}else{
|
||||||
|
double d;
|
||||||
|
memcpy(&d, &v, 8);
|
||||||
|
sqlite3VdbeMemSetDouble(apOut[i], d);
|
||||||
|
}
|
||||||
|
pIn->iNext += 8;
|
||||||
}
|
}
|
||||||
pIn->iNext += 8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239820,80 +239830,79 @@ static void fts5DoSecureDelete(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if( iStart==4 ){
|
}else if( iStart==4 ){
|
||||||
int iPgno;
|
int iPgno;
|
||||||
|
|
||||||
assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
|
assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
|
||||||
/* The entry being removed may be the only position list in
|
/* The entry being removed may be the only position list in
|
||||||
** its doclist. */
|
** its doclist. */
|
||||||
for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
|
for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
|
||||||
Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
|
Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
|
||||||
int bEmpty = (pPg && pPg->nn==4);
|
int bEmpty = (pPg && pPg->nn==4);
|
||||||
fts5DataRelease(pPg);
|
fts5DataRelease(pPg);
|
||||||
if( bEmpty==0 ) break;
|
if( bEmpty==0 ) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iPgno==pSeg->iTermLeafPgno ){
|
if( iPgno==pSeg->iTermLeafPgno ){
|
||||||
i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
|
i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
|
||||||
Fts5Data *pTerm = fts5DataRead(p, iId);
|
Fts5Data *pTerm = fts5DataRead(p, iId);
|
||||||
if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
|
if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
|
||||||
u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
|
u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
|
||||||
int nTermIdx = pTerm->nn - pTerm->szLeaf;
|
int nTermIdx = pTerm->nn - pTerm->szLeaf;
|
||||||
int iTermIdx = 0;
|
int iTermIdx = 0;
|
||||||
int iTermOff = 0;
|
int iTermOff = 0;
|
||||||
|
|
||||||
while( 1 ){
|
while( 1 ){
|
||||||
u32 iVal = 0;
|
u32 iVal = 0;
|
||||||
int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
|
int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
|
||||||
iTermOff += iVal;
|
iTermOff += iVal;
|
||||||
if( (iTermIdx+nByte)>=nTermIdx ) break;
|
if( (iTermIdx+nByte)>=nTermIdx ) break;
|
||||||
iTermIdx += nByte;
|
iTermIdx += nByte;
|
||||||
}
|
|
||||||
nTermIdx = iTermIdx;
|
|
||||||
|
|
||||||
memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
|
|
||||||
fts5PutU16(&pTerm->p[2], iTermOff);
|
|
||||||
|
|
||||||
fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
|
|
||||||
if( nTermIdx==0 ){
|
|
||||||
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fts5DataRelease(pTerm);
|
nTermIdx = iTermIdx;
|
||||||
|
|
||||||
|
memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
|
||||||
|
fts5PutU16(&pTerm->p[2], iTermOff);
|
||||||
|
|
||||||
|
fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
|
||||||
|
if( nTermIdx==0 ){
|
||||||
|
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fts5DataRelease(pTerm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( p->rc==SQLITE_OK ){
|
||||||
|
const int nMove = nPg - iNextOff; /* Number of bytes to move */
|
||||||
|
int nShift = iNextOff - iOff; /* Distance to move them */
|
||||||
|
|
||||||
|
int iPrevKeyOut = 0;
|
||||||
|
int iKeyIn = 0;
|
||||||
|
|
||||||
|
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
|
||||||
|
iPgIdx -= nShift;
|
||||||
|
nPg = iPgIdx;
|
||||||
|
fts5PutU16(&aPg[2], iPgIdx);
|
||||||
|
|
||||||
|
for(iIdx=0; iIdx<nIdx; /* no-op */){
|
||||||
|
u32 iVal = 0;
|
||||||
|
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
|
||||||
|
iKeyIn += iVal;
|
||||||
|
if( iKeyIn!=iDelKeyOff ){
|
||||||
|
int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
|
||||||
|
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
|
||||||
|
iPrevKeyOut = iKeyOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( p->rc==SQLITE_OK ){
|
if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
|
||||||
const int nMove = nPg - iNextOff;
|
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
|
||||||
int nShift = 0;
|
|
||||||
|
|
||||||
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
|
|
||||||
iPgIdx -= (iNextOff - iOff);
|
|
||||||
nPg = iPgIdx;
|
|
||||||
fts5PutU16(&aPg[2], iPgIdx);
|
|
||||||
|
|
||||||
nShift = iNextOff - iOff;
|
|
||||||
for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
|
|
||||||
u32 iVal = 0;
|
|
||||||
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
|
|
||||||
iKeyOff += iVal;
|
|
||||||
if( iKeyOff!=iDelKeyOff ){
|
|
||||||
if( iKeyOff>iOff ){
|
|
||||||
iKeyOff -= nShift;
|
|
||||||
nShift = 0;
|
|
||||||
}
|
|
||||||
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
|
|
||||||
iPrevKeyOff = iKeyOff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
|
|
||||||
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
|
|
||||||
fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg,nPg);
|
|
||||||
}
|
}
|
||||||
sqlite3_free(aIdx);
|
|
||||||
|
assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
|
||||||
|
fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
|
||||||
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
6
deps/sqlite/sqlite3.h
vendored
6
deps/sqlite/sqlite3.h
vendored
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user