deps: update sqlite to 3.53.1

PR-URL: https://github.com/nodejs/node/pull/63217
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Jithil P Ponnan <jithil@outlook.com>
This commit is contained in:
Node.js GitHub Bot authored and Juan José Arboleda committed 2026-07-19 17:31:19 -05:00
1 parent c12b30e2fe
commit 980577df6d
2 files changed
+111 -77

No files matched your search

+105 -71
View File
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.53.0. By combining all the individual C code files into this
** version 3.53.1. By combining all the individual C code files into this
** 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
** 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.
**
** The content in this amalgamation comes from Fossil check-in
** 4525003a53a7fc63ca75c59b22c79608659c with changes in files:
** c88b22011a54b4f6fbd149e9f8e4de77658c with changes in files:
**
**
*/
@@ -467,12 +467,12 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.53.0"
#define SQLITE_VERSION_NUMBER 3053000
#define SQLITE_SOURCE_ID "2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b"
#define SQLITE_SCM_BRANCH "trunk"
#define SQLITE_SCM_TAGS "release major-release version-3.53.0"
#define SQLITE_SCM_DATETIME "2026-04-09T11:41:38.498Z"
#define SQLITE_VERSION "3.53.1"
#define SQLITE_VERSION_NUMBER 3053001
#define SQLITE_SOURCE_ID "2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9"
#define SQLITE_SCM_BRANCH "branch-3.53"
#define SQLITE_SCM_TAGS "release version-3.53.1"
#define SQLITE_SCM_DATETIME "2026-05-05T10:34:17.344Z"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -32513,7 +32513,7 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
sqlite3StrAccumSetError(pAccum, SQLITE_TOOBIG);
return 0;
}
z = sqlite3DbMallocRaw(pAccum->db, n);
z = sqlite3_malloc(n);
if( z==0 ){
sqlite3StrAccumSetError(pAccum, SQLITE_NOMEM);
}
@@ -32971,11 +32971,27 @@ SQLITE_API void sqlite3_str_vappendf(
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+10;
if( cThousand && e2>0 ) szBufNeeded += (e2+2)/3;
if( sqlite3StrAccumEnlargeIfNeeded(pAccum, szBufNeeded) ){
width = length = 0;
break;
if( szBufNeeded + pAccum->nChar >= pAccum->nAlloc ){
if( pAccum->mxAlloc==0 && pAccum->accError==0 ){
/* Unable to allocate space in pAccum, perhaps because it
** is coming from sqlite3_snprintf() or similar. We'll have
** to render into temporary space and the memcpy() it over. */
bufpt = sqlite3_malloc(szBufNeeded);
if( bufpt==0 ){
sqlite3StrAccumSetError(pAccum, SQLITE_NOMEM);
return;
}
zExtra = bufpt;
}else if( sqlite3StrAccumEnlarge(pAccum, szBufNeeded)<szBufNeeded ){
width = length = 0;
break;
}else{
bufpt = pAccum->zText + pAccum->nChar;
}
}else{
bufpt = pAccum->zText + pAccum->nChar;
}
bufpt = zOut = pAccum->zText + pAccum->nChar;
zOut = bufpt;
flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
/* The sign in front of the number */
@@ -33076,14 +33092,22 @@ SQLITE_API void sqlite3_str_vappendf(
}
length = width;
}
pAccum->nChar += length;
zOut[length] = 0;
/* Floating point conversions render directly into the output
** buffer. Hence, don't just break out of the switch(). Bypass the
** output buffer writing that occurs after the switch() by continuing
** to the next character in the format string. */
continue;
if( zExtra==0 ){
/* The result is being rendered directory into pAccum. This
** is the command and fast case */
pAccum->nChar += length;
zOut[length] = 0;
continue;
}else{
/* We were unable to render directly into pAccum because we
** couldn't allocate sufficient memory. We need to memcpy()
** the rendering (or some prefix thereof) into the output
** buffer. */
bufpt[0] = 0;
bufpt = zExtra;
break;
}
}
case etSIZE:
if( !bArgList ){
@@ -33130,7 +33154,7 @@ SQLITE_API void sqlite3_str_vappendf(
if( sqlite3StrAccumEnlargeIfNeeded(pAccum, nCopyBytes) ){
break;
}
sqlite3_str_append(pAccum,
sqlite3_str_append(pAccum,
&pAccum->zText[pAccum->nChar-nCopyBytes], nCopyBytes);
precision -= nPrior;
nPrior *= 2;
@@ -33646,7 +33670,7 @@ SQLITE_API void sqlite3_str_reset(StrAccum *p){
** of its content, all in one call.
*/
SQLITE_API void sqlite3_str_free(sqlite3_str *p){
if( p ){
if( p!=0 && p!=&sqlite3OomStr ){
sqlite3_str_reset(p);
sqlite3_free(p);
}
@@ -36792,15 +36816,20 @@ SQLITE_PRIVATE u8 sqlite3StrIHash(const char *z){
return h;
}
#if !defined(SQLITE_DISABLE_INTRINSIC) \
&& (defined(__GNUC__) || defined(__clang__)) \
&& (defined(__x86_64__) || defined(__aarch64__) || \
(defined(__riscv) && defined(__riscv_xlen) && (__riscv_xlen>32)))
#define SQLITE_USE_UINT128
#endif
/*
** Two inputs are multiplied to get a 128-bit result. Write the
** lower 64-bits of the result into *pLo, and return the high-order
** 64 bits.
*/
static u64 sqlite3Multiply128(u64 a, u64 b, u64 *pLo){
#if (defined(__GNUC__) || defined(__clang__)) \
&& (defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)) \
&& !defined(SQLITE_DISABLE_INTRINSIC)
#if defined(SQLITE_USE_UINT128)
__uint128_t r = (__uint128_t)a * b;
*pLo = (u64)r;
return (u64)(r>>64);
@@ -36834,9 +36863,7 @@ static u64 sqlite3Multiply128(u64 a, u64 b, u64 *pLo){
** The lower 64 bits of A*B are discarded.
*/
static u64 sqlite3Multiply160(u64 a, u32 aLo, u64 b, u32 *pLo){
#if (defined(__GNUC__) || defined(__clang__)) \
&& (defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)) \
&& !defined(SQLITE_DISABLE_INTRINSIC)
#if defined(SQLITE_USE_UINT128)
__uint128_t r = (__uint128_t)a * b;
r += ((__uint128_t)aLo * b) >> 32;
*pLo = (r>>32)&0xffffffff;
@@ -36874,6 +36901,8 @@ static u64 sqlite3Multiply160(u64 a, u32 aLo, u64 b, u32 *pLo){
#endif
}
#undef SQLITE_USE_UINT128
/*
** Return a u64 with the N-th bit set.
*/
@@ -56108,10 +56137,10 @@ SQLITE_API int sqlite3_deserialize(
if( rc ) goto end_deserialize;
db->init.iDb = (u8)iDb;
db->init.reopenMemdb = 1;
rc = sqlite3_step(pStmt);
sqlite3_step(pStmt);
db->init.reopenMemdb = 0;
if( rc!=SQLITE_DONE ){
rc = SQLITE_ERROR;
rc = sqlite3_finalize(pStmt);
if( rc!=SQLITE_OK ){
goto end_deserialize;
}
p = memdbFromDbSchema(db, zSchema);
@@ -56132,7 +56161,6 @@ SQLITE_API int sqlite3_deserialize(
}
end_deserialize:
sqlite3_finalize(pStmt);
if( pData && (mFlags & SQLITE_DESERIALIZE_FREEONCLOSE)!=0 ){
sqlite3_free(pData);
}
@@ -123122,7 +123150,9 @@ SQLITE_PRIVATE void sqlite3AlterDropConstraint(
if( !pTab ) return;
if( pCons ){
zArg = sqlite3MPrintf(db, "%.*Q", pCons->n, pCons->z);
char *z = sqlite3NameFromToken(db, pCons);
zArg = sqlite3MPrintf(db, "%Q", z);
sqlite3DbFree(db, z);
}else{
int iCol;
if( alterFindCol(pParse, pTab, pCol, &iCol) ) return;
@@ -125504,6 +125534,16 @@ static void attachFunc(
** from sqlite3_deserialize() to close database db->init.iDb and
** reopen it as a MemDB */
Btree *pNewBt = 0;
pNew = &db->aDb[db->init.iDb];
assert( pNew->pBt!=0 );
if( sqlite3BtreeTxnState(pNew->pBt)!=SQLITE_TXN_NONE
|| sqlite3BtreeIsInBackup(pNew->pBt)
){
rc = SQLITE_BUSY;
goto attach_error;
}
pVfs = sqlite3_vfs_find("memdb");
if( pVfs==0 ) return;
rc = sqlite3BtreeOpen(pVfs, "x\0", db, &pNewBt, 0, SQLITE_OPEN_MAIN_DB);
@@ -125513,8 +125553,7 @@ static void attachFunc(
/* Both the Btree and the new Schema were allocated successfully.
** Close the old db and update the aDb[] slot with the new memdb
** values. */
pNew = &db->aDb[db->init.iDb];
if( ALWAYS(pNew->pBt) ) sqlite3BtreeClose(pNew->pBt);
sqlite3BtreeClose(pNew->pBt);
pNew->pBt = pNewBt;
pNew->pSchema = pNewSchema;
}else{
@@ -156057,6 +156096,7 @@ static SQLITE_NOINLINE void existsToJoin(
&& !ExprHasProperty(pWhere, EP_OuterON|EP_InnerON)
&& ALWAYS(p->pSrc!=0)
&& p->pSrc->nSrc<BMS
&& (p->pLimit==0 || p->pLimit->pRight==0)
){
if( pWhere->op==TK_AND ){
Expr *pRight = pWhere->pRight;
@@ -156104,7 +156144,6 @@ static SQLITE_NOINLINE void existsToJoin(
sqlite3TreeViewSelect(0, p, 0);
}
#endif
existsToJoin(pParse, p, pSubWhere);
}
}
}
@@ -165946,7 +165985,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
** by this loop in the a[0] slot and all notReady tables in a[1..] slots.
** This becomes the SrcList in the recursive call to sqlite3WhereBegin().
*/
if( pWInfo->nLevel>1 ){
if( pWInfo->nLevel>1 || pTabItem->fg.fromExists ){
int nNotReady; /* The number of notReady tables */
SrcItem *origSrc; /* Original list of tables */
nNotReady = pWInfo->nLevel - iLevel - 1;
@@ -165959,6 +165998,13 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
for(k=1; k<=nNotReady; k++){
memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k]));
}
/* Clear the fromExists flag on the OR-optimized table entry so that
** the calls to sqlite3WhereEnd() do not code early-exits after the
** first row is visited. The early exit applies to this table's
** overall loop - including the multiple OR branches and any WHERE
** conditions not passed to the sub-loops - not to the sub-loops. */
pOrTab->a[0].fg.fromExists = 0;
}else{
pOrTab = pWInfo->pTabList;
}
@@ -166202,7 +166248,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
assert( pLevel->op==OP_Return );
pLevel->p2 = sqlite3VdbeCurrentAddr(v);
if( pWInfo->nLevel>1 ){ sqlite3DbFreeNN(db, pOrTab); }
if( pWInfo->pTabList!=pOrTab ){ sqlite3DbFreeNN(db, pOrTab); }
if( !untestedTerms ) disableTerm(pLevel, pTerm);
}else
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */
@@ -176127,27 +176173,11 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
}
#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
}
if( pTabList->a[pLevel->iFrom].fg.fromExists
&& (i==pWInfo->nLevel-1
|| pTabList->a[pWInfo->a[i+1].iFrom].fg.fromExists==0)
){
/* This is an EXISTS-to-JOIN optimization which is either the
** inner-most loop, or the inner-most of a group of nested
** EXISTS-to-JOIN optimization loops. If this loop sees a successful
** row, it should break out of itself as well as other EXISTS-to-JOIN
** loops in which is is directly nested. */
int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
while( nOuter<i ){
if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
nOuter++;
}
testcase( nOuter>0 );
sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
if( nOuter ){
VdbeComment((v, "EXISTS break %d..%d", i-nOuter, i));
}else{
VdbeComment((v, "EXISTS break %d", i));
}
if( pTabList->a[pLevel->iFrom].fg.fromExists ){
/* This is an EXISTS-to-JOIN optimization loop. If this loop sees a
** successful row, it should break out of itself. */
sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk);
VdbeComment((v, "EXISTS break %d", i));
}
sqlite3VdbeResolveLabel(v, pLevel->addrCont);
if( pLevel->op!=OP_Noop ){
@@ -184334,6 +184364,7 @@ static YYACTIONTYPE yy_reduce(
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
if( yymsp[-4].minor.yy454 ){
yymsp[-4].minor.yy454->x.pList = pList;
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
@@ -233951,10 +233982,11 @@ static int sessionSerialLen(const u8 *a){
int n;
assert( a!=0 );
e = *a;
if( e==0 || e==0xFF ) return 1;
if( e==SQLITE_NULL ) return 1;
if( e==SQLITE_INTEGER || e==SQLITE_FLOAT ) return 9;
return sessionVarintGet(&a[1], &n) + 1 + n;
if( e==SQLITE_TEXT || e==SQLITE_BLOB ){
return sessionVarintGet(&a[1], &n) + 1 + n;
}
return 1;
}
/*
@@ -233977,17 +234009,17 @@ static unsigned int sessionChangeHash(
u8 *a = aRecord; /* Used to iterate through change record */
for(i=0; i<pTab->nCol; i++){
int eType = *a;
int isPK = pTab->abPK[i];
if( bPkOnly && isPK==0 ) continue;
assert( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT
|| eType==SQLITE_TEXT || eType==SQLITE_BLOB
|| eType==SQLITE_NULL || eType==0
);
if( isPK ){
a++;
int eType = *a++;
assert( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT
|| eType==SQLITE_TEXT || eType==SQLITE_BLOB
|| eType==SQLITE_NULL || eType==0
);
h = sessionHashAppendType(h, eType);
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
h = sessionHashAppendI64(h, sessionGetI64(a));
@@ -237015,9 +237047,11 @@ static int sessionChangesetBufferRecord(
rc = sessionInputBuffer(pIn, nByte);
}else if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
nByte += 8;
}else if( eType!=0 && eType!=SQLITE_NULL ){
rc = SQLITE_CORRUPT_BKPT;
}
}
if( (pIn->iNext+nByte)>pIn->nData ){
if( rc==SQLITE_OK && (pIn->iNext+nByte)>pIn->nData ){
rc = SQLITE_CORRUPT_BKPT;
}
}
@@ -263222,7 +263256,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b", -1, SQLITE_TRANSIENT);
sqlite3_result_text(pCtx, "fts5: 2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9", -1, SQLITE_TRANSIENT);
}
/*
+6 -6
View File
@@ -146,12 +146,12 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.53.0"
#define SQLITE_VERSION_NUMBER 3053000
#define SQLITE_SOURCE_ID "2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b"
#define SQLITE_SCM_BRANCH "trunk"
#define SQLITE_SCM_TAGS "release major-release version-3.53.0"
#define SQLITE_SCM_DATETIME "2026-04-09T11:41:38.498Z"
#define SQLITE_VERSION "3.53.1"
#define SQLITE_VERSION_NUMBER 3053001
#define SQLITE_SOURCE_ID "2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9"
#define SQLITE_SCM_BRANCH "branch-3.53"
#define SQLITE_SCM_TAGS "release version-3.53.1"
#define SQLITE_SCM_DATETIME "2026-05-05T10:34:17.344Z"
/*
** CAPI3REF: Run-Time Library Version Numbers