sqlite3: Vendor import of sqlite3 3.40.1

Release notes at https://www.sqlite.org/releaselog/3_40_1.html.

Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3400100.tar.gz

Merge commit 'c728c97f5c838c9a873516c4499e4e1a41788ce7' into main
This commit is contained in:
Cy Schubert 2023-01-06 09:10:14 -08:00
commit 5ae830e9ba
6 changed files with 176 additions and 69 deletions

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for sqlite 3.40.0. # Generated by GNU Autoconf 2.71 for sqlite 3.40.1.
# #
# Report bugs to <http://www.sqlite.org>. # Report bugs to <http://www.sqlite.org>.
# #
@ -621,8 +621,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sqlite' PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite' PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.40.0' PACKAGE_VERSION='3.40.1'
PACKAGE_STRING='sqlite 3.40.0' PACKAGE_STRING='sqlite 3.40.1'
PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_BUGREPORT='http://www.sqlite.org'
PACKAGE_URL='' PACKAGE_URL=''
@ -1367,7 +1367,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sqlite 3.40.0 to adapt to many kinds of systems. \`configure' configures sqlite 3.40.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1438,7 +1438,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.40.0:";; short | recursive ) echo "Configuration of sqlite 3.40.1:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1563,7 +1563,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sqlite configure 3.40.0 sqlite configure 3.40.1
generated by GNU Autoconf 2.71 generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc. Copyright (C) 2021 Free Software Foundation, Inc.
@ -1833,7 +1833,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.40.0, which was It was created by sqlite $as_me 3.40.1, which was
generated by GNU Autoconf 2.71. Invocation command line was generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw $ $0$ac_configure_args_raw
@ -3106,7 +3106,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='sqlite' PACKAGE='sqlite'
VERSION='3.40.0' VERSION='3.40.1'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -15314,7 +15314,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sqlite $as_me 3.40.0, which was This file was extended by sqlite $as_me 3.40.1, which was
generated by GNU Autoconf 2.71. Invocation command line was generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -15373,7 +15373,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped' ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\ ac_cs_version="\\
sqlite config.status 3.40.0 sqlite config.status 3.40.1
configured by $0, generated by GNU Autoconf 2.71, configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -10,7 +10,7 @@
# #
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT(sqlite, 3.40.0, http://www.sqlite.org) AC_INIT(sqlite, 3.40.1, http://www.sqlite.org)
AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_SRCDIR([sqlite3.c])
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])

View File

@ -3930,7 +3930,7 @@ static unsigned re_next_char(ReInput *p){
c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f); c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
p->i += 2; p->i += 2;
if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd; if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
}else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80 }else if( (c&0xf8)==0xf0 && p->i+2<p->mx && (p->z[p->i]&0xc0)==0x80
&& (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){ && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6) c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
| (p->z[p->i+2]&0x3f); | (p->z[p->i+2]&0x3f);
@ -4457,15 +4457,15 @@ static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
** one or more matching characters, enter those matching characters into ** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input ** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole ** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match ** regex engine over the string. Do not worry about trying to match
** unicode characters beyond plane 0 - those are very rare and this is ** unicode characters beyond plane 0 - those are very rare and this is
** just an optimization. */ ** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){ if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){ for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i]; unsigned x = pRe->aArg[i];
if( x<=127 ){ if( x<=0x7f ){
pRe->zInit[j++] = (unsigned char)x; pRe->zInit[j++] = (unsigned char)x;
}else if( x<=0xfff ){ }else if( x<=0x7ff ){
pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6)); pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
pRe->zInit[j++] = 0x80 | (x&0x3f); pRe->zInit[j++] = 0x80 | (x&0x3f);
}else if( x<=0xffff ){ }else if( x<=0xffff ){
@ -14629,6 +14629,7 @@ static void recoverFinalCleanup(sqlite3_recover *p){
p->pTblList = 0; p->pTblList = 0;
sqlite3_finalize(p->pGetPage); sqlite3_finalize(p->pGetPage);
p->pGetPage = 0; p->pGetPage = 0;
sqlite3_file_control(p->dbIn, p->zDb, SQLITE_FCNTL_RESET_CACHE, 0);
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -14927,6 +14928,7 @@ static int recoverVfsRead(sqlite3_file *pFd, void *aBuf, int nByte, i64 iOff){
** **
** + first freelist page (32-bits at offset 32) ** + first freelist page (32-bits at offset 32)
** + size of freelist (32-bits at offset 36) ** + size of freelist (32-bits at offset 36)
** + the wal-mode flags (16-bits at offset 18)
** **
** We also try to preserve the auto-vacuum, incr-value, user-version ** We also try to preserve the auto-vacuum, incr-value, user-version
** and application-id fields - all 32 bit quantities at offsets ** and application-id fields - all 32 bit quantities at offsets
@ -14990,7 +14992,8 @@ static int recoverVfsRead(sqlite3_file *pFd, void *aBuf, int nByte, i64 iOff){
if( p->pPage1Cache ){ if( p->pPage1Cache ){
p->pPage1Disk = &p->pPage1Cache[nByte]; p->pPage1Disk = &p->pPage1Cache[nByte];
memcpy(p->pPage1Disk, aBuf, nByte); memcpy(p->pPage1Disk, aBuf, nByte);
aHdr[18] = a[18];
aHdr[19] = a[19];
recoverPutU32(&aHdr[28], dbsz); recoverPutU32(&aHdr[28], dbsz);
recoverPutU32(&aHdr[56], enc); recoverPutU32(&aHdr[56], enc);
recoverPutU16(&aHdr[105], pgsz-nReserve); recoverPutU16(&aHdr[105], pgsz-nReserve);
@ -15186,6 +15189,7 @@ static void recoverStep(sqlite3_recover *p){
recoverOpenOutput(p); recoverOpenOutput(p);
/* Open transactions on both the input and output databases. */ /* Open transactions on both the input and output databases. */
sqlite3_file_control(p->dbIn, p->zDb, SQLITE_FCNTL_RESET_CACHE, 0);
recoverExec(p, p->dbIn, "PRAGMA writable_schema = on"); recoverExec(p, p->dbIn, "PRAGMA writable_schema = on");
recoverExec(p, p->dbIn, "BEGIN"); recoverExec(p, p->dbIn, "BEGIN");
if( p->errCode==SQLITE_OK ) p->bCloseTransaction = 1; if( p->errCode==SQLITE_OK ) p->bCloseTransaction = 1;
@ -16275,7 +16279,7 @@ static int safeModeAuth(
"zipfile", "zipfile",
"zipfile_cds", "zipfile_cds",
}; };
UNUSED_PARAMETER(zA2); UNUSED_PARAMETER(zA1);
UNUSED_PARAMETER(zA3); UNUSED_PARAMETER(zA3);
UNUSED_PARAMETER(zA4); UNUSED_PARAMETER(zA4);
switch( op ){ switch( op ){
@ -16290,7 +16294,7 @@ static int safeModeAuth(
case SQLITE_FUNCTION: { case SQLITE_FUNCTION: {
int i; int i;
for(i=0; i<ArraySize(azProhibitedFunctions); i++){ for(i=0; i<ArraySize(azProhibitedFunctions); i++){
if( sqlite3_stricmp(zA1, azProhibitedFunctions[i])==0 ){ if( sqlite3_stricmp(zA2, azProhibitedFunctions[i])==0 ){
failIfSafeMode(p, "cannot use the %s() function in safe mode", failIfSafeMode(p, "cannot use the %s() function in safe mode",
azProhibitedFunctions[i]); azProhibitedFunctions[i]);
} }
@ -26132,7 +26136,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
if( pVfs ){ if( pVfs ){
sqlite3_vfs_register(pVfs, 1); sqlite3_vfs_register(pVfs, 1);
}else{ }else{
utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]); utf8_printf(stderr, "no such VFS: \"%s\"\n", zVfs);
exit(1); exit(1);
} }
} }

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.40.0. By combining all the individual C code files into this ** version 3.40.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
@ -452,9 +452,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.40.0" #define SQLITE_VERSION "3.40.1"
#define SQLITE_VERSION_NUMBER 3040000 #define SQLITE_VERSION_NUMBER 3040001
#define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318" #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -1498,6 +1498,12 @@ struct sqlite3_io_methods {
** **
** <li>[[SQLITE_FCNTL_CKSM_FILE]] ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
** Used by the cksmvfs VFS module only. ** Used by the cksmvfs VFS module only.
**
** <li>[[SQLITE_FCNTL_RESET_CACHE]]
** If there is currently no transaction open on the database, and the
** database is not a temp db, then this file-control purges the contents
** of the in-memory page cache. If there is an open transaction, or if
** the db is a temp-db, it is a no-op, not an error.
** </ul> ** </ul>
*/ */
#define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_FCNTL_LOCKSTATE 1
@ -1540,6 +1546,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_CKPT_START 39 #define SQLITE_FCNTL_CKPT_START 39
#define SQLITE_FCNTL_EXTERNAL_READER 40 #define SQLITE_FCNTL_EXTERNAL_READER 40
#define SQLITE_FCNTL_CKSM_FILE 41 #define SQLITE_FCNTL_CKSM_FILE 41
#define SQLITE_FCNTL_RESET_CACHE 42
/* deprecated names */ /* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@ -15714,6 +15721,8 @@ SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64); SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);
SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree*);
/* /*
** If we are not using shared cache, then there is no need to ** If we are not using shared cache, then there is no need to
** use mutexes to access the BtShared structures. So make the ** use mutexes to access the BtShared structures. So make the
@ -27290,9 +27299,13 @@ static int memsys5Roundup(int n){
if( n<=mem5.szAtom ) return mem5.szAtom; if( n<=mem5.szAtom ) return mem5.szAtom;
return mem5.szAtom*2; return mem5.szAtom*2;
} }
if( n>0x40000000 ) return 0; if( n>0x10000000 ){
if( n>0x40000000 ) return 0;
if( n>0x20000000 ) return 0x40000000;
return 0x20000000;
}
for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4); for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4);
if( (iFullSz/2)>=n ) return iFullSz/2; if( (iFullSz/2)>=(i64)n ) return iFullSz/2;
return iFullSz; return iFullSz;
} }
@ -37338,6 +37351,9 @@ static int robust_open(const char *z, int f, mode_t m){
break; break;
} }
if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break; if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;
if( (f & (O_EXCL|O_CREAT))==(O_EXCL|O_CREAT) ){
(void)osUnlink(z);
}
osClose(fd); osClose(fd);
sqlite3_log(SQLITE_WARNING, sqlite3_log(SQLITE_WARNING,
"attempt to open \"%s\" as file descriptor %d", z, fd); "attempt to open \"%s\" as file descriptor %d", z, fd);
@ -51071,6 +51087,7 @@ static int memdbTruncate(sqlite3_file*, sqlite3_int64 size);
static int memdbSync(sqlite3_file*, int flags); static int memdbSync(sqlite3_file*, int flags);
static int memdbFileSize(sqlite3_file*, sqlite3_int64 *pSize); static int memdbFileSize(sqlite3_file*, sqlite3_int64 *pSize);
static int memdbLock(sqlite3_file*, int); static int memdbLock(sqlite3_file*, int);
static int memdbUnlock(sqlite3_file*, int);
/* static int memdbCheckReservedLock(sqlite3_file*, int *pResOut);// not used */ /* static int memdbCheckReservedLock(sqlite3_file*, int *pResOut);// not used */
static int memdbFileControl(sqlite3_file*, int op, void *pArg); static int memdbFileControl(sqlite3_file*, int op, void *pArg);
/* static int memdbSectorSize(sqlite3_file*); // not used */ /* static int memdbSectorSize(sqlite3_file*); // not used */
@ -51129,7 +51146,7 @@ static const sqlite3_io_methods memdb_io_methods = {
memdbSync, /* xSync */ memdbSync, /* xSync */
memdbFileSize, /* xFileSize */ memdbFileSize, /* xFileSize */
memdbLock, /* xLock */ memdbLock, /* xLock */
memdbLock, /* xUnlock - same as xLock in this case */ memdbUnlock, /* xUnlock */
0, /* memdbCheckReservedLock, */ /* xCheckReservedLock */ 0, /* memdbCheckReservedLock, */ /* xCheckReservedLock */
memdbFileControl, /* xFileControl */ memdbFileControl, /* xFileControl */
0, /* memdbSectorSize,*/ /* xSectorSize */ 0, /* memdbSectorSize,*/ /* xSectorSize */
@ -51330,41 +51347,83 @@ static int memdbLock(sqlite3_file *pFile, int eLock){
MemFile *pThis = (MemFile*)pFile; MemFile *pThis = (MemFile*)pFile;
MemStore *p = pThis->pStore; MemStore *p = pThis->pStore;
int rc = SQLITE_OK; int rc = SQLITE_OK;
if( eLock==pThis->eLock ) return SQLITE_OK; if( eLock<=pThis->eLock ) return SQLITE_OK;
memdbEnter(p); memdbEnter(p);
if( eLock>SQLITE_LOCK_SHARED ){
if( p->mFlags & SQLITE_DESERIALIZE_READONLY ){ assert( p->nWrLock==0 || p->nWrLock==1 );
rc = SQLITE_READONLY; assert( pThis->eLock<=SQLITE_LOCK_SHARED || p->nWrLock==1 );
}else if( pThis->eLock<=SQLITE_LOCK_SHARED ){ assert( pThis->eLock==SQLITE_LOCK_NONE || p->nRdLock>=1 );
if( p->nWrLock ){
rc = SQLITE_BUSY; if( eLock>SQLITE_LOCK_SHARED && (p->mFlags & SQLITE_DESERIALIZE_READONLY) ){
}else{ rc = SQLITE_READONLY;
p->nWrLock = 1; }else{
switch( eLock ){
case SQLITE_LOCK_SHARED: {
assert( pThis->eLock==SQLITE_LOCK_NONE );
if( p->nWrLock>0 ){
rc = SQLITE_BUSY;
}else{
p->nRdLock++;
}
break;
};
case SQLITE_LOCK_RESERVED:
case SQLITE_LOCK_PENDING: {
assert( pThis->eLock>=SQLITE_LOCK_SHARED );
if( ALWAYS(pThis->eLock==SQLITE_LOCK_SHARED) ){
if( p->nWrLock>0 ){
rc = SQLITE_BUSY;
}else{
p->nWrLock = 1;
}
}
break;
}
default: {
assert( eLock==SQLITE_LOCK_EXCLUSIVE );
assert( pThis->eLock>=SQLITE_LOCK_SHARED );
if( p->nRdLock>1 ){
rc = SQLITE_BUSY;
}else if( pThis->eLock==SQLITE_LOCK_SHARED ){
p->nWrLock = 1;
}
break;
} }
} }
}else if( eLock==SQLITE_LOCK_SHARED ){
if( pThis->eLock > SQLITE_LOCK_SHARED ){
assert( p->nWrLock==1 );
p->nWrLock = 0;
}else if( p->nWrLock ){
rc = SQLITE_BUSY;
}else{
p->nRdLock++;
}
}else{
assert( eLock==SQLITE_LOCK_NONE );
if( pThis->eLock>SQLITE_LOCK_SHARED ){
assert( p->nWrLock==1 );
p->nWrLock = 0;
}
assert( p->nRdLock>0 );
p->nRdLock--;
} }
if( rc==SQLITE_OK ) pThis->eLock = eLock; if( rc==SQLITE_OK ) pThis->eLock = eLock;
memdbLeave(p); memdbLeave(p);
return rc; return rc;
} }
/*
** Unlock an memdb-file.
*/
static int memdbUnlock(sqlite3_file *pFile, int eLock){
MemFile *pThis = (MemFile*)pFile;
MemStore *p = pThis->pStore;
if( eLock>=pThis->eLock ) return SQLITE_OK;
memdbEnter(p);
assert( eLock==SQLITE_LOCK_SHARED || eLock==SQLITE_LOCK_NONE );
if( eLock==SQLITE_LOCK_SHARED ){
if( ALWAYS(pThis->eLock>SQLITE_LOCK_SHARED) ){
p->nWrLock--;
}
}else{
if( pThis->eLock>SQLITE_LOCK_SHARED ){
p->nWrLock--;
}
p->nRdLock--;
}
pThis->eLock = eLock;
memdbLeave(p);
return SQLITE_OK;
}
#if 0 #if 0
/* /*
** This interface is only used for crash recovery, which does not ** This interface is only used for crash recovery, which does not
@ -51472,7 +51531,7 @@ static int memdbOpen(
memset(pFile, 0, sizeof(*pFile)); memset(pFile, 0, sizeof(*pFile));
szName = sqlite3Strlen30(zName); szName = sqlite3Strlen30(zName);
if( szName>1 && zName[0]=='/' ){ if( szName>1 && (zName[0]=='/' || zName[0]=='\\') ){
int i; int i;
#ifndef SQLITE_MUTEX_OMIT #ifndef SQLITE_MUTEX_OMIT
sqlite3_mutex *pVfsMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1); sqlite3_mutex *pVfsMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
@ -51819,6 +51878,13 @@ SQLITE_API int sqlite3_deserialize(
return rc; return rc;
} }
/*
** Return true if the VFS is the memvfs.
*/
SQLITE_PRIVATE int sqlite3IsMemdb(const sqlite3_vfs *pVfs){
return pVfs==&memdb_vfs;
}
/* /*
** This routine is called when the extension is loaded. ** This routine is called when the extension is loaded.
** Register the new VFS. ** Register the new VFS.
@ -79147,6 +79213,17 @@ SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
*/ */
SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); } SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }
/*
** If no transaction is active and the database is not a temp-db, clear
** the in-memory pager cache.
*/
SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree *p){
BtShared *pBt = p->pBt;
if( pBt->inTransaction==TRANS_NONE ){
sqlite3PagerClearCache(pBt->pPager);
}
}
#if !defined(SQLITE_OMIT_SHARED_CACHE) #if !defined(SQLITE_OMIT_SHARED_CACHE)
/* /*
** Return true if the Btree passed as the only argument is sharable. ** Return true if the Btree passed as the only argument is sharable.
@ -83386,7 +83463,7 @@ SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){
if( p->db->mallocFailed ){ if( p->db->mallocFailed ){
freeP4(p->db, n, pP4); freeP4(p->db, n, pP4);
}else{ }else{
assert( pP4!=0 ); assert( pP4!=0 || n==P4_DYNAMIC );
assert( p->nOp>0 ); assert( p->nOp>0 );
pOp = &p->aOp[p->nOp-1]; pOp = &p->aOp[p->nOp-1];
assert( pOp->p4type==P4_NOTUSED ); assert( pOp->p4type==P4_NOTUSED );
@ -132298,7 +132375,7 @@ static const sqlite3_api_routines sqlite3Apis = {
#endif #endif
sqlite3_db_name, sqlite3_db_name,
/* Version 3.40.0 and later */ /* Version 3.40.0 and later */
sqlite3_value_type sqlite3_value_encoding
}; };
/* True if x is the directory separator character /* True if x is the directory separator character
@ -145439,7 +145516,7 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
if( pTrig->pTabSchema==pTab->pSchema if( pTrig->pTabSchema==pTab->pSchema
&& pTrig->table && pTrig->table
&& 0==sqlite3StrICmp(pTrig->table, pTab->zName) && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
&& pTrig->pTabSchema!=pTmpSchema && (pTrig->pTabSchema!=pTmpSchema || pTrig->bReturning)
){ ){
pTrig->pNext = pList; pTrig->pNext = pList;
pList = pTrig; pList = pTrig;
@ -155623,7 +155700,7 @@ SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo *pWInfo){
** block sorting is required. ** block sorting is required.
*/ */
SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){
return pWInfo->nOBSat; return pWInfo->nOBSat<0 ? 0 : pWInfo->nOBSat;
} }
/* /*
@ -174531,7 +174608,7 @@ SQLITE_API int sqlite3_overload_function(
rc = sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)!=0; rc = sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)!=0;
sqlite3_mutex_leave(db->mutex); sqlite3_mutex_leave(db->mutex);
if( rc ) return SQLITE_OK; if( rc ) return SQLITE_OK;
zCopy = sqlite3_mprintf(zName); zCopy = sqlite3_mprintf("%s", zName);
if( zCopy==0 ) return SQLITE_NOMEM; if( zCopy==0 ) return SQLITE_NOMEM;
return sqlite3_create_function_v2(db, zName, nArg, SQLITE_UTF8, return sqlite3_create_function_v2(db, zName, nArg, SQLITE_UTF8,
zCopy, sqlite3InvalidFunction, 0, 0, sqlite3_free); zCopy, sqlite3InvalidFunction, 0, 0, sqlite3_free);
@ -176363,6 +176440,9 @@ SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, vo
sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0); sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
} }
rc = SQLITE_OK; rc = SQLITE_OK;
}else if( op==SQLITE_FCNTL_RESET_CACHE ){
sqlite3BtreeClearCache(pBtree);
rc = SQLITE_OK;
}else{ }else{
int nSave = db->busyHandler.nBusy; int nSave = db->busyHandler.nBusy;
rc = sqlite3OsFileControl(fd, op, pArg); rc = sqlite3OsFileControl(fd, op, pArg);
@ -217778,6 +217858,22 @@ static int sessionChangesetNextOne(
if( p->op==SQLITE_INSERT ) p->op = SQLITE_DELETE; if( p->op==SQLITE_INSERT ) p->op = SQLITE_DELETE;
else if( p->op==SQLITE_DELETE ) p->op = SQLITE_INSERT; else if( p->op==SQLITE_DELETE ) p->op = SQLITE_INSERT;
} }
/* If this is an UPDATE that is part of a changeset, then check that
** there are no fields in the old.* record that are not (a) PK fields,
** or (b) also present in the new.* record.
**
** Such records are technically corrupt, but the rebaser was at one
** point generating them. Under most circumstances this is benign, but
** can cause spurious SQLITE_RANGE errors when applying the changeset. */
if( p->bPatchset==0 && p->op==SQLITE_UPDATE){
for(i=0; i<p->nCol; i++){
if( p->abPK[i]==0 && p->apValue[i+p->nCol]==0 ){
sqlite3ValueFree(p->apValue[i]);
p->apValue[i] = 0;
}
}
}
} }
return SQLITE_ROW; return SQLITE_ROW;
@ -219974,7 +220070,7 @@ static void sessionAppendPartialUpdate(
if( !pIter->abPK[i] && a1[0] ) bData = 1; if( !pIter->abPK[i] && a1[0] ) bData = 1;
memcpy(pOut, a1, n1); memcpy(pOut, a1, n1);
pOut += n1; pOut += n1;
}else if( a2[0]!=0xFF ){ }else if( a2[0]!=0xFF && a1[0] ){
bData = 1; bData = 1;
memcpy(pOut, a2, n2); memcpy(pOut, a2, n2);
pOut += n2; pOut += n2;
@ -236004,7 +236100,7 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
break; break;
case FTS5_SYNC: case FTS5_SYNC:
assert( p->ts.eState==1 ); assert( p->ts.eState==1 || p->ts.eState==2 );
p->ts.eState = 2; p->ts.eState = 2;
break; break;
@ -236019,21 +236115,21 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
break; break;
case FTS5_SAVEPOINT: case FTS5_SAVEPOINT:
assert( p->ts.eState==1 ); assert( p->ts.eState>=1 );
assert( iSavepoint>=0 ); assert( iSavepoint>=0 );
assert( iSavepoint>=p->ts.iSavepoint ); assert( iSavepoint>=p->ts.iSavepoint );
p->ts.iSavepoint = iSavepoint; p->ts.iSavepoint = iSavepoint;
break; break;
case FTS5_RELEASE: case FTS5_RELEASE:
assert( p->ts.eState==1 ); assert( p->ts.eState>=1 );
assert( iSavepoint>=0 ); assert( iSavepoint>=0 );
assert( iSavepoint<=p->ts.iSavepoint ); assert( iSavepoint<=p->ts.iSavepoint );
p->ts.iSavepoint = iSavepoint-1; p->ts.iSavepoint = iSavepoint-1;
break; break;
case FTS5_ROLLBACKTO: case FTS5_ROLLBACKTO:
assert( p->ts.eState==1 ); assert( p->ts.eState>=1 );
assert( iSavepoint>=-1 ); assert( iSavepoint>=-1 );
/* The following assert() can fail if another vtab strikes an error /* The following assert() can fail if another vtab strikes an error
** within an xSavepoint() call then SQLite calls xRollbackTo() - without ** within an xSavepoint() call then SQLite calls xRollbackTo() - without
@ -237369,7 +237465,7 @@ static int fts5UpdateMethod(
int rc = SQLITE_OK; /* Return code */ int rc = SQLITE_OK; /* Return code */
/* A transaction must be open when this is called. */ /* A transaction must be open when this is called. */
assert( pTab->ts.eState==1 ); assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
assert( pVtab->zErrMsg==0 ); assert( pVtab->zErrMsg==0 );
assert( nArg==1 || nArg==(2+pConfig->nCol+2) ); assert( nArg==1 || nArg==(2+pConfig->nCol+2) );
@ -238537,7 +238633,7 @@ static void fts5SourceIdFunc(
){ ){
assert( nArg==0 ); assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused); UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318", -1, SQLITE_TRANSIENT); sqlite3_result_text(pCtx, "fts5: 2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24", -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.40.0" #define SQLITE_VERSION "3.40.1"
#define SQLITE_VERSION_NUMBER 3040000 #define SQLITE_VERSION_NUMBER 3040001
#define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318" #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -1192,6 +1192,12 @@ struct sqlite3_io_methods {
** **
** <li>[[SQLITE_FCNTL_CKSM_FILE]] ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
** Used by the cksmvfs VFS module only. ** Used by the cksmvfs VFS module only.
**
** <li>[[SQLITE_FCNTL_RESET_CACHE]]
** If there is currently no transaction open on the database, and the
** database is not a temp db, then this file-control purges the contents
** of the in-memory page cache. If there is an open transaction, or if
** the db is a temp-db, it is a no-op, not an error.
** </ul> ** </ul>
*/ */
#define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_FCNTL_LOCKSTATE 1
@ -1234,6 +1240,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_CKPT_START 39 #define SQLITE_FCNTL_CKPT_START 39
#define SQLITE_FCNTL_EXTERNAL_READER 40 #define SQLITE_FCNTL_EXTERNAL_READER 40
#define SQLITE_FCNTL_CKSM_FILE 41 #define SQLITE_FCNTL_CKSM_FILE 41
#define SQLITE_FCNTL_RESET_CACHE 42
/* deprecated names */ /* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE

View File

@ -1,3 +1,3 @@
#ifndef SQLITE_RESOURCE_VERSION #ifndef SQLITE_RESOURCE_VERSION
#define SQLITE_RESOURCE_VERSION 3,40,0 #define SQLITE_RESOURCE_VERSION 3,40,1
#endif #endif