Fossil SCM

Update the built-in SQLite to the latest 3.42.0 beta for testing.

drh 2023-05-05 14:40 trunk
Commit 71ed8cbd0c198d95fbf21894fe952636ea9725199d854998a77420ebb6ecdd71
3 files changed +32 -10 +161 -74 +29 -22
+32 -10
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -1010,10 +1010,11 @@
10101010
#if SHELL_USE_LOCAL_GETLINE
10111011
printf("%s", zPrompt);
10121012
fflush(stdout);
10131013
do{
10141014
zResult = local_getline(zPrior, stdin);
1015
+ zPrior = 0;
10151016
/* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
10161017
if( zResult==0 ) sqlite3_sleep(50);
10171018
}while( zResult==0 && seenInterrupt>0 );
10181019
#else
10191020
free(zPrior);
@@ -1161,10 +1162,11 @@
11611162
**
11621163
** Return '"' if quoting is required. Return 0 if no quoting is required.
11631164
*/
11641165
static char quoteChar(const char *zName){
11651166
int i;
1167
+ if( zName==0 ) return '"';
11661168
if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
11671169
for(i=0; zName[i]; i++){
11681170
if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
11691171
}
11701172
return sqlite3_keyword_check(zName, i) ? '"' : 0;
@@ -9493,13 +9495,23 @@
94939495
** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
94949496
** linked list. Remove it from the list and free the object.
94959497
*/
94969498
static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
94979499
if( pOld ){
9498
- ZipfileEntry **pp;
9499
- for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
9500
- *pp = (*pp)->pNext;
9500
+ if( pTab->pFirstEntry==pOld ){
9501
+ pTab->pFirstEntry = pOld->pNext;
9502
+ if( pTab->pLastEntry==pOld ) pTab->pLastEntry = 0;
9503
+ }else{
9504
+ ZipfileEntry *p;
9505
+ for(p=pTab->pFirstEntry; p; p=p->pNext){
9506
+ if( p->pNext==pOld ){
9507
+ p->pNext = pOld->pNext;
9508
+ if( pTab->pLastEntry==pOld ) pTab->pLastEntry = p;
9509
+ break;
9510
+ }
9511
+ }
9512
+ }
95019513
zipfileEntryFree(pOld);
95029514
}
95039515
}
95049516
95059517
/*
@@ -20873,10 +20885,11 @@
2087320885
** \s -> space
2087420886
** \" -> "
2087520887
** \' -> '
2087620888
** \\ -> backslash
2087720889
** \NNN -> ascii character NNN in octal
20890
+** \xHH -> ascii character HH in hexadecimal
2087820891
*/
2087920892
static void resolve_backslashes(char *z){
2088020893
int i, j;
2088120894
char c;
2088220895
while( *z && *z!='\\' ) z++;
@@ -20901,10 +20914,19 @@
2090120914
c = '"';
2090220915
}else if( c=='\'' ){
2090320916
c = '\'';
2090420917
}else if( c=='\\' ){
2090520918
c = '\\';
20919
+ }else if( c=='x' ){
20920
+ int nhd = 0, hdv;
20921
+ u8 hv = 0;
20922
+ while( nhd<2 && (c=z[i+1+nhd])!=0 && (hdv=hexDigitValue(c))>=0 ){
20923
+ hv = (u8)((hv<<4)|hdv);
20924
+ ++nhd;
20925
+ }
20926
+ i += nhd;
20927
+ c = (u8)hv;
2090620928
}else if( c>='0' && c<='7' ){
2090720929
c -= '0';
2090820930
if( z[i+1]>='0' && z[i+1]<='7' ){
2090920931
i++;
2091020932
c = (c<<3) + z[i] - '0';
@@ -21108,12 +21130,12 @@
2110821130
** EOF on end-of-file.
2110921131
** + Report syntax errors on stderr
2111021132
*/
2111121133
static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
2111221134
int c;
21113
- int cSep = p->cColSep;
21114
- int rSep = p->cRowSep;
21135
+ int cSep = (u8)p->cColSep;
21136
+ int rSep = (u8)p->cRowSep;
2111521137
p->n = 0;
2111621138
c = fgetc(p->in);
2111721139
if( c==EOF || seenInterrupt ){
2111821140
p->cTerm = EOF;
2111921141
return 0;
@@ -21198,12 +21220,12 @@
2119821220
** EOF on end-of-file.
2119921221
** + Report syntax errors on stderr
2120021222
*/
2120121223
static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
2120221224
int c;
21203
- int cSep = p->cColSep;
21204
- int rSep = p->cRowSep;
21225
+ int cSep = (u8)p->cColSep;
21226
+ int rSep = (u8)p->cRowSep;
2120521227
p->n = 0;
2120621228
c = fgetc(p->in);
2120721229
if( c==EOF || seenInterrupt ){
2120821230
p->cTerm = EOF;
2120921231
return 0;
@@ -23148,11 +23170,11 @@
2314823170
rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
2314923171
rc_err_oom_die(rc);
2315023172
sqlite3_bind_int(pStmt, 1, nDigits);
2315123173
rc = sqlite3_step(pStmt);
2315223174
sqlite3_finalize(pStmt);
23153
- assert(rc==SQLITE_DONE);
23175
+ if( rc!=SQLITE_DONE ) rc_err_oom_die(SQLITE_NOMEM);
2315423176
}
2315523177
assert(db_int(*pDb, zHasDupes)==0); /* Consider: remove this */
2315623178
rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
2315723179
rc_err_oom_die(rc);
2315823180
rc = sqlite3_step(pStmt);
@@ -24080,12 +24102,12 @@
2408024102
if( nSep>1 ){
2408124103
raw_printf(stderr, "Error: multi-character row separators not allowed"
2408224104
" for import\n");
2408324105
goto meta_command_exit;
2408424106
}
24085
- sCtx.cColSep = p->colSeparator[0];
24086
- sCtx.cRowSep = p->rowSeparator[0];
24107
+ sCtx.cColSep = (u8)p->colSeparator[0];
24108
+ sCtx.cRowSep = (u8)p->rowSeparator[0];
2408724109
}
2408824110
sCtx.zFile = zFile;
2408924111
sCtx.nLine = 1;
2409024112
if( sCtx.zFile[0]=='|' ){
2409124113
#ifdef SQLITE_OMIT_POPEN
2409224114
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -1010,10 +1010,11 @@
1010 #if SHELL_USE_LOCAL_GETLINE
1011 printf("%s", zPrompt);
1012 fflush(stdout);
1013 do{
1014 zResult = local_getline(zPrior, stdin);
 
1015 /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
1016 if( zResult==0 ) sqlite3_sleep(50);
1017 }while( zResult==0 && seenInterrupt>0 );
1018 #else
1019 free(zPrior);
@@ -1161,10 +1162,11 @@
1161 **
1162 ** Return '"' if quoting is required. Return 0 if no quoting is required.
1163 */
1164 static char quoteChar(const char *zName){
1165 int i;
 
1166 if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
1167 for(i=0; zName[i]; i++){
1168 if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
1169 }
1170 return sqlite3_keyword_check(zName, i) ? '"' : 0;
@@ -9493,13 +9495,23 @@
9493 ** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
9494 ** linked list. Remove it from the list and free the object.
9495 */
9496 static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
9497 if( pOld ){
9498 ZipfileEntry **pp;
9499 for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
9500 *pp = (*pp)->pNext;
 
 
 
 
 
 
 
 
 
 
9501 zipfileEntryFree(pOld);
9502 }
9503 }
9504
9505 /*
@@ -20873,10 +20885,11 @@
20873 ** \s -> space
20874 ** \" -> "
20875 ** \' -> '
20876 ** \\ -> backslash
20877 ** \NNN -> ascii character NNN in octal
 
20878 */
20879 static void resolve_backslashes(char *z){
20880 int i, j;
20881 char c;
20882 while( *z && *z!='\\' ) z++;
@@ -20901,10 +20914,19 @@
20901 c = '"';
20902 }else if( c=='\'' ){
20903 c = '\'';
20904 }else if( c=='\\' ){
20905 c = '\\';
 
 
 
 
 
 
 
 
 
20906 }else if( c>='0' && c<='7' ){
20907 c -= '0';
20908 if( z[i+1]>='0' && z[i+1]<='7' ){
20909 i++;
20910 c = (c<<3) + z[i] - '0';
@@ -21108,12 +21130,12 @@
21108 ** EOF on end-of-file.
21109 ** + Report syntax errors on stderr
21110 */
21111 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
21112 int c;
21113 int cSep = p->cColSep;
21114 int rSep = p->cRowSep;
21115 p->n = 0;
21116 c = fgetc(p->in);
21117 if( c==EOF || seenInterrupt ){
21118 p->cTerm = EOF;
21119 return 0;
@@ -21198,12 +21220,12 @@
21198 ** EOF on end-of-file.
21199 ** + Report syntax errors on stderr
21200 */
21201 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
21202 int c;
21203 int cSep = p->cColSep;
21204 int rSep = p->cRowSep;
21205 p->n = 0;
21206 c = fgetc(p->in);
21207 if( c==EOF || seenInterrupt ){
21208 p->cTerm = EOF;
21209 return 0;
@@ -23148,11 +23170,11 @@
23148 rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
23149 rc_err_oom_die(rc);
23150 sqlite3_bind_int(pStmt, 1, nDigits);
23151 rc = sqlite3_step(pStmt);
23152 sqlite3_finalize(pStmt);
23153 assert(rc==SQLITE_DONE);
23154 }
23155 assert(db_int(*pDb, zHasDupes)==0); /* Consider: remove this */
23156 rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
23157 rc_err_oom_die(rc);
23158 rc = sqlite3_step(pStmt);
@@ -24080,12 +24102,12 @@
24080 if( nSep>1 ){
24081 raw_printf(stderr, "Error: multi-character row separators not allowed"
24082 " for import\n");
24083 goto meta_command_exit;
24084 }
24085 sCtx.cColSep = p->colSeparator[0];
24086 sCtx.cRowSep = p->rowSeparator[0];
24087 }
24088 sCtx.zFile = zFile;
24089 sCtx.nLine = 1;
24090 if( sCtx.zFile[0]=='|' ){
24091 #ifdef SQLITE_OMIT_POPEN
24092
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -1010,10 +1010,11 @@
1010 #if SHELL_USE_LOCAL_GETLINE
1011 printf("%s", zPrompt);
1012 fflush(stdout);
1013 do{
1014 zResult = local_getline(zPrior, stdin);
1015 zPrior = 0;
1016 /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
1017 if( zResult==0 ) sqlite3_sleep(50);
1018 }while( zResult==0 && seenInterrupt>0 );
1019 #else
1020 free(zPrior);
@@ -1161,10 +1162,11 @@
1162 **
1163 ** Return '"' if quoting is required. Return 0 if no quoting is required.
1164 */
1165 static char quoteChar(const char *zName){
1166 int i;
1167 if( zName==0 ) return '"';
1168 if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
1169 for(i=0; zName[i]; i++){
1170 if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
1171 }
1172 return sqlite3_keyword_check(zName, i) ? '"' : 0;
@@ -9493,13 +9495,23 @@
9495 ** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
9496 ** linked list. Remove it from the list and free the object.
9497 */
9498 static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
9499 if( pOld ){
9500 if( pTab->pFirstEntry==pOld ){
9501 pTab->pFirstEntry = pOld->pNext;
9502 if( pTab->pLastEntry==pOld ) pTab->pLastEntry = 0;
9503 }else{
9504 ZipfileEntry *p;
9505 for(p=pTab->pFirstEntry; p; p=p->pNext){
9506 if( p->pNext==pOld ){
9507 p->pNext = pOld->pNext;
9508 if( pTab->pLastEntry==pOld ) pTab->pLastEntry = p;
9509 break;
9510 }
9511 }
9512 }
9513 zipfileEntryFree(pOld);
9514 }
9515 }
9516
9517 /*
@@ -20873,10 +20885,11 @@
20885 ** \s -> space
20886 ** \" -> "
20887 ** \' -> '
20888 ** \\ -> backslash
20889 ** \NNN -> ascii character NNN in octal
20890 ** \xHH -> ascii character HH in hexadecimal
20891 */
20892 static void resolve_backslashes(char *z){
20893 int i, j;
20894 char c;
20895 while( *z && *z!='\\' ) z++;
@@ -20901,10 +20914,19 @@
20914 c = '"';
20915 }else if( c=='\'' ){
20916 c = '\'';
20917 }else if( c=='\\' ){
20918 c = '\\';
20919 }else if( c=='x' ){
20920 int nhd = 0, hdv;
20921 u8 hv = 0;
20922 while( nhd<2 && (c=z[i+1+nhd])!=0 && (hdv=hexDigitValue(c))>=0 ){
20923 hv = (u8)((hv<<4)|hdv);
20924 ++nhd;
20925 }
20926 i += nhd;
20927 c = (u8)hv;
20928 }else if( c>='0' && c<='7' ){
20929 c -= '0';
20930 if( z[i+1]>='0' && z[i+1]<='7' ){
20931 i++;
20932 c = (c<<3) + z[i] - '0';
@@ -21108,12 +21130,12 @@
21130 ** EOF on end-of-file.
21131 ** + Report syntax errors on stderr
21132 */
21133 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
21134 int c;
21135 int cSep = (u8)p->cColSep;
21136 int rSep = (u8)p->cRowSep;
21137 p->n = 0;
21138 c = fgetc(p->in);
21139 if( c==EOF || seenInterrupt ){
21140 p->cTerm = EOF;
21141 return 0;
@@ -21198,12 +21220,12 @@
21220 ** EOF on end-of-file.
21221 ** + Report syntax errors on stderr
21222 */
21223 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
21224 int c;
21225 int cSep = (u8)p->cColSep;
21226 int rSep = (u8)p->cRowSep;
21227 p->n = 0;
21228 c = fgetc(p->in);
21229 if( c==EOF || seenInterrupt ){
21230 p->cTerm = EOF;
21231 return 0;
@@ -23148,11 +23170,11 @@
23170 rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
23171 rc_err_oom_die(rc);
23172 sqlite3_bind_int(pStmt, 1, nDigits);
23173 rc = sqlite3_step(pStmt);
23174 sqlite3_finalize(pStmt);
23175 if( rc!=SQLITE_DONE ) rc_err_oom_die(SQLITE_NOMEM);
23176 }
23177 assert(db_int(*pDb, zHasDupes)==0); /* Consider: remove this */
23178 rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
23179 rc_err_oom_die(rc);
23180 rc = sqlite3_step(pStmt);
@@ -24080,12 +24102,12 @@
24102 if( nSep>1 ){
24103 raw_printf(stderr, "Error: multi-character row separators not allowed"
24104 " for import\n");
24105 goto meta_command_exit;
24106 }
24107 sCtx.cColSep = (u8)p->colSeparator[0];
24108 sCtx.cRowSep = (u8)p->rowSeparator[0];
24109 }
24110 sCtx.zFile = zFile;
24111 sCtx.nLine = 1;
24112 if( sCtx.zFile[0]=='|' ){
24113 #ifdef SQLITE_OMIT_POPEN
24114
+161 -74
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -456,11 +456,11 @@
456456
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
457457
** [sqlite_version()] and [sqlite_source_id()].
458458
*/
459459
#define SQLITE_VERSION "3.42.0"
460460
#define SQLITE_VERSION_NUMBER 3042000
461
-#define SQLITE_SOURCE_ID "2023-05-01 20:42:15 342af5b4fa0bd7c699e5497161db13d0cf795c7a5875ae30d666122e518f213b"
461
+#define SQLITE_SOURCE_ID "2023-05-05 14:16:31 fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315"
462462
463463
/*
464464
** CAPI3REF: Run-Time Library Version Numbers
465465
** KEYWORDS: sqlite3_version sqlite3_sourceid
466466
**
@@ -2450,32 +2450,32 @@
24502450
** configuration setting is never used, then the default maximum is determined
24512451
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
24522452
** compile-time option is not set, then the default maximum is 1073741824.
24532453
** </dl>
24542454
*/
2455
-#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2456
-#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2457
-#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2458
-#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2459
-#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2460
-#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2461
-#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2462
-#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2463
-#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2464
-#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2465
-#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2466
-/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2467
-#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2468
-#define SQLITE_CONFIG_PCACHE 14 /* no-op */
2469
-#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2470
-#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2471
-#define SQLITE_CONFIG_URI 17 /* int */
2472
-#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2473
-#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2455
+#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2456
+#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2457
+#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2458
+#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2459
+#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2460
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2461
+#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2462
+#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2463
+#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2464
+#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2465
+#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2466
+/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2467
+#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2468
+#define SQLITE_CONFIG_PCACHE 14 /* no-op */
2469
+#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2470
+#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2471
+#define SQLITE_CONFIG_URI 17 /* int */
2472
+#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2473
+#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
24742474
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2475
-#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2476
-#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2475
+#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2476
+#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
24772477
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
24782478
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
24792479
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
24802480
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
24812481
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -6563,10 +6563,17 @@
65636563
** ^SQLite implements this interface by calling the xSleep()
65646564
** method of the default [sqlite3_vfs] object. If the xSleep() method
65656565
** of the default VFS is not implemented correctly, or not implemented at
65666566
** all, then the behavior of sqlite3_sleep() may deviate from the description
65676567
** in the previous paragraphs.
6568
+**
6569
+** If a negative argument is passed to sqlite3_sleep() the results vary by
6570
+** VFS and operating system. Some system treat a negative argument as an
6571
+** instruction to sleep forever. Others understand it to mean do not sleep
6572
+** at all. ^In SQLite version 3.42.0 and later, a negative
6573
+** argument passed into sqlite3_sleep() is changed to zero before it is relayed
6574
+** down into the xSleep method of the VFS.
65686575
*/
65696576
SQLITE_API int sqlite3_sleep(int);
65706577
65716578
/*
65726579
** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -18293,10 +18300,11 @@
1829318300
unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
1829418301
unsigned bHasExpr:1; /* Index contains an expression, either a literal
1829518302
** expression, or a reference to a VIRTUAL column */
1829618303
#ifdef SQLITE_ENABLE_STAT4
1829718304
int nSample; /* Number of elements in aSample[] */
18305
+ int mxSample; /* Number of slots allocated to aSample[] */
1829818306
int nSampleCol; /* Size of IndexSample.anEq[] and so on */
1829918307
tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
1830018308
IndexSample *aSample; /* Samples of the left-most key */
1830118309
tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
1830218310
tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
@@ -23687,10 +23695,11 @@
2368723695
char validYMD; /* True (1) if Y,M,D are valid */
2368823696
char validHMS; /* True (1) if h,m,s are valid */
2368923697
char validTZ; /* True (1) if tz is valid */
2369023698
char tzSet; /* Timezone was set explicitly */
2369123699
char isError; /* An overflow has occurred */
23700
+ char useSubsec; /* Display subsecond precision */
2369223701
};
2369323702
2369423703
2369523704
/*
2369623705
** Convert zDate into one or more integers according to the conversion
@@ -24001,10 +24010,15 @@
2400124010
}else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
2400224011
return setDateTimeToCurrent(context, p);
2400324012
}else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
2400424013
setRawDateNumber(p, r);
2400524014
return 0;
24015
+ }else if( (sqlite3StrICmp(zDate,"subsec")==0
24016
+ || sqlite3StrICmp(zDate,"subsecond")==0)
24017
+ && sqlite3NotPureFunc(context) ){
24018
+ p->useSubsec = 1;
24019
+ return setDateTimeToCurrent(context, p);
2400624020
}
2400724021
return 1;
2400824022
}
2400924023
2401024024
/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
@@ -24415,12 +24429,26 @@
2441524429
/*
2441624430
** start of TTTTT
2441724431
**
2441824432
** Move the date backwards to the beginning of the current day,
2441924433
** or month or year.
24434
+ **
24435
+ ** subsecond
24436
+ ** subsec
24437
+ **
24438
+ ** Show subsecond precision in the output of datetime() and
24439
+ ** unixepoch() and strftime('%s').
2442024440
*/
24421
- if( sqlite3_strnicmp(z, "start of ", 9)!=0 ) break;
24441
+ if( sqlite3_strnicmp(z, "start of ", 9)!=0 ){
24442
+ if( sqlite3_stricmp(z, "subsec")==0
24443
+ || sqlite3_stricmp(z, "subsecond")==0
24444
+ ){
24445
+ p->useSubsec = 1;
24446
+ rc = 0;
24447
+ }
24448
+ break;
24449
+ }
2442224450
if( !p->validJD && !p->validYMD && !p->validHMS ) break;
2442324451
z += 9;
2442424452
computeYMD(p);
2442524453
p->validHMS = 1;
2442624454
p->h = p->m = 0;
@@ -24614,11 +24642,15 @@
2461424642
sqlite3_value **argv
2461524643
){
2461624644
DateTime x;
2461724645
if( isDate(context, argc, argv, &x)==0 ){
2461824646
computeJD(&x);
24619
- sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
24647
+ if( x.useSubsec ){
24648
+ sqlite3_result_double(context, (x.iJD - 21086676*(i64)10000000)/1000.0);
24649
+ }else{
24650
+ sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
24651
+ }
2462024652
}
2462124653
}
2462224654
2462324655
/*
2462424656
** datetime( TIMESTRING, MOD, MOD, ...)
@@ -24630,12 +24662,12 @@
2463024662
int argc,
2463124663
sqlite3_value **argv
2463224664
){
2463324665
DateTime x;
2463424666
if( isDate(context, argc, argv, &x)==0 ){
24635
- int Y, s;
24636
- char zBuf[24];
24667
+ int Y, s, n;
24668
+ char zBuf[32];
2463724669
computeYMD_HMS(&x);
2463824670
Y = x.Y;
2463924671
if( Y<0 ) Y = -Y;
2464024672
zBuf[1] = '0' + (Y/1000)%10;
2464124673
zBuf[2] = '0' + (Y/100)%10;
@@ -24652,19 +24684,32 @@
2465224684
zBuf[13] = '0' + (x.h)%10;
2465324685
zBuf[14] = ':';
2465424686
zBuf[15] = '0' + (x.m/10)%10;
2465524687
zBuf[16] = '0' + (x.m)%10;
2465624688
zBuf[17] = ':';
24657
- s = (int)x.s;
24658
- zBuf[18] = '0' + (s/10)%10;
24659
- zBuf[19] = '0' + (s)%10;
24660
- zBuf[20] = 0;
24689
+ if( x.useSubsec ){
24690
+ s = (int)1000.0*x.s;
24691
+ zBuf[18] = '0' + (s/10000)%10;
24692
+ zBuf[19] = '0' + (s/1000)%10;
24693
+ zBuf[20] = '.';
24694
+ zBuf[21] = '0' + (s/100)%10;
24695
+ zBuf[22] = '0' + (s/10)%10;
24696
+ zBuf[23] = '0' + (s)%10;
24697
+ zBuf[24] = 0;
24698
+ n = 24;
24699
+ }else{
24700
+ s = (int)x.s;
24701
+ zBuf[18] = '0' + (s/10)%10;
24702
+ zBuf[19] = '0' + (s)%10;
24703
+ zBuf[20] = 0;
24704
+ n = 20;
24705
+ }
2466124706
if( x.Y<0 ){
2466224707
zBuf[0] = '-';
24663
- sqlite3_result_text(context, zBuf, 20, SQLITE_TRANSIENT);
24708
+ sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
2466424709
}else{
24665
- sqlite3_result_text(context, &zBuf[1], 19, SQLITE_TRANSIENT);
24710
+ sqlite3_result_text(context, &zBuf[1], n-1, SQLITE_TRANSIENT);
2466624711
}
2466724712
}
2466824713
}
2466924714
2467024715
/*
@@ -24677,24 +24722,37 @@
2467724722
int argc,
2467824723
sqlite3_value **argv
2467924724
){
2468024725
DateTime x;
2468124726
if( isDate(context, argc, argv, &x)==0 ){
24682
- int s;
24727
+ int s, n;
2468324728
char zBuf[16];
2468424729
computeHMS(&x);
2468524730
zBuf[0] = '0' + (x.h/10)%10;
2468624731
zBuf[1] = '0' + (x.h)%10;
2468724732
zBuf[2] = ':';
2468824733
zBuf[3] = '0' + (x.m/10)%10;
2468924734
zBuf[4] = '0' + (x.m)%10;
2469024735
zBuf[5] = ':';
24691
- s = (int)x.s;
24692
- zBuf[6] = '0' + (s/10)%10;
24693
- zBuf[7] = '0' + (s)%10;
24694
- zBuf[8] = 0;
24695
- sqlite3_result_text(context, zBuf, 8, SQLITE_TRANSIENT);
24736
+ if( x.useSubsec ){
24737
+ s = (int)1000.0*x.s;
24738
+ zBuf[6] = '0' + (s/10000)%10;
24739
+ zBuf[7] = '0' + (s/1000)%10;
24740
+ zBuf[8] = '.';
24741
+ zBuf[9] = '0' + (s/100)%10;
24742
+ zBuf[10] = '0' + (s/10)%10;
24743
+ zBuf[11] = '0' + (s)%10;
24744
+ zBuf[12] = 0;
24745
+ n = 12;
24746
+ }else{
24747
+ s = (int)x.s;
24748
+ zBuf[6] = '0' + (s/10)%10;
24749
+ zBuf[7] = '0' + (s)%10;
24750
+ zBuf[8] = 0;
24751
+ n = 8;
24752
+ }
24753
+ sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
2469624754
}
2469724755
}
2469824756
2469924757
/*
2470024758
** date( TIMESTRING, MOD, MOD, ...)
@@ -24821,12 +24879,17 @@
2482124879
case 'M': {
2482224880
sqlite3_str_appendf(&sRes,"%02d",x.m);
2482324881
break;
2482424882
}
2482524883
case 's': {
24826
- i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
24827
- sqlite3_str_appendf(&sRes,"%lld",iS);
24884
+ if( x.useSubsec ){
24885
+ sqlite3_str_appendf(&sRes,"%.3f",
24886
+ (x.iJD - 21086676*(i64)10000000)/1000.0);
24887
+ }else{
24888
+ i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
24889
+ sqlite3_str_appendf(&sRes,"%lld",iS);
24890
+ }
2482824891
break;
2482924892
}
2483024893
case 'S': {
2483124894
sqlite3_str_appendf(&sRes,"%02d",(int)x.s);
2483224895
break;
@@ -30700,10 +30763,11 @@
3070030763
nsd = 16 + flag_altform2*10;
3070130764
bufpt = buf;
3070230765
{
3070330766
i64 szBufNeeded; /* Size of a temporary buffer needed */
3070430767
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30768
+ if( cThousand ) szBufNeeded += (e2+2)/3;
3070530769
if( szBufNeeded > etBUFSIZE ){
3070630770
bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
3070730771
if( bufpt==0 ) return;
3070830772
}
3070930773
}
@@ -30717,14 +30781,16 @@
3071730781
if( e2<0 ){
3071830782
*(bufpt++) = '0';
3071930783
}else if( msd>0 ){
3072030784
for(; e2>=0; e2--){
3072130785
*(bufpt++) = et_getdigit_int(&longvalue,&msd);
30786
+ if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
3072230787
}
3072330788
}else{
3072430789
for(; e2>=0; e2--){
3072530790
*(bufpt++) = et_getdigit(&realvalue,&nsd);
30791
+ if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
3072630792
}
3072730793
}
3072830794
/* The decimal point */
3072930795
if( flag_dp ){
3073030796
*(bufpt++) = '.';
@@ -67126,11 +67192,13 @@
6712667192
if( pWal->syncHeader ){
6712767193
rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
6712867194
if( rc ) return rc;
6712967195
}
6713067196
}
67131
- assert( (int)pWal->szPage==szPage );
67197
+ if( (int)pWal->szPage!=szPage ){
67198
+ return SQLITE_CORRUPT_BKPT; /* TH3 test case: cov1/corrupt155.test */
67199
+ }
6713267200
6713367201
/* Setup information needed to write frames into the WAL */
6713467202
w.pWal = pWal;
6713567203
w.pFd = pWal->pWalFd;
6713667204
w.iSyncPoint = 0;
@@ -67786,11 +67854,11 @@
6778667854
** Cell content makes use of variable length integers. A variable
6778767855
** length integer is 1 to 9 bytes where the lower 7 bits of each
6778867856
** byte are used. The integer consists of all bytes that have bit 8 set and
6778967857
** the first byte with bit 8 clear. The most significant byte of the integer
6779067858
** appears first. A variable-length integer may not be more than 9 bytes long.
67791
-** As a special case, all 8 bytes of the 9th byte are used as data. This
67859
+** As a special case, all 8 bits of the 9th byte are used as data. This
6779267860
** allows a 64-bit integer to be encoded in 9 bytes.
6779367861
**
6779467862
** 0x00 becomes 0x00000000
6779567863
** 0x7f becomes 0x0000007f
6779667864
** 0x81 0x00 becomes 0x00000080
@@ -116967,17 +117035,22 @@
116967117035
if( zIndex==0 ) continue;
116968117036
nSample = sqlite3_column_int(pStmt, 1);
116969117037
pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);
116970117038
assert( pIdx==0 || pIdx->nSample==0 );
116971117039
if( pIdx==0 ) continue;
117040
+ if( pIdx->aSample!=0 ){
117041
+ /* The same index appears in sqlite_stat4 under multiple names */
117042
+ continue;
117043
+ }
116972117044
assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 );
116973117045
if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
116974117046
nIdxCol = pIdx->nKeyCol;
116975117047
}else{
116976117048
nIdxCol = pIdx->nColumn;
116977117049
}
116978117050
pIdx->nSampleCol = nIdxCol;
117051
+ pIdx->mxSample = nSample;
116979117052
nByte = sizeof(IndexSample) * nSample;
116980117053
nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;
116981117054
nByte += nIdxCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */
116982117055
116983117056
pIdx->aSample = sqlite3DbMallocZero(db, nByte);
@@ -117013,10 +117086,15 @@
117013117086
117014117087
zIndex = (char *)sqlite3_column_text(pStmt, 0);
117015117088
if( zIndex==0 ) continue;
117016117089
pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);
117017117090
if( pIdx==0 ) continue;
117091
+ if( pIdx->nSample>=pIdx->mxSample ){
117092
+ /* Too many slots used because the same index appears in
117093
+ ** sqlite_stat4 using multiple names */
117094
+ continue;
117095
+ }
117018117096
/* This next condition is true if data has already been loaded from
117019117097
** the sqlite_stat4 table. */
117020117098
nCol = pIdx->nSampleCol;
117021117099
if( pIdx!=pPrevIdx ){
117022117100
initAvgEq(pPrevIdx);
@@ -117056,11 +117134,12 @@
117056117134
static int loadStat4(sqlite3 *db, const char *zDb){
117057117135
int rc = SQLITE_OK; /* Result codes from subroutines */
117058117136
const Table *pStat4;
117059117137
117060117138
assert( db->lookaside.bDisable );
117061
- if( (pStat4 = sqlite3FindTable(db, "sqlite_stat4", zDb))!=0
117139
+ if( OptimizationEnabled(db, SQLITE_Stat4)
117140
+ && (pStat4 = sqlite3FindTable(db, "sqlite_stat4", zDb))!=0
117062117141
&& IsOrdinaryTable(pStat4)
117063117142
){
117064117143
rc = loadStatTbl(db,
117065117144
"SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase",
117066117145
"SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4",
@@ -118904,11 +118983,11 @@
118904118983
}
118905118984
118906118985
if( IsOrdinaryTable(pTable) ){
118907118986
sqlite3FkDelete(db, pTable);
118908118987
}
118909
-#ifndef SQLITE_OMIT_VIRTUAL_TABLE
118988
+#ifndef SQLITE_OMIT_VIRTUALTABLE
118910118989
else if( IsVirtual(pTable) ){
118911118990
sqlite3VtabClear(db, pTable);
118912118991
}
118913118992
#endif
118914118993
else{
@@ -126832,11 +126911,11 @@
126832126911
126833126912
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
126834126913
/*
126835126914
** The "unknown" function is automatically substituted in place of
126836126915
** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN
126837
-** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used.
126916
+** when the SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION compile-time option is used.
126838126917
** When the "sqlite3" command-line shell is built using this functionality,
126839126918
** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries
126840126919
** involving application-defined functions to be examined in a generic
126841126920
** sqlite3 shell.
126842126921
*/
@@ -139592,11 +139671,11 @@
139592139671
** by a prior OP_MakeRecord. In this case nData==1 and regData
139593139672
** will be completely unrelated to regOrigData.
139594139673
** (2) All output columns are included in the sort record. In that
139595139674
** case regData==regOrigData.
139596139675
** (3) Some output columns are omitted from the sort record due to
139597
- ** the SQLITE_ENABLE_SORTER_REFERENCE optimization, or due to the
139676
+ ** the SQLITE_ENABLE_SORTER_REFERENCES optimization, or due to the
139598139677
** SQLITE_ECEL_OMITREF optimization, or due to the
139599139678
** SortCtx.pDeferredRowLoad optimiation. In any of these cases
139600139679
** regOrigData is 0 to prevent this routine from trying to copy
139601139680
** values that might not yet exist.
139602139681
*/
@@ -152059,11 +152138,14 @@
152059152138
default:
152060152139
xMethod = pMod->xRelease;
152061152140
break;
152062152141
}
152063152142
if( xMethod && pVTab->iSavepoint>iSavepoint ){
152143
+ u64 savedFlags = (db->flags & SQLITE_Defensive);
152144
+ db->flags &= ~(u64)SQLITE_Defensive;
152064152145
rc = xMethod(pVTab->pVtab, iSavepoint);
152146
+ db->flags |= savedFlags;
152065152147
}
152066152148
sqlite3VtabUnlock(pVTab);
152067152149
}
152068152150
}
152069152151
}
@@ -153984,10 +154066,13 @@
153984154066
rc = WRC_Prune;
153985154067
reg = ++pWalker->pParse->nMem; /* Register for column value */
153986154068
reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153987154069
pExpr->op = TK_REGISTER;
153988154070
pExpr->iTable = reg;
154071
+ }else if( pExpr->op==TK_TRUEFALSE ){
154072
+ /* Do not walk disabled expressions. tag-20230504-1 */
154073
+ return WRC_Prune;
153989154074
}
153990154075
return rc;
153991154076
}
153992154077
153993154078
/*
@@ -156951,11 +157036,11 @@
156951157036
if( op==TK_ISNULL
156952157037
&& !ExprHasProperty(pExpr,EP_OuterON)
156953157038
&& 0==sqlite3ExprCanBeNull(pLeft)
156954157039
){
156955157040
assert( !ExprHasProperty(pExpr, EP_IntValue) );
156956
- pExpr->op = TK_TRUEFALSE;
157041
+ pExpr->op = TK_TRUEFALSE; /* See tag-20230504-1 */
156957157042
pExpr->u.zToken = "false";
156958157043
ExprSetProperty(pExpr, EP_IsFalse);
156959157044
pTerm->prereqAll = 0;
156960157045
pTerm->eOperator = 0;
156961157046
}
@@ -178633,11 +178718,11 @@
178633178718
if( pVfs==0 ) return 0;
178634178719
178635178720
/* This function works in milliseconds, but the underlying OsSleep()
178636178721
** API uses microseconds. Hence the 1000's.
178637178722
*/
178638
- rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);
178723
+ rc = (sqlite3OsSleep(pVfs, ms<0 ? 0 : 1000*ms)/1000);
178639178724
return rc;
178640178725
}
178641178726
178642178727
/*
178643178728
** Enable or disable the extended result codes.
@@ -200613,21 +200698,20 @@
200613200698
switch( (u8)z[i] ){
200614200699
case '{': {
200615200700
/* Parse object */
200616200701
iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
200617200702
if( iThis<0 ) return -1;
200703
+ if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200704
+ pParse->iErr = i;
200705
+ return -1;
200706
+ }
200618200707
for(j=i+1;;j++){
200619
- if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200620
- pParse->iErr = j;
200621
- return -1;
200622
- }
200623200708
x = jsonParseValue(pParse, j);
200624200709
if( x<=0 ){
200625200710
if( x==(-2) ){
200626200711
j = pParse->iErr;
200627200712
if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1;
200628
- pParse->iDepth--;
200629200713
break;
200630200714
}
200631200715
j += json5Whitespace(&z[j]);
200632200716
if( sqlite3JsonId1(z[j])
200633200717
|| (z[j]=='\\' && z[j+1]=='u' && jsonIs4Hex(&z[j+2]))
@@ -200671,11 +200755,10 @@
200671200755
}
200672200756
j = pParse->iErr+1;
200673200757
}
200674200758
parse_object_value:
200675200759
x = jsonParseValue(pParse, j);
200676
- pParse->iDepth--;
200677200760
if( x<=0 ){
200678200761
if( x!=(-1) ) pParse->iErr = j;
200679200762
return -1;
200680200763
}
200681200764
j = x;
@@ -200704,24 +200787,24 @@
200704200787
}
200705200788
pParse->iErr = j;
200706200789
return -1;
200707200790
}
200708200791
pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1;
200792
+ pParse->iDepth--;
200709200793
return j+1;
200710200794
}
200711200795
case '[': {
200712200796
/* Parse array */
200713200797
iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
200714200798
if( iThis<0 ) return -1;
200799
+ if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200800
+ pParse->iErr = i;
200801
+ return -1;
200802
+ }
200715200803
memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
200716200804
for(j=i+1;;j++){
200717
- if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200718
- pParse->iErr = j;
200719
- return -1;
200720
- }
200721200805
x = jsonParseValue(pParse, j);
200722
- pParse->iDepth--;
200723200806
if( x<=0 ){
200724200807
if( x==(-3) ){
200725200808
j = pParse->iErr;
200726200809
if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1;
200727200810
break;
@@ -200755,10 +200838,11 @@
200755200838
}
200756200839
pParse->iErr = j;
200757200840
return -1;
200758200841
}
200759200842
pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1;
200843
+ pParse->iDepth--;
200760200844
return j+1;
200761200845
}
200762200846
case '\'': {
200763200847
u8 jnFlags;
200764200848
char cDelim;
@@ -200804,18 +200888,10 @@
200804200888
j++;
200805200889
}
200806200890
jsonParseAddNode(pParse, JSON_STRING | (jnFlags<<8), j+1-i, &z[i]);
200807200891
return j+1;
200808200892
}
200809
- case 'n': {
200810
- if( strncmp(z+i,"null",4)==0 && !sqlite3Isalnum(z[i+4]) ){
200811
- jsonParseAddNode(pParse, JSON_NULL, 0, 0);
200812
- return i+4;
200813
- }
200814
- pParse->iErr = i;
200815
- return -1;
200816
- }
200817200893
case 't': {
200818200894
if( strncmp(z+i,"true",4)==0 && !sqlite3Isalnum(z[i+4]) ){
200819200895
jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
200820200896
return i+4;
200821200897
}
@@ -201012,10 +201088,17 @@
201012201088
goto json_parse_restart;
201013201089
}
201014201090
pParse->iErr = i;
201015201091
return -1;
201016201092
}
201093
+ case 'n': {
201094
+ if( strncmp(z+i,"null",4)==0 && !sqlite3Isalnum(z[i+4]) ){
201095
+ jsonParseAddNode(pParse, JSON_NULL, 0, 0);
201096
+ return i+4;
201097
+ }
201098
+ /* fall-through into the default case that checks for NaN */
201099
+ }
201017201100
default: {
201018201101
u32 k;
201019201102
int nn;
201020201103
c = z[i];
201021201104
for(k=0; k<sizeof(aNanInfName)/sizeof(aNanInfName[0]); k++){
@@ -202089,10 +202172,11 @@
202089202172
int argc,
202090202173
sqlite3_value **argv
202091202174
){
202092202175
JsonParse *p; /* The parse */
202093202176
UNUSED_PARAMETER(argc);
202177
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
202094202178
p = jsonParseCached(ctx, argv, 0);
202095202179
if( p==0 || p->oom ){
202096202180
sqlite3_result_error_nomem(ctx);
202097202181
sqlite3_free(p);
202098202182
}else{
@@ -202134,10 +202218,11 @@
202134202218
int argc,
202135202219
sqlite3_value **argv
202136202220
){
202137202221
JsonParse *p; /* The parse */
202138202222
UNUSED_PARAMETER(argc);
202223
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
202139202224
p = jsonParseCached(ctx, argv, 0);
202140202225
if( p==0 || p->oom ){
202141202226
sqlite3_result_error_nomem(ctx);
202142202227
sqlite3_free(p);
202143202228
}else if( p->nErr==0 ){
@@ -218806,19 +218891,19 @@
218806218891
}
218807218892
}else{
218808218893
int ii;
218809218894
u8 *pCsr = pC->aRecord;
218810218895
if( pTab->bRowid ){
218811
- nNew += 9;
218896
+ nNew += 9 + 1;
218812218897
pCsr += 9;
218813218898
}
218814
- for(ii=0; ii<(pTab->nCol-pTab->bRowid); ii++){
218899
+ for(ii=pTab->bRowid; ii<pTab->nCol; ii++){
218815218900
int bChanged = 1;
218816218901
int nOld = 0;
218817218902
int eType;
218818218903
sqlite3_value *p = 0;
218819
- pSession->hook.xNew(pSession->hook.pCtx, ii, &p);
218904
+ pSession->hook.xNew(pSession->hook.pCtx, ii-pTab->bRowid, &p);
218820218905
if( p==0 ){
218821218906
return SQLITE_NOMEM;
218822218907
}
218823218908
218824218909
eType = *pCsr++;
@@ -219962,11 +220047,11 @@
219962220047
}
219963220048
219964220049
/* If at least one field has been modified, this is not a no-op. */
219965220050
if( bChanged ) bNoop = 0;
219966220051
219967
- /* Add a field to the old.* record. This is omitted if this modules is
220052
+ /* Add a field to the old.* record. This is omitted if this module is
219968220053
** currently generating a patchset. */
219969220054
if( bPatchset==0 ){
219970220055
if( bChanged || abPK[i] ){
219971220056
sessionAppendBlob(pBuf, pCsr, nAdvance, &rc);
219972220057
}else{
@@ -220404,11 +220489,11 @@
220404220489
){
220405220490
int rc;
220406220491
220407220492
if( pnChangeset==0 || ppChangeset==0 ) return SQLITE_MISUSE;
220408220493
rc = sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset, ppChangeset);
220409
- assert( 1 || rc || pnChangeset==0
220494
+ assert( rc || pnChangeset==0
220410220495
|| pSession->bEnableSize==0 || *pnChangeset<=pSession->nMaxChangesetSize
220411220496
);
220412220497
return rc;
220413220498
}
220414220499
@@ -224719,11 +224804,11 @@
224719224804
static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v);
224720224805
static int sqlite3Fts5GetVarintLen(u32 iVal);
224721224806
static u8 sqlite3Fts5GetVarint(const unsigned char*, u64*);
224722224807
static int sqlite3Fts5PutVarint(unsigned char *p, u64 v);
224723224808
224724
-#define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&b)
224809
+#define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&(b))
224725224810
#define fts5GetVarint sqlite3Fts5GetVarint
224726224811
224727224812
#define fts5FastGetVarint32(a, iOff, nVal) { \
224728224813
nVal = (a)[iOff++]; \
224729224814
if( nVal & 0x80 ){ \
@@ -228211,10 +228296,11 @@
228211228296
if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){
228212228297
*pzErr = sqlite3_mprintf("reserved fts5 table name: %s", pRet->zName);
228213228298
rc = SQLITE_ERROR;
228214228299
}
228215228300
228301
+ assert( (pRet->abUnindexed && pRet->azCol) || rc!=SQLITE_OK );
228216228302
for(i=3; rc==SQLITE_OK && i<nArg; i++){
228217228303
const char *zOrig = azArg[i];
228218228304
const char *z;
228219228305
char *zOne = 0;
228220228306
char *zTwo = 0;
@@ -233245,10 +233331,11 @@
233245233331
Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];
233246233332
if( i>=nData ){
233247233333
rc = FTS5_CORRUPT;
233248233334
break;
233249233335
}
233336
+ assert( pSeg!=0 );
233250233337
i += fts5GetVarint32(&pData[i], pSeg->iSegid);
233251233338
i += fts5GetVarint32(&pData[i], pSeg->pgnoFirst);
233252233339
i += fts5GetVarint32(&pData[i], pSeg->pgnoLast);
233253233340
if( pSeg->pgnoLast<pSeg->pgnoFirst ){
233254233341
rc = FTS5_CORRUPT;
@@ -242386,11 +242473,11 @@
242386242473
int nArg, /* Number of args */
242387242474
sqlite3_value **apUnused /* Function arguments */
242388242475
){
242389242476
assert( nArg==0 );
242390242477
UNUSED_PARAM2(nArg, apUnused);
242391
- sqlite3_result_text(pCtx, "fts5: 2023-05-01 20:09:52 62d703d83cf8cf3358715792347c49315a82c659e475158e385746f4329a4f39", -1, SQLITE_TRANSIENT);
242478
+ sqlite3_result_text(pCtx, "fts5: 2023-05-05 14:16:31 fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315", -1, SQLITE_TRANSIENT);
242392242479
}
242393242480
242394242481
/*
242395242482
** Return true if zName is the extension on one of the shadow tables used
242396242483
** by this module.
242397242484
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -456,11 +456,11 @@
456 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
457 ** [sqlite_version()] and [sqlite_source_id()].
458 */
459 #define SQLITE_VERSION "3.42.0"
460 #define SQLITE_VERSION_NUMBER 3042000
461 #define SQLITE_SOURCE_ID "2023-05-01 20:42:15 342af5b4fa0bd7c699e5497161db13d0cf795c7a5875ae30d666122e518f213b"
462
463 /*
464 ** CAPI3REF: Run-Time Library Version Numbers
465 ** KEYWORDS: sqlite3_version sqlite3_sourceid
466 **
@@ -2450,32 +2450,32 @@
2450 ** configuration setting is never used, then the default maximum is determined
2451 ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2452 ** compile-time option is not set, then the default maximum is 1073741824.
2453 ** </dl>
2454 */
2455 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2456 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2457 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2458 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2459 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2460 #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2461 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2462 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2463 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2464 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2465 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2466 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2467 #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2468 #define SQLITE_CONFIG_PCACHE 14 /* no-op */
2469 #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2470 #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2471 #define SQLITE_CONFIG_URI 17 /* int */
2472 #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2473 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2474 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2475 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2476 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2477 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
2478 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
2479 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
2480 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
2481 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -6563,10 +6563,17 @@
6563 ** ^SQLite implements this interface by calling the xSleep()
6564 ** method of the default [sqlite3_vfs] object. If the xSleep() method
6565 ** of the default VFS is not implemented correctly, or not implemented at
6566 ** all, then the behavior of sqlite3_sleep() may deviate from the description
6567 ** in the previous paragraphs.
 
 
 
 
 
 
 
6568 */
6569 SQLITE_API int sqlite3_sleep(int);
6570
6571 /*
6572 ** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -18293,10 +18300,11 @@
18293 unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
18294 unsigned bHasExpr:1; /* Index contains an expression, either a literal
18295 ** expression, or a reference to a VIRTUAL column */
18296 #ifdef SQLITE_ENABLE_STAT4
18297 int nSample; /* Number of elements in aSample[] */
 
18298 int nSampleCol; /* Size of IndexSample.anEq[] and so on */
18299 tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
18300 IndexSample *aSample; /* Samples of the left-most key */
18301 tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
18302 tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
@@ -23687,10 +23695,11 @@
23687 char validYMD; /* True (1) if Y,M,D are valid */
23688 char validHMS; /* True (1) if h,m,s are valid */
23689 char validTZ; /* True (1) if tz is valid */
23690 char tzSet; /* Timezone was set explicitly */
23691 char isError; /* An overflow has occurred */
 
23692 };
23693
23694
23695 /*
23696 ** Convert zDate into one or more integers according to the conversion
@@ -24001,10 +24010,15 @@
24001 }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
24002 return setDateTimeToCurrent(context, p);
24003 }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
24004 setRawDateNumber(p, r);
24005 return 0;
 
 
 
 
 
24006 }
24007 return 1;
24008 }
24009
24010 /* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
@@ -24415,12 +24429,26 @@
24415 /*
24416 ** start of TTTTT
24417 **
24418 ** Move the date backwards to the beginning of the current day,
24419 ** or month or year.
 
 
 
 
 
 
24420 */
24421 if( sqlite3_strnicmp(z, "start of ", 9)!=0 ) break;
 
 
 
 
 
 
 
 
24422 if( !p->validJD && !p->validYMD && !p->validHMS ) break;
24423 z += 9;
24424 computeYMD(p);
24425 p->validHMS = 1;
24426 p->h = p->m = 0;
@@ -24614,11 +24642,15 @@
24614 sqlite3_value **argv
24615 ){
24616 DateTime x;
24617 if( isDate(context, argc, argv, &x)==0 ){
24618 computeJD(&x);
24619 sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
 
 
 
 
24620 }
24621 }
24622
24623 /*
24624 ** datetime( TIMESTRING, MOD, MOD, ...)
@@ -24630,12 +24662,12 @@
24630 int argc,
24631 sqlite3_value **argv
24632 ){
24633 DateTime x;
24634 if( isDate(context, argc, argv, &x)==0 ){
24635 int Y, s;
24636 char zBuf[24];
24637 computeYMD_HMS(&x);
24638 Y = x.Y;
24639 if( Y<0 ) Y = -Y;
24640 zBuf[1] = '0' + (Y/1000)%10;
24641 zBuf[2] = '0' + (Y/100)%10;
@@ -24652,19 +24684,32 @@
24652 zBuf[13] = '0' + (x.h)%10;
24653 zBuf[14] = ':';
24654 zBuf[15] = '0' + (x.m/10)%10;
24655 zBuf[16] = '0' + (x.m)%10;
24656 zBuf[17] = ':';
24657 s = (int)x.s;
24658 zBuf[18] = '0' + (s/10)%10;
24659 zBuf[19] = '0' + (s)%10;
24660 zBuf[20] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
24661 if( x.Y<0 ){
24662 zBuf[0] = '-';
24663 sqlite3_result_text(context, zBuf, 20, SQLITE_TRANSIENT);
24664 }else{
24665 sqlite3_result_text(context, &zBuf[1], 19, SQLITE_TRANSIENT);
24666 }
24667 }
24668 }
24669
24670 /*
@@ -24677,24 +24722,37 @@
24677 int argc,
24678 sqlite3_value **argv
24679 ){
24680 DateTime x;
24681 if( isDate(context, argc, argv, &x)==0 ){
24682 int s;
24683 char zBuf[16];
24684 computeHMS(&x);
24685 zBuf[0] = '0' + (x.h/10)%10;
24686 zBuf[1] = '0' + (x.h)%10;
24687 zBuf[2] = ':';
24688 zBuf[3] = '0' + (x.m/10)%10;
24689 zBuf[4] = '0' + (x.m)%10;
24690 zBuf[5] = ':';
24691 s = (int)x.s;
24692 zBuf[6] = '0' + (s/10)%10;
24693 zBuf[7] = '0' + (s)%10;
24694 zBuf[8] = 0;
24695 sqlite3_result_text(context, zBuf, 8, SQLITE_TRANSIENT);
 
 
 
 
 
 
 
 
 
 
 
 
 
24696 }
24697 }
24698
24699 /*
24700 ** date( TIMESTRING, MOD, MOD, ...)
@@ -24821,12 +24879,17 @@
24821 case 'M': {
24822 sqlite3_str_appendf(&sRes,"%02d",x.m);
24823 break;
24824 }
24825 case 's': {
24826 i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
24827 sqlite3_str_appendf(&sRes,"%lld",iS);
 
 
 
 
 
24828 break;
24829 }
24830 case 'S': {
24831 sqlite3_str_appendf(&sRes,"%02d",(int)x.s);
24832 break;
@@ -30700,10 +30763,11 @@
30700 nsd = 16 + flag_altform2*10;
30701 bufpt = buf;
30702 {
30703 i64 szBufNeeded; /* Size of a temporary buffer needed */
30704 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
 
30705 if( szBufNeeded > etBUFSIZE ){
30706 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30707 if( bufpt==0 ) return;
30708 }
30709 }
@@ -30717,14 +30781,16 @@
30717 if( e2<0 ){
30718 *(bufpt++) = '0';
30719 }else if( msd>0 ){
30720 for(; e2>=0; e2--){
30721 *(bufpt++) = et_getdigit_int(&longvalue,&msd);
 
30722 }
30723 }else{
30724 for(; e2>=0; e2--){
30725 *(bufpt++) = et_getdigit(&realvalue,&nsd);
 
30726 }
30727 }
30728 /* The decimal point */
30729 if( flag_dp ){
30730 *(bufpt++) = '.';
@@ -67126,11 +67192,13 @@
67126 if( pWal->syncHeader ){
67127 rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
67128 if( rc ) return rc;
67129 }
67130 }
67131 assert( (int)pWal->szPage==szPage );
 
 
67132
67133 /* Setup information needed to write frames into the WAL */
67134 w.pWal = pWal;
67135 w.pFd = pWal->pWalFd;
67136 w.iSyncPoint = 0;
@@ -67786,11 +67854,11 @@
67786 ** Cell content makes use of variable length integers. A variable
67787 ** length integer is 1 to 9 bytes where the lower 7 bits of each
67788 ** byte are used. The integer consists of all bytes that have bit 8 set and
67789 ** the first byte with bit 8 clear. The most significant byte of the integer
67790 ** appears first. A variable-length integer may not be more than 9 bytes long.
67791 ** As a special case, all 8 bytes of the 9th byte are used as data. This
67792 ** allows a 64-bit integer to be encoded in 9 bytes.
67793 **
67794 ** 0x00 becomes 0x00000000
67795 ** 0x7f becomes 0x0000007f
67796 ** 0x81 0x00 becomes 0x00000080
@@ -116967,17 +117035,22 @@
116967 if( zIndex==0 ) continue;
116968 nSample = sqlite3_column_int(pStmt, 1);
116969 pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);
116970 assert( pIdx==0 || pIdx->nSample==0 );
116971 if( pIdx==0 ) continue;
 
 
 
 
116972 assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 );
116973 if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
116974 nIdxCol = pIdx->nKeyCol;
116975 }else{
116976 nIdxCol = pIdx->nColumn;
116977 }
116978 pIdx->nSampleCol = nIdxCol;
 
116979 nByte = sizeof(IndexSample) * nSample;
116980 nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;
116981 nByte += nIdxCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */
116982
116983 pIdx->aSample = sqlite3DbMallocZero(db, nByte);
@@ -117013,10 +117086,15 @@
117013
117014 zIndex = (char *)sqlite3_column_text(pStmt, 0);
117015 if( zIndex==0 ) continue;
117016 pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);
117017 if( pIdx==0 ) continue;
 
 
 
 
 
117018 /* This next condition is true if data has already been loaded from
117019 ** the sqlite_stat4 table. */
117020 nCol = pIdx->nSampleCol;
117021 if( pIdx!=pPrevIdx ){
117022 initAvgEq(pPrevIdx);
@@ -117056,11 +117134,12 @@
117056 static int loadStat4(sqlite3 *db, const char *zDb){
117057 int rc = SQLITE_OK; /* Result codes from subroutines */
117058 const Table *pStat4;
117059
117060 assert( db->lookaside.bDisable );
117061 if( (pStat4 = sqlite3FindTable(db, "sqlite_stat4", zDb))!=0
 
117062 && IsOrdinaryTable(pStat4)
117063 ){
117064 rc = loadStatTbl(db,
117065 "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase",
117066 "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4",
@@ -118904,11 +118983,11 @@
118904 }
118905
118906 if( IsOrdinaryTable(pTable) ){
118907 sqlite3FkDelete(db, pTable);
118908 }
118909 #ifndef SQLITE_OMIT_VIRTUAL_TABLE
118910 else if( IsVirtual(pTable) ){
118911 sqlite3VtabClear(db, pTable);
118912 }
118913 #endif
118914 else{
@@ -126832,11 +126911,11 @@
126832
126833 #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
126834 /*
126835 ** The "unknown" function is automatically substituted in place of
126836 ** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN
126837 ** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used.
126838 ** When the "sqlite3" command-line shell is built using this functionality,
126839 ** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries
126840 ** involving application-defined functions to be examined in a generic
126841 ** sqlite3 shell.
126842 */
@@ -139592,11 +139671,11 @@
139592 ** by a prior OP_MakeRecord. In this case nData==1 and regData
139593 ** will be completely unrelated to regOrigData.
139594 ** (2) All output columns are included in the sort record. In that
139595 ** case regData==regOrigData.
139596 ** (3) Some output columns are omitted from the sort record due to
139597 ** the SQLITE_ENABLE_SORTER_REFERENCE optimization, or due to the
139598 ** SQLITE_ECEL_OMITREF optimization, or due to the
139599 ** SortCtx.pDeferredRowLoad optimiation. In any of these cases
139600 ** regOrigData is 0 to prevent this routine from trying to copy
139601 ** values that might not yet exist.
139602 */
@@ -152059,11 +152138,14 @@
152059 default:
152060 xMethod = pMod->xRelease;
152061 break;
152062 }
152063 if( xMethod && pVTab->iSavepoint>iSavepoint ){
 
 
152064 rc = xMethod(pVTab->pVtab, iSavepoint);
 
152065 }
152066 sqlite3VtabUnlock(pVTab);
152067 }
152068 }
152069 }
@@ -153984,10 +154066,13 @@
153984 rc = WRC_Prune;
153985 reg = ++pWalker->pParse->nMem; /* Register for column value */
153986 reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
153987 pExpr->op = TK_REGISTER;
153988 pExpr->iTable = reg;
 
 
 
153989 }
153990 return rc;
153991 }
153992
153993 /*
@@ -156951,11 +157036,11 @@
156951 if( op==TK_ISNULL
156952 && !ExprHasProperty(pExpr,EP_OuterON)
156953 && 0==sqlite3ExprCanBeNull(pLeft)
156954 ){
156955 assert( !ExprHasProperty(pExpr, EP_IntValue) );
156956 pExpr->op = TK_TRUEFALSE;
156957 pExpr->u.zToken = "false";
156958 ExprSetProperty(pExpr, EP_IsFalse);
156959 pTerm->prereqAll = 0;
156960 pTerm->eOperator = 0;
156961 }
@@ -178633,11 +178718,11 @@
178633 if( pVfs==0 ) return 0;
178634
178635 /* This function works in milliseconds, but the underlying OsSleep()
178636 ** API uses microseconds. Hence the 1000's.
178637 */
178638 rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);
178639 return rc;
178640 }
178641
178642 /*
178643 ** Enable or disable the extended result codes.
@@ -200613,21 +200698,20 @@
200613 switch( (u8)z[i] ){
200614 case '{': {
200615 /* Parse object */
200616 iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
200617 if( iThis<0 ) return -1;
 
 
 
 
200618 for(j=i+1;;j++){
200619 if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200620 pParse->iErr = j;
200621 return -1;
200622 }
200623 x = jsonParseValue(pParse, j);
200624 if( x<=0 ){
200625 if( x==(-2) ){
200626 j = pParse->iErr;
200627 if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1;
200628 pParse->iDepth--;
200629 break;
200630 }
200631 j += json5Whitespace(&z[j]);
200632 if( sqlite3JsonId1(z[j])
200633 || (z[j]=='\\' && z[j+1]=='u' && jsonIs4Hex(&z[j+2]))
@@ -200671,11 +200755,10 @@
200671 }
200672 j = pParse->iErr+1;
200673 }
200674 parse_object_value:
200675 x = jsonParseValue(pParse, j);
200676 pParse->iDepth--;
200677 if( x<=0 ){
200678 if( x!=(-1) ) pParse->iErr = j;
200679 return -1;
200680 }
200681 j = x;
@@ -200704,24 +200787,24 @@
200704 }
200705 pParse->iErr = j;
200706 return -1;
200707 }
200708 pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1;
 
200709 return j+1;
200710 }
200711 case '[': {
200712 /* Parse array */
200713 iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
200714 if( iThis<0 ) return -1;
 
 
 
 
200715 memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
200716 for(j=i+1;;j++){
200717 if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200718 pParse->iErr = j;
200719 return -1;
200720 }
200721 x = jsonParseValue(pParse, j);
200722 pParse->iDepth--;
200723 if( x<=0 ){
200724 if( x==(-3) ){
200725 j = pParse->iErr;
200726 if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1;
200727 break;
@@ -200755,10 +200838,11 @@
200755 }
200756 pParse->iErr = j;
200757 return -1;
200758 }
200759 pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1;
 
200760 return j+1;
200761 }
200762 case '\'': {
200763 u8 jnFlags;
200764 char cDelim;
@@ -200804,18 +200888,10 @@
200804 j++;
200805 }
200806 jsonParseAddNode(pParse, JSON_STRING | (jnFlags<<8), j+1-i, &z[i]);
200807 return j+1;
200808 }
200809 case 'n': {
200810 if( strncmp(z+i,"null",4)==0 && !sqlite3Isalnum(z[i+4]) ){
200811 jsonParseAddNode(pParse, JSON_NULL, 0, 0);
200812 return i+4;
200813 }
200814 pParse->iErr = i;
200815 return -1;
200816 }
200817 case 't': {
200818 if( strncmp(z+i,"true",4)==0 && !sqlite3Isalnum(z[i+4]) ){
200819 jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
200820 return i+4;
200821 }
@@ -201012,10 +201088,17 @@
201012 goto json_parse_restart;
201013 }
201014 pParse->iErr = i;
201015 return -1;
201016 }
 
 
 
 
 
 
 
201017 default: {
201018 u32 k;
201019 int nn;
201020 c = z[i];
201021 for(k=0; k<sizeof(aNanInfName)/sizeof(aNanInfName[0]); k++){
@@ -202089,10 +202172,11 @@
202089 int argc,
202090 sqlite3_value **argv
202091 ){
202092 JsonParse *p; /* The parse */
202093 UNUSED_PARAMETER(argc);
 
202094 p = jsonParseCached(ctx, argv, 0);
202095 if( p==0 || p->oom ){
202096 sqlite3_result_error_nomem(ctx);
202097 sqlite3_free(p);
202098 }else{
@@ -202134,10 +202218,11 @@
202134 int argc,
202135 sqlite3_value **argv
202136 ){
202137 JsonParse *p; /* The parse */
202138 UNUSED_PARAMETER(argc);
 
202139 p = jsonParseCached(ctx, argv, 0);
202140 if( p==0 || p->oom ){
202141 sqlite3_result_error_nomem(ctx);
202142 sqlite3_free(p);
202143 }else if( p->nErr==0 ){
@@ -218806,19 +218891,19 @@
218806 }
218807 }else{
218808 int ii;
218809 u8 *pCsr = pC->aRecord;
218810 if( pTab->bRowid ){
218811 nNew += 9;
218812 pCsr += 9;
218813 }
218814 for(ii=0; ii<(pTab->nCol-pTab->bRowid); ii++){
218815 int bChanged = 1;
218816 int nOld = 0;
218817 int eType;
218818 sqlite3_value *p = 0;
218819 pSession->hook.xNew(pSession->hook.pCtx, ii, &p);
218820 if( p==0 ){
218821 return SQLITE_NOMEM;
218822 }
218823
218824 eType = *pCsr++;
@@ -219962,11 +220047,11 @@
219962 }
219963
219964 /* If at least one field has been modified, this is not a no-op. */
219965 if( bChanged ) bNoop = 0;
219966
219967 /* Add a field to the old.* record. This is omitted if this modules is
219968 ** currently generating a patchset. */
219969 if( bPatchset==0 ){
219970 if( bChanged || abPK[i] ){
219971 sessionAppendBlob(pBuf, pCsr, nAdvance, &rc);
219972 }else{
@@ -220404,11 +220489,11 @@
220404 ){
220405 int rc;
220406
220407 if( pnChangeset==0 || ppChangeset==0 ) return SQLITE_MISUSE;
220408 rc = sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset, ppChangeset);
220409 assert( 1 || rc || pnChangeset==0
220410 || pSession->bEnableSize==0 || *pnChangeset<=pSession->nMaxChangesetSize
220411 );
220412 return rc;
220413 }
220414
@@ -224719,11 +224804,11 @@
224719 static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v);
224720 static int sqlite3Fts5GetVarintLen(u32 iVal);
224721 static u8 sqlite3Fts5GetVarint(const unsigned char*, u64*);
224722 static int sqlite3Fts5PutVarint(unsigned char *p, u64 v);
224723
224724 #define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&b)
224725 #define fts5GetVarint sqlite3Fts5GetVarint
224726
224727 #define fts5FastGetVarint32(a, iOff, nVal) { \
224728 nVal = (a)[iOff++]; \
224729 if( nVal & 0x80 ){ \
@@ -228211,10 +228296,11 @@
228211 if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){
228212 *pzErr = sqlite3_mprintf("reserved fts5 table name: %s", pRet->zName);
228213 rc = SQLITE_ERROR;
228214 }
228215
 
228216 for(i=3; rc==SQLITE_OK && i<nArg; i++){
228217 const char *zOrig = azArg[i];
228218 const char *z;
228219 char *zOne = 0;
228220 char *zTwo = 0;
@@ -233245,10 +233331,11 @@
233245 Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];
233246 if( i>=nData ){
233247 rc = FTS5_CORRUPT;
233248 break;
233249 }
 
233250 i += fts5GetVarint32(&pData[i], pSeg->iSegid);
233251 i += fts5GetVarint32(&pData[i], pSeg->pgnoFirst);
233252 i += fts5GetVarint32(&pData[i], pSeg->pgnoLast);
233253 if( pSeg->pgnoLast<pSeg->pgnoFirst ){
233254 rc = FTS5_CORRUPT;
@@ -242386,11 +242473,11 @@
242386 int nArg, /* Number of args */
242387 sqlite3_value **apUnused /* Function arguments */
242388 ){
242389 assert( nArg==0 );
242390 UNUSED_PARAM2(nArg, apUnused);
242391 sqlite3_result_text(pCtx, "fts5: 2023-05-01 20:09:52 62d703d83cf8cf3358715792347c49315a82c659e475158e385746f4329a4f39", -1, SQLITE_TRANSIENT);
242392 }
242393
242394 /*
242395 ** Return true if zName is the extension on one of the shadow tables used
242396 ** by this module.
242397
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -456,11 +456,11 @@
456 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
457 ** [sqlite_version()] and [sqlite_source_id()].
458 */
459 #define SQLITE_VERSION "3.42.0"
460 #define SQLITE_VERSION_NUMBER 3042000
461 #define SQLITE_SOURCE_ID "2023-05-05 14:16:31 fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315"
462
463 /*
464 ** CAPI3REF: Run-Time Library Version Numbers
465 ** KEYWORDS: sqlite3_version sqlite3_sourceid
466 **
@@ -2450,32 +2450,32 @@
2450 ** configuration setting is never used, then the default maximum is determined
2451 ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2452 ** compile-time option is not set, then the default maximum is 1073741824.
2453 ** </dl>
2454 */
2455 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2456 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2457 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2458 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2459 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2460 #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2461 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2462 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2463 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2464 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2465 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2466 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2467 #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2468 #define SQLITE_CONFIG_PCACHE 14 /* no-op */
2469 #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2470 #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2471 #define SQLITE_CONFIG_URI 17 /* int */
2472 #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2473 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2474 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2475 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2476 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2477 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
2478 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
2479 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
2480 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
2481 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -6563,10 +6563,17 @@
6563 ** ^SQLite implements this interface by calling the xSleep()
6564 ** method of the default [sqlite3_vfs] object. If the xSleep() method
6565 ** of the default VFS is not implemented correctly, or not implemented at
6566 ** all, then the behavior of sqlite3_sleep() may deviate from the description
6567 ** in the previous paragraphs.
6568 **
6569 ** If a negative argument is passed to sqlite3_sleep() the results vary by
6570 ** VFS and operating system. Some system treat a negative argument as an
6571 ** instruction to sleep forever. Others understand it to mean do not sleep
6572 ** at all. ^In SQLite version 3.42.0 and later, a negative
6573 ** argument passed into sqlite3_sleep() is changed to zero before it is relayed
6574 ** down into the xSleep method of the VFS.
6575 */
6576 SQLITE_API int sqlite3_sleep(int);
6577
6578 /*
6579 ** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -18293,10 +18300,11 @@
18300 unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
18301 unsigned bHasExpr:1; /* Index contains an expression, either a literal
18302 ** expression, or a reference to a VIRTUAL column */
18303 #ifdef SQLITE_ENABLE_STAT4
18304 int nSample; /* Number of elements in aSample[] */
18305 int mxSample; /* Number of slots allocated to aSample[] */
18306 int nSampleCol; /* Size of IndexSample.anEq[] and so on */
18307 tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
18308 IndexSample *aSample; /* Samples of the left-most key */
18309 tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
18310 tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
@@ -23687,10 +23695,11 @@
23695 char validYMD; /* True (1) if Y,M,D are valid */
23696 char validHMS; /* True (1) if h,m,s are valid */
23697 char validTZ; /* True (1) if tz is valid */
23698 char tzSet; /* Timezone was set explicitly */
23699 char isError; /* An overflow has occurred */
23700 char useSubsec; /* Display subsecond precision */
23701 };
23702
23703
23704 /*
23705 ** Convert zDate into one or more integers according to the conversion
@@ -24001,10 +24010,15 @@
24010 }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
24011 return setDateTimeToCurrent(context, p);
24012 }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
24013 setRawDateNumber(p, r);
24014 return 0;
24015 }else if( (sqlite3StrICmp(zDate,"subsec")==0
24016 || sqlite3StrICmp(zDate,"subsecond")==0)
24017 && sqlite3NotPureFunc(context) ){
24018 p->useSubsec = 1;
24019 return setDateTimeToCurrent(context, p);
24020 }
24021 return 1;
24022 }
24023
24024 /* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
@@ -24415,12 +24429,26 @@
24429 /*
24430 ** start of TTTTT
24431 **
24432 ** Move the date backwards to the beginning of the current day,
24433 ** or month or year.
24434 **
24435 ** subsecond
24436 ** subsec
24437 **
24438 ** Show subsecond precision in the output of datetime() and
24439 ** unixepoch() and strftime('%s').
24440 */
24441 if( sqlite3_strnicmp(z, "start of ", 9)!=0 ){
24442 if( sqlite3_stricmp(z, "subsec")==0
24443 || sqlite3_stricmp(z, "subsecond")==0
24444 ){
24445 p->useSubsec = 1;
24446 rc = 0;
24447 }
24448 break;
24449 }
24450 if( !p->validJD && !p->validYMD && !p->validHMS ) break;
24451 z += 9;
24452 computeYMD(p);
24453 p->validHMS = 1;
24454 p->h = p->m = 0;
@@ -24614,11 +24642,15 @@
24642 sqlite3_value **argv
24643 ){
24644 DateTime x;
24645 if( isDate(context, argc, argv, &x)==0 ){
24646 computeJD(&x);
24647 if( x.useSubsec ){
24648 sqlite3_result_double(context, (x.iJD - 21086676*(i64)10000000)/1000.0);
24649 }else{
24650 sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
24651 }
24652 }
24653 }
24654
24655 /*
24656 ** datetime( TIMESTRING, MOD, MOD, ...)
@@ -24630,12 +24662,12 @@
24662 int argc,
24663 sqlite3_value **argv
24664 ){
24665 DateTime x;
24666 if( isDate(context, argc, argv, &x)==0 ){
24667 int Y, s, n;
24668 char zBuf[32];
24669 computeYMD_HMS(&x);
24670 Y = x.Y;
24671 if( Y<0 ) Y = -Y;
24672 zBuf[1] = '0' + (Y/1000)%10;
24673 zBuf[2] = '0' + (Y/100)%10;
@@ -24652,19 +24684,32 @@
24684 zBuf[13] = '0' + (x.h)%10;
24685 zBuf[14] = ':';
24686 zBuf[15] = '0' + (x.m/10)%10;
24687 zBuf[16] = '0' + (x.m)%10;
24688 zBuf[17] = ':';
24689 if( x.useSubsec ){
24690 s = (int)1000.0*x.s;
24691 zBuf[18] = '0' + (s/10000)%10;
24692 zBuf[19] = '0' + (s/1000)%10;
24693 zBuf[20] = '.';
24694 zBuf[21] = '0' + (s/100)%10;
24695 zBuf[22] = '0' + (s/10)%10;
24696 zBuf[23] = '0' + (s)%10;
24697 zBuf[24] = 0;
24698 n = 24;
24699 }else{
24700 s = (int)x.s;
24701 zBuf[18] = '0' + (s/10)%10;
24702 zBuf[19] = '0' + (s)%10;
24703 zBuf[20] = 0;
24704 n = 20;
24705 }
24706 if( x.Y<0 ){
24707 zBuf[0] = '-';
24708 sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
24709 }else{
24710 sqlite3_result_text(context, &zBuf[1], n-1, SQLITE_TRANSIENT);
24711 }
24712 }
24713 }
24714
24715 /*
@@ -24677,24 +24722,37 @@
24722 int argc,
24723 sqlite3_value **argv
24724 ){
24725 DateTime x;
24726 if( isDate(context, argc, argv, &x)==0 ){
24727 int s, n;
24728 char zBuf[16];
24729 computeHMS(&x);
24730 zBuf[0] = '0' + (x.h/10)%10;
24731 zBuf[1] = '0' + (x.h)%10;
24732 zBuf[2] = ':';
24733 zBuf[3] = '0' + (x.m/10)%10;
24734 zBuf[4] = '0' + (x.m)%10;
24735 zBuf[5] = ':';
24736 if( x.useSubsec ){
24737 s = (int)1000.0*x.s;
24738 zBuf[6] = '0' + (s/10000)%10;
24739 zBuf[7] = '0' + (s/1000)%10;
24740 zBuf[8] = '.';
24741 zBuf[9] = '0' + (s/100)%10;
24742 zBuf[10] = '0' + (s/10)%10;
24743 zBuf[11] = '0' + (s)%10;
24744 zBuf[12] = 0;
24745 n = 12;
24746 }else{
24747 s = (int)x.s;
24748 zBuf[6] = '0' + (s/10)%10;
24749 zBuf[7] = '0' + (s)%10;
24750 zBuf[8] = 0;
24751 n = 8;
24752 }
24753 sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
24754 }
24755 }
24756
24757 /*
24758 ** date( TIMESTRING, MOD, MOD, ...)
@@ -24821,12 +24879,17 @@
24879 case 'M': {
24880 sqlite3_str_appendf(&sRes,"%02d",x.m);
24881 break;
24882 }
24883 case 's': {
24884 if( x.useSubsec ){
24885 sqlite3_str_appendf(&sRes,"%.3f",
24886 (x.iJD - 21086676*(i64)10000000)/1000.0);
24887 }else{
24888 i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
24889 sqlite3_str_appendf(&sRes,"%lld",iS);
24890 }
24891 break;
24892 }
24893 case 'S': {
24894 sqlite3_str_appendf(&sRes,"%02d",(int)x.s);
24895 break;
@@ -30700,10 +30763,11 @@
30763 nsd = 16 + flag_altform2*10;
30764 bufpt = buf;
30765 {
30766 i64 szBufNeeded; /* Size of a temporary buffer needed */
30767 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30768 if( cThousand ) szBufNeeded += (e2+2)/3;
30769 if( szBufNeeded > etBUFSIZE ){
30770 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30771 if( bufpt==0 ) return;
30772 }
30773 }
@@ -30717,14 +30781,16 @@
30781 if( e2<0 ){
30782 *(bufpt++) = '0';
30783 }else if( msd>0 ){
30784 for(; e2>=0; e2--){
30785 *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30786 if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
30787 }
30788 }else{
30789 for(; e2>=0; e2--){
30790 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30791 if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
30792 }
30793 }
30794 /* The decimal point */
30795 if( flag_dp ){
30796 *(bufpt++) = '.';
@@ -67126,11 +67192,13 @@
67192 if( pWal->syncHeader ){
67193 rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
67194 if( rc ) return rc;
67195 }
67196 }
67197 if( (int)pWal->szPage!=szPage ){
67198 return SQLITE_CORRUPT_BKPT; /* TH3 test case: cov1/corrupt155.test */
67199 }
67200
67201 /* Setup information needed to write frames into the WAL */
67202 w.pWal = pWal;
67203 w.pFd = pWal->pWalFd;
67204 w.iSyncPoint = 0;
@@ -67786,11 +67854,11 @@
67854 ** Cell content makes use of variable length integers. A variable
67855 ** length integer is 1 to 9 bytes where the lower 7 bits of each
67856 ** byte are used. The integer consists of all bytes that have bit 8 set and
67857 ** the first byte with bit 8 clear. The most significant byte of the integer
67858 ** appears first. A variable-length integer may not be more than 9 bytes long.
67859 ** As a special case, all 8 bits of the 9th byte are used as data. This
67860 ** allows a 64-bit integer to be encoded in 9 bytes.
67861 **
67862 ** 0x00 becomes 0x00000000
67863 ** 0x7f becomes 0x0000007f
67864 ** 0x81 0x00 becomes 0x00000080
@@ -116967,17 +117035,22 @@
117035 if( zIndex==0 ) continue;
117036 nSample = sqlite3_column_int(pStmt, 1);
117037 pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);
117038 assert( pIdx==0 || pIdx->nSample==0 );
117039 if( pIdx==0 ) continue;
117040 if( pIdx->aSample!=0 ){
117041 /* The same index appears in sqlite_stat4 under multiple names */
117042 continue;
117043 }
117044 assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 );
117045 if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
117046 nIdxCol = pIdx->nKeyCol;
117047 }else{
117048 nIdxCol = pIdx->nColumn;
117049 }
117050 pIdx->nSampleCol = nIdxCol;
117051 pIdx->mxSample = nSample;
117052 nByte = sizeof(IndexSample) * nSample;
117053 nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;
117054 nByte += nIdxCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */
117055
117056 pIdx->aSample = sqlite3DbMallocZero(db, nByte);
@@ -117013,10 +117086,15 @@
117086
117087 zIndex = (char *)sqlite3_column_text(pStmt, 0);
117088 if( zIndex==0 ) continue;
117089 pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);
117090 if( pIdx==0 ) continue;
117091 if( pIdx->nSample>=pIdx->mxSample ){
117092 /* Too many slots used because the same index appears in
117093 ** sqlite_stat4 using multiple names */
117094 continue;
117095 }
117096 /* This next condition is true if data has already been loaded from
117097 ** the sqlite_stat4 table. */
117098 nCol = pIdx->nSampleCol;
117099 if( pIdx!=pPrevIdx ){
117100 initAvgEq(pPrevIdx);
@@ -117056,11 +117134,12 @@
117134 static int loadStat4(sqlite3 *db, const char *zDb){
117135 int rc = SQLITE_OK; /* Result codes from subroutines */
117136 const Table *pStat4;
117137
117138 assert( db->lookaside.bDisable );
117139 if( OptimizationEnabled(db, SQLITE_Stat4)
117140 && (pStat4 = sqlite3FindTable(db, "sqlite_stat4", zDb))!=0
117141 && IsOrdinaryTable(pStat4)
117142 ){
117143 rc = loadStatTbl(db,
117144 "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase",
117145 "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4",
@@ -118904,11 +118983,11 @@
118983 }
118984
118985 if( IsOrdinaryTable(pTable) ){
118986 sqlite3FkDelete(db, pTable);
118987 }
118988 #ifndef SQLITE_OMIT_VIRTUALTABLE
118989 else if( IsVirtual(pTable) ){
118990 sqlite3VtabClear(db, pTable);
118991 }
118992 #endif
118993 else{
@@ -126832,11 +126911,11 @@
126911
126912 #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
126913 /*
126914 ** The "unknown" function is automatically substituted in place of
126915 ** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN
126916 ** when the SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION compile-time option is used.
126917 ** When the "sqlite3" command-line shell is built using this functionality,
126918 ** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries
126919 ** involving application-defined functions to be examined in a generic
126920 ** sqlite3 shell.
126921 */
@@ -139592,11 +139671,11 @@
139671 ** by a prior OP_MakeRecord. In this case nData==1 and regData
139672 ** will be completely unrelated to regOrigData.
139673 ** (2) All output columns are included in the sort record. In that
139674 ** case regData==regOrigData.
139675 ** (3) Some output columns are omitted from the sort record due to
139676 ** the SQLITE_ENABLE_SORTER_REFERENCES optimization, or due to the
139677 ** SQLITE_ECEL_OMITREF optimization, or due to the
139678 ** SortCtx.pDeferredRowLoad optimiation. In any of these cases
139679 ** regOrigData is 0 to prevent this routine from trying to copy
139680 ** values that might not yet exist.
139681 */
@@ -152059,11 +152138,14 @@
152138 default:
152139 xMethod = pMod->xRelease;
152140 break;
152141 }
152142 if( xMethod && pVTab->iSavepoint>iSavepoint ){
152143 u64 savedFlags = (db->flags & SQLITE_Defensive);
152144 db->flags &= ~(u64)SQLITE_Defensive;
152145 rc = xMethod(pVTab->pVtab, iSavepoint);
152146 db->flags |= savedFlags;
152147 }
152148 sqlite3VtabUnlock(pVTab);
152149 }
152150 }
152151 }
@@ -153984,10 +154066,13 @@
154066 rc = WRC_Prune;
154067 reg = ++pWalker->pParse->nMem; /* Register for column value */
154068 reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg);
154069 pExpr->op = TK_REGISTER;
154070 pExpr->iTable = reg;
154071 }else if( pExpr->op==TK_TRUEFALSE ){
154072 /* Do not walk disabled expressions. tag-20230504-1 */
154073 return WRC_Prune;
154074 }
154075 return rc;
154076 }
154077
154078 /*
@@ -156951,11 +157036,11 @@
157036 if( op==TK_ISNULL
157037 && !ExprHasProperty(pExpr,EP_OuterON)
157038 && 0==sqlite3ExprCanBeNull(pLeft)
157039 ){
157040 assert( !ExprHasProperty(pExpr, EP_IntValue) );
157041 pExpr->op = TK_TRUEFALSE; /* See tag-20230504-1 */
157042 pExpr->u.zToken = "false";
157043 ExprSetProperty(pExpr, EP_IsFalse);
157044 pTerm->prereqAll = 0;
157045 pTerm->eOperator = 0;
157046 }
@@ -178633,11 +178718,11 @@
178718 if( pVfs==0 ) return 0;
178719
178720 /* This function works in milliseconds, but the underlying OsSleep()
178721 ** API uses microseconds. Hence the 1000's.
178722 */
178723 rc = (sqlite3OsSleep(pVfs, ms<0 ? 0 : 1000*ms)/1000);
178724 return rc;
178725 }
178726
178727 /*
178728 ** Enable or disable the extended result codes.
@@ -200613,21 +200698,20 @@
200698 switch( (u8)z[i] ){
200699 case '{': {
200700 /* Parse object */
200701 iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
200702 if( iThis<0 ) return -1;
200703 if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200704 pParse->iErr = i;
200705 return -1;
200706 }
200707 for(j=i+1;;j++){
 
 
 
 
200708 x = jsonParseValue(pParse, j);
200709 if( x<=0 ){
200710 if( x==(-2) ){
200711 j = pParse->iErr;
200712 if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1;
 
200713 break;
200714 }
200715 j += json5Whitespace(&z[j]);
200716 if( sqlite3JsonId1(z[j])
200717 || (z[j]=='\\' && z[j+1]=='u' && jsonIs4Hex(&z[j+2]))
@@ -200671,11 +200755,10 @@
200755 }
200756 j = pParse->iErr+1;
200757 }
200758 parse_object_value:
200759 x = jsonParseValue(pParse, j);
 
200760 if( x<=0 ){
200761 if( x!=(-1) ) pParse->iErr = j;
200762 return -1;
200763 }
200764 j = x;
@@ -200704,24 +200787,24 @@
200787 }
200788 pParse->iErr = j;
200789 return -1;
200790 }
200791 pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1;
200792 pParse->iDepth--;
200793 return j+1;
200794 }
200795 case '[': {
200796 /* Parse array */
200797 iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
200798 if( iThis<0 ) return -1;
200799 if( ++pParse->iDepth > JSON_MAX_DEPTH ){
200800 pParse->iErr = i;
200801 return -1;
200802 }
200803 memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
200804 for(j=i+1;;j++){
 
 
 
 
200805 x = jsonParseValue(pParse, j);
 
200806 if( x<=0 ){
200807 if( x==(-3) ){
200808 j = pParse->iErr;
200809 if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1;
200810 break;
@@ -200755,10 +200838,11 @@
200838 }
200839 pParse->iErr = j;
200840 return -1;
200841 }
200842 pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1;
200843 pParse->iDepth--;
200844 return j+1;
200845 }
200846 case '\'': {
200847 u8 jnFlags;
200848 char cDelim;
@@ -200804,18 +200888,10 @@
200888 j++;
200889 }
200890 jsonParseAddNode(pParse, JSON_STRING | (jnFlags<<8), j+1-i, &z[i]);
200891 return j+1;
200892 }
 
 
 
 
 
 
 
 
200893 case 't': {
200894 if( strncmp(z+i,"true",4)==0 && !sqlite3Isalnum(z[i+4]) ){
200895 jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
200896 return i+4;
200897 }
@@ -201012,10 +201088,17 @@
201088 goto json_parse_restart;
201089 }
201090 pParse->iErr = i;
201091 return -1;
201092 }
201093 case 'n': {
201094 if( strncmp(z+i,"null",4)==0 && !sqlite3Isalnum(z[i+4]) ){
201095 jsonParseAddNode(pParse, JSON_NULL, 0, 0);
201096 return i+4;
201097 }
201098 /* fall-through into the default case that checks for NaN */
201099 }
201100 default: {
201101 u32 k;
201102 int nn;
201103 c = z[i];
201104 for(k=0; k<sizeof(aNanInfName)/sizeof(aNanInfName[0]); k++){
@@ -202089,10 +202172,11 @@
202172 int argc,
202173 sqlite3_value **argv
202174 ){
202175 JsonParse *p; /* The parse */
202176 UNUSED_PARAMETER(argc);
202177 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
202178 p = jsonParseCached(ctx, argv, 0);
202179 if( p==0 || p->oom ){
202180 sqlite3_result_error_nomem(ctx);
202181 sqlite3_free(p);
202182 }else{
@@ -202134,10 +202218,11 @@
202218 int argc,
202219 sqlite3_value **argv
202220 ){
202221 JsonParse *p; /* The parse */
202222 UNUSED_PARAMETER(argc);
202223 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
202224 p = jsonParseCached(ctx, argv, 0);
202225 if( p==0 || p->oom ){
202226 sqlite3_result_error_nomem(ctx);
202227 sqlite3_free(p);
202228 }else if( p->nErr==0 ){
@@ -218806,19 +218891,19 @@
218891 }
218892 }else{
218893 int ii;
218894 u8 *pCsr = pC->aRecord;
218895 if( pTab->bRowid ){
218896 nNew += 9 + 1;
218897 pCsr += 9;
218898 }
218899 for(ii=pTab->bRowid; ii<pTab->nCol; ii++){
218900 int bChanged = 1;
218901 int nOld = 0;
218902 int eType;
218903 sqlite3_value *p = 0;
218904 pSession->hook.xNew(pSession->hook.pCtx, ii-pTab->bRowid, &p);
218905 if( p==0 ){
218906 return SQLITE_NOMEM;
218907 }
218908
218909 eType = *pCsr++;
@@ -219962,11 +220047,11 @@
220047 }
220048
220049 /* If at least one field has been modified, this is not a no-op. */
220050 if( bChanged ) bNoop = 0;
220051
220052 /* Add a field to the old.* record. This is omitted if this module is
220053 ** currently generating a patchset. */
220054 if( bPatchset==0 ){
220055 if( bChanged || abPK[i] ){
220056 sessionAppendBlob(pBuf, pCsr, nAdvance, &rc);
220057 }else{
@@ -220404,11 +220489,11 @@
220489 ){
220490 int rc;
220491
220492 if( pnChangeset==0 || ppChangeset==0 ) return SQLITE_MISUSE;
220493 rc = sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset, ppChangeset);
220494 assert( rc || pnChangeset==0
220495 || pSession->bEnableSize==0 || *pnChangeset<=pSession->nMaxChangesetSize
220496 );
220497 return rc;
220498 }
220499
@@ -224719,11 +224804,11 @@
224804 static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v);
224805 static int sqlite3Fts5GetVarintLen(u32 iVal);
224806 static u8 sqlite3Fts5GetVarint(const unsigned char*, u64*);
224807 static int sqlite3Fts5PutVarint(unsigned char *p, u64 v);
224808
224809 #define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&(b))
224810 #define fts5GetVarint sqlite3Fts5GetVarint
224811
224812 #define fts5FastGetVarint32(a, iOff, nVal) { \
224813 nVal = (a)[iOff++]; \
224814 if( nVal & 0x80 ){ \
@@ -228211,10 +228296,11 @@
228296 if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){
228297 *pzErr = sqlite3_mprintf("reserved fts5 table name: %s", pRet->zName);
228298 rc = SQLITE_ERROR;
228299 }
228300
228301 assert( (pRet->abUnindexed && pRet->azCol) || rc!=SQLITE_OK );
228302 for(i=3; rc==SQLITE_OK && i<nArg; i++){
228303 const char *zOrig = azArg[i];
228304 const char *z;
228305 char *zOne = 0;
228306 char *zTwo = 0;
@@ -233245,10 +233331,11 @@
233331 Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];
233332 if( i>=nData ){
233333 rc = FTS5_CORRUPT;
233334 break;
233335 }
233336 assert( pSeg!=0 );
233337 i += fts5GetVarint32(&pData[i], pSeg->iSegid);
233338 i += fts5GetVarint32(&pData[i], pSeg->pgnoFirst);
233339 i += fts5GetVarint32(&pData[i], pSeg->pgnoLast);
233340 if( pSeg->pgnoLast<pSeg->pgnoFirst ){
233341 rc = FTS5_CORRUPT;
@@ -242386,11 +242473,11 @@
242473 int nArg, /* Number of args */
242474 sqlite3_value **apUnused /* Function arguments */
242475 ){
242476 assert( nArg==0 );
242477 UNUSED_PARAM2(nArg, apUnused);
242478 sqlite3_result_text(pCtx, "fts5: 2023-05-05 14:16:31 fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315", -1, SQLITE_TRANSIENT);
242479 }
242480
242481 /*
242482 ** Return true if zName is the extension on one of the shadow tables used
242483 ** by this module.
242484
+29 -22
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.42.0"
150150
#define SQLITE_VERSION_NUMBER 3042000
151
-#define SQLITE_SOURCE_ID "2023-05-01 20:42:15 342af5b4fa0bd7c699e5497161db13d0cf795c7a5875ae30d666122e518f213b"
151
+#define SQLITE_SOURCE_ID "2023-05-05 14:16:31 fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -2140,32 +2140,32 @@
21402140
** configuration setting is never used, then the default maximum is determined
21412141
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
21422142
** compile-time option is not set, then the default maximum is 1073741824.
21432143
** </dl>
21442144
*/
2145
-#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2146
-#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2147
-#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2148
-#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2149
-#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2150
-#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2151
-#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2152
-#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2153
-#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2154
-#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2155
-#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2156
-/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2157
-#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2158
-#define SQLITE_CONFIG_PCACHE 14 /* no-op */
2159
-#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2160
-#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2161
-#define SQLITE_CONFIG_URI 17 /* int */
2162
-#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2163
-#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2145
+#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2146
+#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2147
+#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2148
+#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2149
+#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2150
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2151
+#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2152
+#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2153
+#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2154
+#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2155
+#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2156
+/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2157
+#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2158
+#define SQLITE_CONFIG_PCACHE 14 /* no-op */
2159
+#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2160
+#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2161
+#define SQLITE_CONFIG_URI 17 /* int */
2162
+#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2163
+#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
21642164
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2165
-#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2166
-#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2165
+#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2166
+#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
21672167
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
21682168
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
21692169
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
21702170
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
21712171
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -6253,10 +6253,17 @@
62536253
** ^SQLite implements this interface by calling the xSleep()
62546254
** method of the default [sqlite3_vfs] object. If the xSleep() method
62556255
** of the default VFS is not implemented correctly, or not implemented at
62566256
** all, then the behavior of sqlite3_sleep() may deviate from the description
62576257
** in the previous paragraphs.
6258
+**
6259
+** If a negative argument is passed to sqlite3_sleep() the results vary by
6260
+** VFS and operating system. Some system treat a negative argument as an
6261
+** instruction to sleep forever. Others understand it to mean do not sleep
6262
+** at all. ^In SQLite version 3.42.0 and later, a negative
6263
+** argument passed into sqlite3_sleep() is changed to zero before it is relayed
6264
+** down into the xSleep method of the VFS.
62586265
*/
62596266
SQLITE_API int sqlite3_sleep(int);
62606267
62616268
/*
62626269
** CAPI3REF: Name Of The Folder Holding Temporary Files
62636270
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.42.0"
150 #define SQLITE_VERSION_NUMBER 3042000
151 #define SQLITE_SOURCE_ID "2023-05-01 20:42:15 342af5b4fa0bd7c699e5497161db13d0cf795c7a5875ae30d666122e518f213b"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -2140,32 +2140,32 @@
2140 ** configuration setting is never used, then the default maximum is determined
2141 ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2142 ** compile-time option is not set, then the default maximum is 1073741824.
2143 ** </dl>
2144 */
2145 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2146 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2147 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2148 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2149 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2150 #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2151 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2152 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2153 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2154 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2155 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2156 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2157 #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2158 #define SQLITE_CONFIG_PCACHE 14 /* no-op */
2159 #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2160 #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2161 #define SQLITE_CONFIG_URI 17 /* int */
2162 #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2163 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2164 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2165 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2166 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2167 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
2168 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
2169 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
2170 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
2171 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -6253,10 +6253,17 @@
6253 ** ^SQLite implements this interface by calling the xSleep()
6254 ** method of the default [sqlite3_vfs] object. If the xSleep() method
6255 ** of the default VFS is not implemented correctly, or not implemented at
6256 ** all, then the behavior of sqlite3_sleep() may deviate from the description
6257 ** in the previous paragraphs.
 
 
 
 
 
 
 
6258 */
6259 SQLITE_API int sqlite3_sleep(int);
6260
6261 /*
6262 ** CAPI3REF: Name Of The Folder Holding Temporary Files
6263
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.42.0"
150 #define SQLITE_VERSION_NUMBER 3042000
151 #define SQLITE_SOURCE_ID "2023-05-05 14:16:31 fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -2140,32 +2140,32 @@
2140 ** configuration setting is never used, then the default maximum is determined
2141 ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2142 ** compile-time option is not set, then the default maximum is 1073741824.
2143 ** </dl>
2144 */
2145 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2146 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2147 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2148 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2149 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2150 #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2151 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2152 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2153 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2154 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2155 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2156 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2157 #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2158 #define SQLITE_CONFIG_PCACHE 14 /* no-op */
2159 #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2160 #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2161 #define SQLITE_CONFIG_URI 17 /* int */
2162 #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2163 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2164 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2165 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2166 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2167 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
2168 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
2169 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
2170 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
2171 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -6253,10 +6253,17 @@
6253 ** ^SQLite implements this interface by calling the xSleep()
6254 ** method of the default [sqlite3_vfs] object. If the xSleep() method
6255 ** of the default VFS is not implemented correctly, or not implemented at
6256 ** all, then the behavior of sqlite3_sleep() may deviate from the description
6257 ** in the previous paragraphs.
6258 **
6259 ** If a negative argument is passed to sqlite3_sleep() the results vary by
6260 ** VFS and operating system. Some system treat a negative argument as an
6261 ** instruction to sleep forever. Others understand it to mean do not sleep
6262 ** at all. ^In SQLite version 3.42.0 and later, a negative
6263 ** argument passed into sqlite3_sleep() is changed to zero before it is relayed
6264 ** down into the xSleep method of the VFS.
6265 */
6266 SQLITE_API int sqlite3_sleep(int);
6267
6268 /*
6269 ** CAPI3REF: Name Of The Folder Holding Temporary Files
6270

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button