Fossil SCM

Update the built-in SQLite to version 3.42.0.

drh 2023-05-16 12:49 trunk
Commit b2d5aa8a76fd7cf28089acbea883d4a9af4e277213ed2acf5948c7fe5625e5f5
+48 -14
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -621,10 +621,14 @@
621621
UINT outCodePage; /* Output code page upon shell start */
622622
HANDLE hConsoleIn; /* Console input handle */
623623
DWORD consoleMode; /* Console mode upon shell start */
624624
} conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
625625
626
+#ifndef _O_U16TEXT /* For build environments lacking this constant: */
627
+# define _O_U16TEXT 0x20000
628
+#endif
629
+
626630
/*
627631
** Prepare console, (if known to be a WIN32 console), for UTF-8
628632
** input (from either typing or suitable paste operations) and for
629633
** UTF-8 rendering. This may "fail" with a message to stderr, where
630634
** the preparation is not done and common "code page" issues occur.
@@ -4415,11 +4419,21 @@
44154419
sqlite3_int64 smStep,
44164420
sqlite3_uint64 ix){
44174421
if( ix>=(sqlite3_uint64)LLONG_MAX ){
44184422
/* Get ix into signed i64 range. */
44194423
ix -= (sqlite3_uint64)LLONG_MAX;
4420
- smBase += LLONG_MAX * smStep;
4424
+ /* With 2's complement ALU, this next can be 1 step, but is split into
4425
+ * 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */
4426
+ smBase += (LLONG_MAX/2) * smStep;
4427
+ smBase += (LLONG_MAX - LLONG_MAX/2) * smStep;
4428
+ }
4429
+ /* Under UBSAN (or on 1's complement machines), must do this last term
4430
+ * in steps to avoid the dreaded (and harmless) signed multiply overlow. */
4431
+ if( ix>=2 ){
4432
+ sqlite3_int64 ix2 = (sqlite3_int64)ix/2;
4433
+ smBase += ix2*smStep;
4434
+ ix -= ix2;
44214435
}
44224436
return smBase + ((sqlite3_int64)ix)*smStep;
44234437
}
44244438
44254439
/* typedef unsigned char u8; */
@@ -4438,25 +4452,45 @@
44384452
/*
44394453
** Prepare a SequenceSpec for use in generating an integer series
44404454
** given initialized iBase, iTerm and iStep values. Sequence is
44414455
** initialized per given isReversing. Other members are computed.
44424456
*/
4443
-void setupSequence( SequenceSpec *pss ){
4457
+static void setupSequence( SequenceSpec *pss ){
4458
+ int bSameSigns;
44444459
pss->uSeqIndexMax = 0;
44454460
pss->isNotEOF = 0;
4461
+ bSameSigns = (pss->iBase < 0)==(pss->iTerm < 0);
44464462
if( pss->iTerm < pss->iBase ){
4447
- sqlite3_uint64 nuspan = (sqlite3_uint64)(pss->iBase-pss->iTerm);
4463
+ sqlite3_uint64 nuspan = 0;
4464
+ if( bSameSigns ){
4465
+ nuspan = (sqlite3_uint64)(pss->iBase - pss->iTerm);
4466
+ }else{
4467
+ /* Under UBSAN (or on 1's complement machines), must do this in steps.
4468
+ * In this clause, iBase>=0 and iTerm<0 . */
4469
+ nuspan = 1;
4470
+ nuspan += pss->iBase;
4471
+ nuspan += -(pss->iTerm+1);
4472
+ }
44484473
if( pss->iStep<0 ){
44494474
pss->isNotEOF = 1;
44504475
if( nuspan==ULONG_MAX ){
44514476
pss->uSeqIndexMax = ( pss->iStep>LLONG_MIN )? nuspan/-pss->iStep : 1;
44524477
}else if( pss->iStep>LLONG_MIN ){
44534478
pss->uSeqIndexMax = nuspan/-pss->iStep;
44544479
}
44554480
}
44564481
}else if( pss->iTerm > pss->iBase ){
4457
- sqlite3_uint64 puspan = (sqlite3_uint64)(pss->iTerm-pss->iBase);
4482
+ sqlite3_uint64 puspan = 0;
4483
+ if( bSameSigns ){
4484
+ puspan = (sqlite3_uint64)(pss->iTerm - pss->iBase);
4485
+ }else{
4486
+ /* Under UBSAN (or on 1's complement machines), must do this in steps.
4487
+ * In this clause, iTerm>=0 and iBase<0 . */
4488
+ puspan = 1;
4489
+ puspan += pss->iTerm;
4490
+ puspan += -(pss->iBase+1);
4491
+ }
44584492
if( pss->iStep>0 ){
44594493
pss->isNotEOF = 1;
44604494
pss->uSeqIndexMax = puspan/pss->iStep;
44614495
}
44624496
}else if( pss->iTerm == pss->iBase ){
@@ -4472,11 +4506,11 @@
44724506
/*
44734507
** Progress sequence generator to yield next value, if any.
44744508
** Leave its state to either yield next value or be at EOF.
44754509
** Return whether there is a next value, or 0 at EOF.
44764510
*/
4477
-int progressSequence( SequenceSpec *pss ){
4511
+static int progressSequence( SequenceSpec *pss ){
44784512
if( !pss->isNotEOF ) return 0;
44794513
if( pss->isReversing ){
44804514
if( pss->uSeqIndexNow > 0 ){
44814515
pss->uSeqIndexNow--;
44824516
pss->iValueNow -= pss->iStep;
@@ -4607,17 +4641,17 @@
46074641
sqlite3_result_int64(ctx, x);
46084642
return SQLITE_OK;
46094643
}
46104644
46114645
/*
4612
-** Return the rowid for the current row. In this implementation, the
4613
-** first row returned is assigned rowid value 1, and each subsequent
4614
-** row a value 1 more than that of the previous.
4646
+** Return the rowid for the current row, logically equivalent to n+1 where
4647
+** "n" is the ascending integer in the aforesaid production definition.
46154648
*/
46164649
static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
46174650
series_cursor *pCur = (series_cursor*)cur;
4618
- *pRowid = ((sqlite3_int64)pCur->ss.uSeqIndexNow + 1);
4651
+ sqlite3_uint64 n = pCur->ss.uSeqIndexNow;
4652
+ *pRowid = (sqlite3_int64)((n<0xffffffffffffffff)? n+1 : 0);
46194653
return SQLITE_OK;
46204654
}
46214655
46224656
/*
46234657
** Return TRUE if the cursor has been moved off of the last
@@ -5454,11 +5488,11 @@
54545488
re_append(p, RE_OP_FORK, -sz);
54555489
}
54565490
break;
54575491
}
54585492
case '[': {
5459
- int iFirst = p->nState;
5493
+ unsigned int iFirst = p->nState;
54605494
if( rePeek(p)=='^' ){
54615495
re_append(p, RE_OP_CC_EXC, 0);
54625496
p->sIn.i++;
54635497
}else{
54645498
re_append(p, RE_OP_CC_INC, 0);
@@ -5478,11 +5512,11 @@
54785512
re_append(p, RE_OP_CC_VALUE, c);
54795513
}
54805514
if( rePeek(p)==']' ){ p->sIn.i++; break; }
54815515
}
54825516
if( c==0 ) return "unclosed '['";
5483
- p->aArg[iFirst] = p->nState - iFirst;
5517
+ if( p->nState>iFirst ) p->aArg[iFirst] = p->nState - iFirst;
54845518
break;
54855519
}
54865520
case '\\': {
54875521
int specialOp = 0;
54885522
switch( rePeek(p) ){
@@ -12802,10 +12836,11 @@
1280212836
#endif
1280312837
1280412838
#endif /* ifndef _SQLITE_RECOVER_H */
1280512839
1280612840
/************************* End ../ext/recover/sqlite3recover.h ********************/
12841
+# ifndef SQLITE_HAVE_SQLITE3R
1280712842
/************************* Begin ../ext/recover/dbdata.c ******************/
1280812843
/*
1280912844
** 2019-04-17
1281012845
**
1281112846
** The author disclaims copyright to this source code. In place of
@@ -16632,10 +16667,11 @@
1663216667
}
1663316668
1663416669
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
1663516670
1663616671
/************************* End ../ext/recover/sqlite3recover.c ********************/
16672
+# endif /* SQLITE_HAVE_SQLITE3R */
1663716673
#endif
1663816674
#ifdef SQLITE_SHELL_EXTSRC
1663916675
# include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
1664016676
#endif
1664116677
@@ -17057,10 +17093,11 @@
1705717093
if( hasCRNL ){
1705817094
/* If the original contains \r\n then do no conversions back to \n */
1705917095
}else{
1706017096
/* If the file did not originally contain \r\n then convert any new
1706117097
** \r\n back into \n */
17098
+ p[sz] = 0;
1706217099
for(i=j=0; i<sz; i++){
1706317100
if( p[i]=='\r' && p[i+1]=='\n' ) i++;
1706417101
p[j++] = p[i];
1706517102
}
1706617103
sz = j;
@@ -20701,13 +20738,10 @@
2070120738
sqlite3_base64_init(p->db, 0, 0);
2070220739
sqlite3_base85_init(p->db, 0, 0);
2070320740
sqlite3_regexp_init(p->db, 0, 0);
2070420741
sqlite3_ieee_init(p->db, 0, 0);
2070520742
sqlite3_series_init(p->db, 0, 0);
20706
-#if SQLITE_SHELL_HAVE_RECOVER
20707
- sqlite3_dbdata_init(p->db, 0, 0);
20708
-#endif
2070920743
#ifndef SQLITE_SHELL_FIDDLE
2071020744
sqlite3_fileio_init(p->db, 0, 0);
2071120745
sqlite3_completion_init(p->db, 0, 0);
2071220746
#endif
2071320747
#ifdef SQLITE_HAVE_ZLIB
2071420748
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -621,10 +621,14 @@
621 UINT outCodePage; /* Output code page upon shell start */
622 HANDLE hConsoleIn; /* Console input handle */
623 DWORD consoleMode; /* Console mode upon shell start */
624 } conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
625
 
 
 
 
626 /*
627 ** Prepare console, (if known to be a WIN32 console), for UTF-8
628 ** input (from either typing or suitable paste operations) and for
629 ** UTF-8 rendering. This may "fail" with a message to stderr, where
630 ** the preparation is not done and common "code page" issues occur.
@@ -4415,11 +4419,21 @@
4415 sqlite3_int64 smStep,
4416 sqlite3_uint64 ix){
4417 if( ix>=(sqlite3_uint64)LLONG_MAX ){
4418 /* Get ix into signed i64 range. */
4419 ix -= (sqlite3_uint64)LLONG_MAX;
4420 smBase += LLONG_MAX * smStep;
 
 
 
 
 
 
 
 
 
 
4421 }
4422 return smBase + ((sqlite3_int64)ix)*smStep;
4423 }
4424
4425 /* typedef unsigned char u8; */
@@ -4438,25 +4452,45 @@
4438 /*
4439 ** Prepare a SequenceSpec for use in generating an integer series
4440 ** given initialized iBase, iTerm and iStep values. Sequence is
4441 ** initialized per given isReversing. Other members are computed.
4442 */
4443 void setupSequence( SequenceSpec *pss ){
 
4444 pss->uSeqIndexMax = 0;
4445 pss->isNotEOF = 0;
 
4446 if( pss->iTerm < pss->iBase ){
4447 sqlite3_uint64 nuspan = (sqlite3_uint64)(pss->iBase-pss->iTerm);
 
 
 
 
 
 
 
 
 
4448 if( pss->iStep<0 ){
4449 pss->isNotEOF = 1;
4450 if( nuspan==ULONG_MAX ){
4451 pss->uSeqIndexMax = ( pss->iStep>LLONG_MIN )? nuspan/-pss->iStep : 1;
4452 }else if( pss->iStep>LLONG_MIN ){
4453 pss->uSeqIndexMax = nuspan/-pss->iStep;
4454 }
4455 }
4456 }else if( pss->iTerm > pss->iBase ){
4457 sqlite3_uint64 puspan = (sqlite3_uint64)(pss->iTerm-pss->iBase);
 
 
 
 
 
 
 
 
 
4458 if( pss->iStep>0 ){
4459 pss->isNotEOF = 1;
4460 pss->uSeqIndexMax = puspan/pss->iStep;
4461 }
4462 }else if( pss->iTerm == pss->iBase ){
@@ -4472,11 +4506,11 @@
4472 /*
4473 ** Progress sequence generator to yield next value, if any.
4474 ** Leave its state to either yield next value or be at EOF.
4475 ** Return whether there is a next value, or 0 at EOF.
4476 */
4477 int progressSequence( SequenceSpec *pss ){
4478 if( !pss->isNotEOF ) return 0;
4479 if( pss->isReversing ){
4480 if( pss->uSeqIndexNow > 0 ){
4481 pss->uSeqIndexNow--;
4482 pss->iValueNow -= pss->iStep;
@@ -4607,17 +4641,17 @@
4607 sqlite3_result_int64(ctx, x);
4608 return SQLITE_OK;
4609 }
4610
4611 /*
4612 ** Return the rowid for the current row. In this implementation, the
4613 ** first row returned is assigned rowid value 1, and each subsequent
4614 ** row a value 1 more than that of the previous.
4615 */
4616 static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
4617 series_cursor *pCur = (series_cursor*)cur;
4618 *pRowid = ((sqlite3_int64)pCur->ss.uSeqIndexNow + 1);
 
4619 return SQLITE_OK;
4620 }
4621
4622 /*
4623 ** Return TRUE if the cursor has been moved off of the last
@@ -5454,11 +5488,11 @@
5454 re_append(p, RE_OP_FORK, -sz);
5455 }
5456 break;
5457 }
5458 case '[': {
5459 int iFirst = p->nState;
5460 if( rePeek(p)=='^' ){
5461 re_append(p, RE_OP_CC_EXC, 0);
5462 p->sIn.i++;
5463 }else{
5464 re_append(p, RE_OP_CC_INC, 0);
@@ -5478,11 +5512,11 @@
5478 re_append(p, RE_OP_CC_VALUE, c);
5479 }
5480 if( rePeek(p)==']' ){ p->sIn.i++; break; }
5481 }
5482 if( c==0 ) return "unclosed '['";
5483 p->aArg[iFirst] = p->nState - iFirst;
5484 break;
5485 }
5486 case '\\': {
5487 int specialOp = 0;
5488 switch( rePeek(p) ){
@@ -12802,10 +12836,11 @@
12802 #endif
12803
12804 #endif /* ifndef _SQLITE_RECOVER_H */
12805
12806 /************************* End ../ext/recover/sqlite3recover.h ********************/
 
12807 /************************* Begin ../ext/recover/dbdata.c ******************/
12808 /*
12809 ** 2019-04-17
12810 **
12811 ** The author disclaims copyright to this source code. In place of
@@ -16632,10 +16667,11 @@
16632 }
16633
16634 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
16635
16636 /************************* End ../ext/recover/sqlite3recover.c ********************/
 
16637 #endif
16638 #ifdef SQLITE_SHELL_EXTSRC
16639 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
16640 #endif
16641
@@ -17057,10 +17093,11 @@
17057 if( hasCRNL ){
17058 /* If the original contains \r\n then do no conversions back to \n */
17059 }else{
17060 /* If the file did not originally contain \r\n then convert any new
17061 ** \r\n back into \n */
 
17062 for(i=j=0; i<sz; i++){
17063 if( p[i]=='\r' && p[i+1]=='\n' ) i++;
17064 p[j++] = p[i];
17065 }
17066 sz = j;
@@ -20701,13 +20738,10 @@
20701 sqlite3_base64_init(p->db, 0, 0);
20702 sqlite3_base85_init(p->db, 0, 0);
20703 sqlite3_regexp_init(p->db, 0, 0);
20704 sqlite3_ieee_init(p->db, 0, 0);
20705 sqlite3_series_init(p->db, 0, 0);
20706 #if SQLITE_SHELL_HAVE_RECOVER
20707 sqlite3_dbdata_init(p->db, 0, 0);
20708 #endif
20709 #ifndef SQLITE_SHELL_FIDDLE
20710 sqlite3_fileio_init(p->db, 0, 0);
20711 sqlite3_completion_init(p->db, 0, 0);
20712 #endif
20713 #ifdef SQLITE_HAVE_ZLIB
20714
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -621,10 +621,14 @@
621 UINT outCodePage; /* Output code page upon shell start */
622 HANDLE hConsoleIn; /* Console input handle */
623 DWORD consoleMode; /* Console mode upon shell start */
624 } conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
625
626 #ifndef _O_U16TEXT /* For build environments lacking this constant: */
627 # define _O_U16TEXT 0x20000
628 #endif
629
630 /*
631 ** Prepare console, (if known to be a WIN32 console), for UTF-8
632 ** input (from either typing or suitable paste operations) and for
633 ** UTF-8 rendering. This may "fail" with a message to stderr, where
634 ** the preparation is not done and common "code page" issues occur.
@@ -4415,11 +4419,21 @@
4419 sqlite3_int64 smStep,
4420 sqlite3_uint64 ix){
4421 if( ix>=(sqlite3_uint64)LLONG_MAX ){
4422 /* Get ix into signed i64 range. */
4423 ix -= (sqlite3_uint64)LLONG_MAX;
4424 /* With 2's complement ALU, this next can be 1 step, but is split into
4425 * 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */
4426 smBase += (LLONG_MAX/2) * smStep;
4427 smBase += (LLONG_MAX - LLONG_MAX/2) * smStep;
4428 }
4429 /* Under UBSAN (or on 1's complement machines), must do this last term
4430 * in steps to avoid the dreaded (and harmless) signed multiply overlow. */
4431 if( ix>=2 ){
4432 sqlite3_int64 ix2 = (sqlite3_int64)ix/2;
4433 smBase += ix2*smStep;
4434 ix -= ix2;
4435 }
4436 return smBase + ((sqlite3_int64)ix)*smStep;
4437 }
4438
4439 /* typedef unsigned char u8; */
@@ -4438,25 +4452,45 @@
4452 /*
4453 ** Prepare a SequenceSpec for use in generating an integer series
4454 ** given initialized iBase, iTerm and iStep values. Sequence is
4455 ** initialized per given isReversing. Other members are computed.
4456 */
4457 static void setupSequence( SequenceSpec *pss ){
4458 int bSameSigns;
4459 pss->uSeqIndexMax = 0;
4460 pss->isNotEOF = 0;
4461 bSameSigns = (pss->iBase < 0)==(pss->iTerm < 0);
4462 if( pss->iTerm < pss->iBase ){
4463 sqlite3_uint64 nuspan = 0;
4464 if( bSameSigns ){
4465 nuspan = (sqlite3_uint64)(pss->iBase - pss->iTerm);
4466 }else{
4467 /* Under UBSAN (or on 1's complement machines), must do this in steps.
4468 * In this clause, iBase>=0 and iTerm<0 . */
4469 nuspan = 1;
4470 nuspan += pss->iBase;
4471 nuspan += -(pss->iTerm+1);
4472 }
4473 if( pss->iStep<0 ){
4474 pss->isNotEOF = 1;
4475 if( nuspan==ULONG_MAX ){
4476 pss->uSeqIndexMax = ( pss->iStep>LLONG_MIN )? nuspan/-pss->iStep : 1;
4477 }else if( pss->iStep>LLONG_MIN ){
4478 pss->uSeqIndexMax = nuspan/-pss->iStep;
4479 }
4480 }
4481 }else if( pss->iTerm > pss->iBase ){
4482 sqlite3_uint64 puspan = 0;
4483 if( bSameSigns ){
4484 puspan = (sqlite3_uint64)(pss->iTerm - pss->iBase);
4485 }else{
4486 /* Under UBSAN (or on 1's complement machines), must do this in steps.
4487 * In this clause, iTerm>=0 and iBase<0 . */
4488 puspan = 1;
4489 puspan += pss->iTerm;
4490 puspan += -(pss->iBase+1);
4491 }
4492 if( pss->iStep>0 ){
4493 pss->isNotEOF = 1;
4494 pss->uSeqIndexMax = puspan/pss->iStep;
4495 }
4496 }else if( pss->iTerm == pss->iBase ){
@@ -4472,11 +4506,11 @@
4506 /*
4507 ** Progress sequence generator to yield next value, if any.
4508 ** Leave its state to either yield next value or be at EOF.
4509 ** Return whether there is a next value, or 0 at EOF.
4510 */
4511 static int progressSequence( SequenceSpec *pss ){
4512 if( !pss->isNotEOF ) return 0;
4513 if( pss->isReversing ){
4514 if( pss->uSeqIndexNow > 0 ){
4515 pss->uSeqIndexNow--;
4516 pss->iValueNow -= pss->iStep;
@@ -4607,17 +4641,17 @@
4641 sqlite3_result_int64(ctx, x);
4642 return SQLITE_OK;
4643 }
4644
4645 /*
4646 ** Return the rowid for the current row, logically equivalent to n+1 where
4647 ** "n" is the ascending integer in the aforesaid production definition.
 
4648 */
4649 static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
4650 series_cursor *pCur = (series_cursor*)cur;
4651 sqlite3_uint64 n = pCur->ss.uSeqIndexNow;
4652 *pRowid = (sqlite3_int64)((n<0xffffffffffffffff)? n+1 : 0);
4653 return SQLITE_OK;
4654 }
4655
4656 /*
4657 ** Return TRUE if the cursor has been moved off of the last
@@ -5454,11 +5488,11 @@
5488 re_append(p, RE_OP_FORK, -sz);
5489 }
5490 break;
5491 }
5492 case '[': {
5493 unsigned int iFirst = p->nState;
5494 if( rePeek(p)=='^' ){
5495 re_append(p, RE_OP_CC_EXC, 0);
5496 p->sIn.i++;
5497 }else{
5498 re_append(p, RE_OP_CC_INC, 0);
@@ -5478,11 +5512,11 @@
5512 re_append(p, RE_OP_CC_VALUE, c);
5513 }
5514 if( rePeek(p)==']' ){ p->sIn.i++; break; }
5515 }
5516 if( c==0 ) return "unclosed '['";
5517 if( p->nState>iFirst ) p->aArg[iFirst] = p->nState - iFirst;
5518 break;
5519 }
5520 case '\\': {
5521 int specialOp = 0;
5522 switch( rePeek(p) ){
@@ -12802,10 +12836,11 @@
12836 #endif
12837
12838 #endif /* ifndef _SQLITE_RECOVER_H */
12839
12840 /************************* End ../ext/recover/sqlite3recover.h ********************/
12841 # ifndef SQLITE_HAVE_SQLITE3R
12842 /************************* Begin ../ext/recover/dbdata.c ******************/
12843 /*
12844 ** 2019-04-17
12845 **
12846 ** The author disclaims copyright to this source code. In place of
@@ -16632,10 +16667,11 @@
16667 }
16668
16669 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
16670
16671 /************************* End ../ext/recover/sqlite3recover.c ********************/
16672 # endif /* SQLITE_HAVE_SQLITE3R */
16673 #endif
16674 #ifdef SQLITE_SHELL_EXTSRC
16675 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
16676 #endif
16677
@@ -17057,10 +17093,11 @@
17093 if( hasCRNL ){
17094 /* If the original contains \r\n then do no conversions back to \n */
17095 }else{
17096 /* If the file did not originally contain \r\n then convert any new
17097 ** \r\n back into \n */
17098 p[sz] = 0;
17099 for(i=j=0; i<sz; i++){
17100 if( p[i]=='\r' && p[i+1]=='\n' ) i++;
17101 p[j++] = p[i];
17102 }
17103 sz = j;
@@ -20701,13 +20738,10 @@
20738 sqlite3_base64_init(p->db, 0, 0);
20739 sqlite3_base85_init(p->db, 0, 0);
20740 sqlite3_regexp_init(p->db, 0, 0);
20741 sqlite3_ieee_init(p->db, 0, 0);
20742 sqlite3_series_init(p->db, 0, 0);
 
 
 
20743 #ifndef SQLITE_SHELL_FIDDLE
20744 sqlite3_fileio_init(p->db, 0, 0);
20745 sqlite3_completion_init(p->db, 0, 0);
20746 #endif
20747 #ifdef SQLITE_HAVE_ZLIB
20748
+121 -33
--- 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-12 10:52:12 469718f106e1cfa7f8f4714a9e743108c361af81e0258061c2b76880a7c352ae"
461
+#define SQLITE_SOURCE_ID "2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0"
462462
463463
/*
464464
** CAPI3REF: Run-Time Library Version Numbers
465465
** KEYWORDS: sqlite3_version sqlite3_sourceid
466466
**
@@ -8197,13 +8197,13 @@
81978197
** ^The sqlite3_mutex_leave() routine exits a mutex that was
81988198
** previously entered by the same thread. The behavior
81998199
** is undefined if the mutex is not currently entered by the
82008200
** calling thread or is not currently allocated.
82018201
**
8202
-** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
8203
-** sqlite3_mutex_leave() is a NULL pointer, then all three routines
8204
-** behave as no-ops.
8202
+** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
8203
+** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
8204
+** then any of the four routines behaves as a no-op.
82058205
**
82068206
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
82078207
*/
82088208
SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
82098209
SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
@@ -20506,11 +20506,11 @@
2050620506
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
2050720507
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
2050820508
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
2050920509
SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
2051020510
SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
20511
-SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcItem*);
20511
+SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int);
2051220512
#ifdef SQLITE_ENABLE_CURSOR_HINTS
2051320513
SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
2051420514
#endif
2051520515
SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*);
2051620516
SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
@@ -68240,11 +68240,11 @@
6824068240
** Legal values for BtCursor.curFlags
6824168241
*/
6824268242
#define BTCF_WriteFlag 0x01 /* True if a write cursor */
6824368243
#define BTCF_ValidNKey 0x02 /* True if info.nKey is valid */
6824468244
#define BTCF_ValidOvfl 0x04 /* True if aOverflow is valid */
68245
-#define BTCF_AtLast 0x08 /* Cursor is pointing ot the last entry */
68245
+#define BTCF_AtLast 0x08 /* Cursor is pointing to the last entry */
6824668246
#define BTCF_Incrblob 0x10 /* True if an incremental I/O handle */
6824768247
#define BTCF_Multiple 0x20 /* Maybe another cursor on the same btree */
6824868248
#define BTCF_Pinned 0x40 /* Cursor is busy and cannot be moved */
6824968249
6825068250
/*
@@ -108615,14 +108615,15 @@
108615108615
SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
108616108616
return exprIsConst(p, 3, iCur);
108617108617
}
108618108618
108619108619
/*
108620
-** Check pExpr to see if it is an constraint on the single data source pSrc.
108621
-** In other words, check to see if pExpr constrains pSrc but does not depend
108622
-** on any other tables or data sources anywhere else in the query. Return
108623
-** true (non-zero) if pExpr is a constraint on pSrc only.
108620
+** Check pExpr to see if it is an constraint on the single data source
108621
+** pSrc = &pSrcList->a[iSrc]. In other words, check to see if pExpr
108622
+** constrains pSrc but does not depend on any other tables or data
108623
+** sources anywhere else in the query. Return true (non-zero) if pExpr
108624
+** is a constraint on pSrc only.
108624108625
**
108625108626
** This is an optimization. False negatives will perhaps cause slower
108626108627
** queries, but false positives will yield incorrect answers. So when in
108627108628
** doubt, return 0.
108628108629
**
@@ -108635,25 +108636,56 @@
108635108636
** (3) pSrc cannot be part of the left operand for a RIGHT JOIN.
108636108637
** (Is there some way to relax this constraint?)
108637108638
**
108638108639
** (4) If pSrc is the right operand of a LEFT JOIN, then...
108639108640
** (4a) pExpr must come from an ON clause..
108640
- (4b) and specifically the ON clause associated with the LEFT JOIN.
108641
+** (4b) and specifically the ON clause associated with the LEFT JOIN.
108641108642
**
108642108643
** (5) If pSrc is not the right operand of a LEFT JOIN or the left
108643108644
** operand of a RIGHT JOIN, then pExpr must be from the WHERE
108644108645
** clause, not an ON clause.
108646
+**
108647
+** (6) Either:
108648
+**
108649
+** (6a) pExpr does not originate in an ON or USING clause, or
108650
+**
108651
+** (6b) The ON or USING clause from which pExpr is derived is
108652
+** not to the left of a RIGHT JOIN (or FULL JOIN).
108653
+**
108654
+** Without this restriction, accepting pExpr as a single-table
108655
+** constraint might move the the ON/USING filter expression
108656
+** from the left side of a RIGHT JOIN over to the right side,
108657
+** which leads to incorrect answers. See also restriction (9)
108658
+** on push-down.
108645108659
*/
108646
-SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr *pExpr, const SrcItem *pSrc){
108660
+SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(
108661
+ Expr *pExpr, /* The constraint */
108662
+ const SrcList *pSrcList, /* Complete FROM clause */
108663
+ int iSrc /* Which element of pSrcList to use */
108664
+){
108665
+ const SrcItem *pSrc = &pSrcList->a[iSrc];
108647108666
if( pSrc->fg.jointype & JT_LTORJ ){
108648108667
return 0; /* rule (3) */
108649108668
}
108650108669
if( pSrc->fg.jointype & JT_LEFT ){
108651108670
if( !ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (4a) */
108652108671
if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */
108653108672
}else{
108654108673
if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (5) */
108674
+ }
108675
+ if( ExprHasProperty(pExpr, EP_OuterON|EP_InnerON) /* (6a) */
108676
+ && (pSrcList->a[0].fg.jointype & JT_LTORJ)!=0 /* Fast pre-test of (6b) */
108677
+ ){
108678
+ int jj;
108679
+ for(jj=0; jj<iSrc; jj++){
108680
+ if( pExpr->w.iJoin==pSrcList->a[jj].iCursor ){
108681
+ if( (pSrcList->a[jj].fg.jointype & JT_LTORJ)!=0 ){
108682
+ return 0; /* restriction (6) */
108683
+ }
108684
+ break;
108685
+ }
108686
+ }
108655108687
}
108656108688
return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
108657108689
}
108658108690
108659108691
@@ -144080,11 +144112,12 @@
144080144112
** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING
144081144113
** clause and the subquery.
144082144114
**
144083144115
** Without this restriction, the push-down optimization might move
144084144116
** the ON/USING filter expression from the left side of a RIGHT JOIN
144085
-** over to the right side, which leads to incorrect answers.
144117
+** over to the right side, which leads to incorrect answers. See
144118
+** also restriction (6) in sqlite3ExprIsSingleTableConstraint().
144086144119
**
144087144120
** (10) The inner query is not the right-hand table of a RIGHT JOIN.
144088144121
**
144089144122
** (11) The subquery is not a VALUES clause
144090144123
**
@@ -144165,10 +144198,11 @@
144165144198
while( pWhere->op==TK_AND ){
144166144199
nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrcList, iSrc);
144167144200
pWhere = pWhere->pLeft;
144168144201
}
144169144202
144203
+#if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
144170144204
if( ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) /* (9a) */
144171144205
&& (pSrcList->a[0].fg.jointype & JT_LTORJ)!=0 /* Fast pre-test of (9c) */
144172144206
){
144173144207
int jj;
144174144208
for(jj=0; jj<iSrc; jj++){
@@ -144182,12 +144216,10 @@
144182144216
}
144183144217
}
144184144218
}
144185144219
}
144186144220
}
144187
-
144188
-#if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
144189144221
if( isLeftJoin
144190144222
&& (ExprHasProperty(pWhere,EP_OuterON)==0
144191144223
|| pWhere->w.iJoin!=iCursor)
144192144224
){
144193144225
return 0; /* restriction (4) */
@@ -144197,11 +144229,11 @@
144197144229
){
144198144230
return 0; /* restriction (5) */
144199144231
}
144200144232
#endif
144201144233
144202
- if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrc) ){
144234
+ if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){
144203144235
nChng++;
144204144236
pSubq->selFlags |= SF_PushDown;
144205144237
while( pSubq ){
144206144238
SubstContext x;
144207144239
pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
@@ -158617,12 +158649,11 @@
158617158649
** and to set up the WhereLevel object pLevel so that the code generator
158618158650
** makes use of the automatic index.
158619158651
*/
158620158652
static SQLITE_NOINLINE void constructAutomaticIndex(
158621158653
Parse *pParse, /* The parsing context */
158622
- const WhereClause *pWC, /* The WHERE clause */
158623
- const SrcItem *pSrc, /* The FROM clause term to get the next index */
158654
+ WhereClause *pWC, /* The WHERE clause */
158624158655
const Bitmask notReady, /* Mask of cursors that are not available */
158625158656
WhereLevel *pLevel /* Write new index here */
158626158657
){
158627158658
int nKeyCol; /* Number of columns in the constructed index */
158628158659
WhereTerm *pTerm; /* A single term of the WHERE clause */
@@ -158643,11 +158674,12 @@
158643158674
Bitmask extraCols; /* Bitmap of additional columns */
158644158675
u8 sentWarning = 0; /* True if a warning has been issued */
158645158676
u8 useBloomFilter = 0; /* True to also add a Bloom filter */
158646158677
Expr *pPartial = 0; /* Partial Index Expression */
158647158678
int iContinue = 0; /* Jump here to skip excluded rows */
158648
- SrcItem *pTabItem; /* FROM clause term being indexed */
158679
+ SrcList *pTabList; /* The complete FROM clause */
158680
+ SrcItem *pSrc; /* The FROM clause term to get the next index */
158649158681
int addrCounter = 0; /* Address where integer counter is initialized */
158650158682
int regBase; /* Array of registers where record is assembled */
158651158683
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
158652158684
int addrExp = 0; /* Address of OP_Explain */
158653158685
#endif
@@ -158659,10 +158691,12 @@
158659158691
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
158660158692
158661158693
/* Count the number of columns that will be added to the index
158662158694
** and used to match WHERE clause constraints */
158663158695
nKeyCol = 0;
158696
+ pTabList = pWC->pWInfo->pTabList;
158697
+ pSrc = &pTabList->a[pLevel->iFrom];
158664158698
pTable = pSrc->pTab;
158665158699
pWCEnd = &pWC->a[pWC->nTerm];
158666158700
pLoop = pLevel->pWLoop;
158667158701
idxCols = 0;
158668158702
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
@@ -158669,11 +158703,11 @@
158669158703
Expr *pExpr = pTerm->pExpr;
158670158704
/* Make the automatic index a partial index if there are terms in the
158671158705
** WHERE clause (or the ON clause of a LEFT join) that constrain which
158672158706
** rows of the target table (pSrc) that can be used. */
158673158707
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
158674
- && sqlite3ExprIsSingleTableConstraint(pExpr, pSrc)
158708
+ && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom)
158675158709
){
158676158710
pPartial = sqlite3ExprAnd(pParse, pPartial,
158677158711
sqlite3ExprDup(pParse->db, pExpr, 0));
158678158712
}
158679158713
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
@@ -158799,18 +158833,18 @@
158799158833
pLevel->regFilter = ++pParse->nMem;
158800158834
sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
158801158835
}
158802158836
158803158837
/* Fill the automatic index with content */
158804
- pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
158805
- if( pTabItem->fg.viaCoroutine ){
158806
- int regYield = pTabItem->regReturn;
158838
+ assert( pSrc == &pWC->pWInfo->pTabList->a[pLevel->iFrom] );
158839
+ if( pSrc->fg.viaCoroutine ){
158840
+ int regYield = pSrc->regReturn;
158807158841
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
158808
- sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
158842
+ sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pSrc->addrFillSub);
158809158843
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
158810158844
VdbeCoverage(v);
158811
- VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
158845
+ VdbeComment((v, "next row of %s", pSrc->pTab->zName));
158812158846
}else{
158813158847
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
158814158848
}
158815158849
if( pPartial ){
158816158850
iContinue = sqlite3VdbeMakeLabel(pParse);
@@ -158827,18 +158861,18 @@
158827158861
}
158828158862
sqlite3VdbeScanStatusCounters(v, addrExp, addrExp, sqlite3VdbeCurrentAddr(v));
158829158863
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
158830158864
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
158831158865
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
158832
- if( pTabItem->fg.viaCoroutine ){
158866
+ if( pSrc->fg.viaCoroutine ){
158833158867
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
158834158868
testcase( pParse->db->mallocFailed );
158835158869
assert( pLevel->iIdxCur>0 );
158836158870
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
158837
- pTabItem->regResult, pLevel->iIdxCur);
158871
+ pSrc->regResult, pLevel->iIdxCur);
158838158872
sqlite3VdbeGoto(v, addrTop);
158839
- pTabItem->fg.viaCoroutine = 0;
158873
+ pSrc->fg.viaCoroutine = 0;
158840158874
}else{
158841158875
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
158842158876
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
158843158877
}
158844158878
sqlite3VdbeJumpHere(v, addrTop);
@@ -158897,13 +158931,15 @@
158897158931
assert( v!=0 );
158898158932
assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158899158933
158900158934
addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
158901158935
do{
158936
+ const SrcList *pTabList;
158902158937
const SrcItem *pItem;
158903158938
const Table *pTab;
158904158939
u64 sz;
158940
+ int iSrc;
158905158941
sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel);
158906158942
addrCont = sqlite3VdbeMakeLabel(pParse);
158907158943
iCur = pLevel->iTabCur;
158908158944
pLevel->regFilter = ++pParse->nMem;
158909158945
@@ -158913,11 +158949,13 @@
158913158949
** measure the size of the table at run-time using OP_Count with
158914158950
** P3==1 and use that value to initialize the blob. But that makes
158915158951
** testing complicated. By basing the blob size on the value in the
158916158952
** sqlite_stat1 table, testing is much easier.
158917158953
*/
158918
- pItem = &pWInfo->pTabList->a[pLevel->iFrom];
158954
+ pTabList = pWInfo->pTabList;
158955
+ iSrc = pLevel->iFrom;
158956
+ pItem = &pTabList->a[iSrc];
158919158957
assert( pItem!=0 );
158920158958
pTab = pItem->pTab;
158921158959
assert( pTab!=0 );
158922158960
sz = sqlite3LogEstToInt(pTab->nRowLogEst);
158923158961
if( sz<10000 ){
@@ -158930,11 +158968,11 @@
158930158968
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
158931158969
pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm];
158932158970
for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
158933158971
Expr *pExpr = pTerm->pExpr;
158934158972
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
158935
- && sqlite3ExprIsSingleTableConstraint(pExpr, pItem)
158973
+ && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc)
158936158974
){
158937158975
sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
158938158976
}
158939158977
}
158940158978
if( pLoop->wsFlags & WHERE_IPK ){
@@ -164162,15 +164200,15 @@
164162164200
int iOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
164163164201
sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
164164164202
sqlite3VdbeJumpHere(v, iOnce);
164165164203
}
164166164204
}
164205
+ assert( pTabList == pWInfo->pTabList );
164167164206
if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){
164168164207
if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){
164169164208
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
164170
- constructAutomaticIndex(pParse, &pWInfo->sWC,
164171
- &pTabList->a[pLevel->iFrom], notReady, pLevel);
164209
+ constructAutomaticIndex(pParse, &pWInfo->sWC, notReady, pLevel);
164172164210
#endif
164173164211
}else{
164174164212
sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady);
164175164213
}
164176164214
if( db->mallocFailed ) goto whereBeginError;
@@ -228819,10 +228857,14 @@
228819228857
228820228858
228821228859
/* #include "fts5Int.h" */
228822228860
/* #include "fts5parse.h" */
228823228861
228862
+#ifndef SQLITE_FTS5_MAX_EXPR_DEPTH
228863
+# define SQLITE_FTS5_MAX_EXPR_DEPTH 256
228864
+#endif
228865
+
228824228866
/*
228825228867
** All token types in the generated fts5parse.h file are greater than 0.
228826228868
*/
228827228869
#define FTS5_EOF 0
228828228870
@@ -228859,15 +228901,21 @@
228859228901
** FTS5_AND (nChild, apChild valid)
228860228902
** FTS5_OR (nChild, apChild valid)
228861228903
** FTS5_NOT (nChild, apChild valid)
228862228904
** FTS5_STRING (pNear valid)
228863228905
** FTS5_TERM (pNear valid)
228906
+**
228907
+** iHeight:
228908
+** Distance from this node to furthest leaf. This is always 0 for nodes
228909
+** of type FTS5_STRING and FTS5_TERM. For all other nodes it is one
228910
+** greater than the largest child value.
228864228911
*/
228865228912
struct Fts5ExprNode {
228866228913
int eType; /* Node type */
228867228914
int bEof; /* True at EOF */
228868228915
int bNomatch; /* True if entry is not a match */
228916
+ int iHeight; /* Distance to tree leaf nodes */
228869228917
228870228918
/* Next method for this node. */
228871228919
int (*xNext)(Fts5Expr*, Fts5ExprNode*, int, i64);
228872228920
228873228921
i64 iRowid; /* Current rowid */
@@ -228933,10 +228981,35 @@
228933228981
Fts5ExprPhrase **apPhrase; /* Array of all phrases */
228934228982
Fts5ExprNode *pExpr; /* Result of a successful parse */
228935228983
int bPhraseToAnd; /* Convert "a+b" to "a AND b" */
228936228984
};
228937228985
228986
+/*
228987
+** Check that the Fts5ExprNode.iHeight variables are set correctly in
228988
+** the expression tree passed as the only argument.
228989
+*/
228990
+#ifndef NDEBUG
228991
+static void assert_expr_depth_ok(int rc, Fts5ExprNode *p){
228992
+ if( rc==SQLITE_OK ){
228993
+ if( p->eType==FTS5_TERM || p->eType==FTS5_STRING || p->eType==0 ){
228994
+ assert( p->iHeight==0 );
228995
+ }else{
228996
+ int ii;
228997
+ int iMaxChild = 0;
228998
+ for(ii=0; ii<p->nChild; ii++){
228999
+ Fts5ExprNode *pChild = p->apChild[ii];
229000
+ iMaxChild = MAX(iMaxChild, pChild->iHeight);
229001
+ assert_expr_depth_ok(SQLITE_OK, pChild);
229002
+ }
229003
+ assert( p->iHeight==iMaxChild+1 );
229004
+ }
229005
+ }
229006
+}
229007
+#else
229008
+# define assert_expr_depth_ok(rc, p)
229009
+#endif
229010
+
228938229011
static void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){
228939229012
va_list ap;
228940229013
va_start(ap, zFmt);
228941229014
if( pParse->rc==SQLITE_OK ){
228942229015
assert( pParse->zErr==0 );
@@ -229046,10 +229119,12 @@
229046229119
do {
229047229120
t = fts5ExprGetToken(&sParse, &z, &token);
229048229121
sqlite3Fts5Parser(pEngine, t, token, &sParse);
229049229122
}while( sParse.rc==SQLITE_OK && t!=FTS5_EOF );
229050229123
sqlite3Fts5ParserFree(pEngine, fts5ParseFree);
229124
+
229125
+ assert_expr_depth_ok(sParse.rc, sParse.pExpr);
229051229126
229052229127
/* If the LHS of the MATCH expression was a user column, apply the
229053229128
** implicit column-filter. */
229054229129
if( iCol<pConfig->nCol && sParse.pExpr && sParse.rc==SQLITE_OK ){
229055229130
int n = sizeof(Fts5Colset);
@@ -231008,18 +231083,22 @@
231008231083
};
231009231084
}
231010231085
}
231011231086
231012231087
static void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){
231088
+ int ii = p->nChild;
231013231089
if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){
231014231090
int nByte = sizeof(Fts5ExprNode*) * pSub->nChild;
231015231091
memcpy(&p->apChild[p->nChild], pSub->apChild, nByte);
231016231092
p->nChild += pSub->nChild;
231017231093
sqlite3_free(pSub);
231018231094
}else{
231019231095
p->apChild[p->nChild++] = pSub;
231020231096
}
231097
+ for( ; ii<p->nChild; ii++){
231098
+ p->iHeight = MAX(p->iHeight, p->apChild[ii]->iHeight + 1);
231099
+ }
231021231100
}
231022231101
231023231102
/*
231024231103
** This function is used when parsing LIKE or GLOB patterns against
231025231104
** trigram indexes that specify either detail=column or detail=none.
@@ -231046,10 +231125,11 @@
231046231125
nByte = sizeof(Fts5ExprNode) + nTerm*sizeof(Fts5ExprNode*);
231047231126
pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
231048231127
if( pRet ){
231049231128
pRet->eType = FTS5_AND;
231050231129
pRet->nChild = nTerm;
231130
+ pRet->iHeight = 1;
231051231131
fts5ExprAssignXNext(pRet);
231052231132
pParse->nPhrase--;
231053231133
for(ii=0; ii<nTerm; ii++){
231054231134
Fts5ExprPhrase *pPhrase = (Fts5ExprPhrase*)sqlite3Fts5MallocZero(
231055231135
&pParse->rc, sizeof(Fts5ExprPhrase)
@@ -231151,10 +231231,18 @@
231151231231
}
231152231232
}
231153231233
}else{
231154231234
fts5ExprAddChildren(pRet, pLeft);
231155231235
fts5ExprAddChildren(pRet, pRight);
231236
+ if( pRet->iHeight>SQLITE_FTS5_MAX_EXPR_DEPTH ){
231237
+ sqlite3Fts5ParseError(pParse,
231238
+ "fts5 expression tree is too large (maximum depth %d)",
231239
+ SQLITE_FTS5_MAX_EXPR_DEPTH
231240
+ );
231241
+ sqlite3_free(pRet);
231242
+ pRet = 0;
231243
+ }
231156231244
}
231157231245
}
231158231246
}
231159231247
}
231160231248
@@ -242545,11 +242633,11 @@
242545242633
int nArg, /* Number of args */
242546242634
sqlite3_value **apUnused /* Function arguments */
242547242635
){
242548242636
assert( nArg==0 );
242549242637
UNUSED_PARAM2(nArg, apUnused);
242550
- sqlite3_result_text(pCtx, "fts5: 2023-05-11 21:15:55 3e9c9bbdb59b9d500ff218db538c047c83da7ac18ebb95c3ee7629ab15e0b43a", -1, SQLITE_TRANSIENT);
242638
+ sqlite3_result_text(pCtx, "fts5: 2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0", -1, SQLITE_TRANSIENT);
242551242639
}
242552242640
242553242641
/*
242554242642
** Return true if zName is the extension on one of the shadow tables used
242555242643
** by this module.
242556242644
--- 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-12 10:52:12 469718f106e1cfa7f8f4714a9e743108c361af81e0258061c2b76880a7c352ae"
462
463 /*
464 ** CAPI3REF: Run-Time Library Version Numbers
465 ** KEYWORDS: sqlite3_version sqlite3_sourceid
466 **
@@ -8197,13 +8197,13 @@
8197 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
8198 ** previously entered by the same thread. The behavior
8199 ** is undefined if the mutex is not currently entered by the
8200 ** calling thread or is not currently allocated.
8201 **
8202 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
8203 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
8204 ** behave as no-ops.
8205 **
8206 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
8207 */
8208 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
8209 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
@@ -20506,11 +20506,11 @@
20506 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
20507 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
20508 SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
20509 SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
20510 SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
20511 SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcItem*);
20512 #ifdef SQLITE_ENABLE_CURSOR_HINTS
20513 SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
20514 #endif
20515 SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*);
20516 SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
@@ -68240,11 +68240,11 @@
68240 ** Legal values for BtCursor.curFlags
68241 */
68242 #define BTCF_WriteFlag 0x01 /* True if a write cursor */
68243 #define BTCF_ValidNKey 0x02 /* True if info.nKey is valid */
68244 #define BTCF_ValidOvfl 0x04 /* True if aOverflow is valid */
68245 #define BTCF_AtLast 0x08 /* Cursor is pointing ot the last entry */
68246 #define BTCF_Incrblob 0x10 /* True if an incremental I/O handle */
68247 #define BTCF_Multiple 0x20 /* Maybe another cursor on the same btree */
68248 #define BTCF_Pinned 0x40 /* Cursor is busy and cannot be moved */
68249
68250 /*
@@ -108615,14 +108615,15 @@
108615 SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
108616 return exprIsConst(p, 3, iCur);
108617 }
108618
108619 /*
108620 ** Check pExpr to see if it is an constraint on the single data source pSrc.
108621 ** In other words, check to see if pExpr constrains pSrc but does not depend
108622 ** on any other tables or data sources anywhere else in the query. Return
108623 ** true (non-zero) if pExpr is a constraint on pSrc only.
 
108624 **
108625 ** This is an optimization. False negatives will perhaps cause slower
108626 ** queries, but false positives will yield incorrect answers. So when in
108627 ** doubt, return 0.
108628 **
@@ -108635,25 +108636,56 @@
108635 ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN.
108636 ** (Is there some way to relax this constraint?)
108637 **
108638 ** (4) If pSrc is the right operand of a LEFT JOIN, then...
108639 ** (4a) pExpr must come from an ON clause..
108640 (4b) and specifically the ON clause associated with the LEFT JOIN.
108641 **
108642 ** (5) If pSrc is not the right operand of a LEFT JOIN or the left
108643 ** operand of a RIGHT JOIN, then pExpr must be from the WHERE
108644 ** clause, not an ON clause.
 
 
 
 
 
 
 
 
 
 
 
 
 
108645 */
108646 SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr *pExpr, const SrcItem *pSrc){
 
 
 
 
 
108647 if( pSrc->fg.jointype & JT_LTORJ ){
108648 return 0; /* rule (3) */
108649 }
108650 if( pSrc->fg.jointype & JT_LEFT ){
108651 if( !ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (4a) */
108652 if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */
108653 }else{
108654 if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (5) */
 
 
 
 
 
 
 
 
 
 
 
 
 
108655 }
108656 return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
108657 }
108658
108659
@@ -144080,11 +144112,12 @@
144080 ** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING
144081 ** clause and the subquery.
144082 **
144083 ** Without this restriction, the push-down optimization might move
144084 ** the ON/USING filter expression from the left side of a RIGHT JOIN
144085 ** over to the right side, which leads to incorrect answers.
 
144086 **
144087 ** (10) The inner query is not the right-hand table of a RIGHT JOIN.
144088 **
144089 ** (11) The subquery is not a VALUES clause
144090 **
@@ -144165,10 +144198,11 @@
144165 while( pWhere->op==TK_AND ){
144166 nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrcList, iSrc);
144167 pWhere = pWhere->pLeft;
144168 }
144169
 
144170 if( ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) /* (9a) */
144171 && (pSrcList->a[0].fg.jointype & JT_LTORJ)!=0 /* Fast pre-test of (9c) */
144172 ){
144173 int jj;
144174 for(jj=0; jj<iSrc; jj++){
@@ -144182,12 +144216,10 @@
144182 }
144183 }
144184 }
144185 }
144186 }
144187
144188 #if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
144189 if( isLeftJoin
144190 && (ExprHasProperty(pWhere,EP_OuterON)==0
144191 || pWhere->w.iJoin!=iCursor)
144192 ){
144193 return 0; /* restriction (4) */
@@ -144197,11 +144229,11 @@
144197 ){
144198 return 0; /* restriction (5) */
144199 }
144200 #endif
144201
144202 if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrc) ){
144203 nChng++;
144204 pSubq->selFlags |= SF_PushDown;
144205 while( pSubq ){
144206 SubstContext x;
144207 pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
@@ -158617,12 +158649,11 @@
158617 ** and to set up the WhereLevel object pLevel so that the code generator
158618 ** makes use of the automatic index.
158619 */
158620 static SQLITE_NOINLINE void constructAutomaticIndex(
158621 Parse *pParse, /* The parsing context */
158622 const WhereClause *pWC, /* The WHERE clause */
158623 const SrcItem *pSrc, /* The FROM clause term to get the next index */
158624 const Bitmask notReady, /* Mask of cursors that are not available */
158625 WhereLevel *pLevel /* Write new index here */
158626 ){
158627 int nKeyCol; /* Number of columns in the constructed index */
158628 WhereTerm *pTerm; /* A single term of the WHERE clause */
@@ -158643,11 +158674,12 @@
158643 Bitmask extraCols; /* Bitmap of additional columns */
158644 u8 sentWarning = 0; /* True if a warning has been issued */
158645 u8 useBloomFilter = 0; /* True to also add a Bloom filter */
158646 Expr *pPartial = 0; /* Partial Index Expression */
158647 int iContinue = 0; /* Jump here to skip excluded rows */
158648 SrcItem *pTabItem; /* FROM clause term being indexed */
 
158649 int addrCounter = 0; /* Address where integer counter is initialized */
158650 int regBase; /* Array of registers where record is assembled */
158651 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
158652 int addrExp = 0; /* Address of OP_Explain */
158653 #endif
@@ -158659,10 +158691,12 @@
158659 addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
158660
158661 /* Count the number of columns that will be added to the index
158662 ** and used to match WHERE clause constraints */
158663 nKeyCol = 0;
 
 
158664 pTable = pSrc->pTab;
158665 pWCEnd = &pWC->a[pWC->nTerm];
158666 pLoop = pLevel->pWLoop;
158667 idxCols = 0;
158668 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
@@ -158669,11 +158703,11 @@
158669 Expr *pExpr = pTerm->pExpr;
158670 /* Make the automatic index a partial index if there are terms in the
158671 ** WHERE clause (or the ON clause of a LEFT join) that constrain which
158672 ** rows of the target table (pSrc) that can be used. */
158673 if( (pTerm->wtFlags & TERM_VIRTUAL)==0
158674 && sqlite3ExprIsSingleTableConstraint(pExpr, pSrc)
158675 ){
158676 pPartial = sqlite3ExprAnd(pParse, pPartial,
158677 sqlite3ExprDup(pParse->db, pExpr, 0));
158678 }
158679 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
@@ -158799,18 +158833,18 @@
158799 pLevel->regFilter = ++pParse->nMem;
158800 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
158801 }
158802
158803 /* Fill the automatic index with content */
158804 pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
158805 if( pTabItem->fg.viaCoroutine ){
158806 int regYield = pTabItem->regReturn;
158807 addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
158808 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
158809 addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
158810 VdbeCoverage(v);
158811 VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
158812 }else{
158813 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
158814 }
158815 if( pPartial ){
158816 iContinue = sqlite3VdbeMakeLabel(pParse);
@@ -158827,18 +158861,18 @@
158827 }
158828 sqlite3VdbeScanStatusCounters(v, addrExp, addrExp, sqlite3VdbeCurrentAddr(v));
158829 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
158830 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
158831 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
158832 if( pTabItem->fg.viaCoroutine ){
158833 sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
158834 testcase( pParse->db->mallocFailed );
158835 assert( pLevel->iIdxCur>0 );
158836 translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
158837 pTabItem->regResult, pLevel->iIdxCur);
158838 sqlite3VdbeGoto(v, addrTop);
158839 pTabItem->fg.viaCoroutine = 0;
158840 }else{
158841 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
158842 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
158843 }
158844 sqlite3VdbeJumpHere(v, addrTop);
@@ -158897,13 +158931,15 @@
158897 assert( v!=0 );
158898 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158899
158900 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
158901 do{
 
158902 const SrcItem *pItem;
158903 const Table *pTab;
158904 u64 sz;
 
158905 sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel);
158906 addrCont = sqlite3VdbeMakeLabel(pParse);
158907 iCur = pLevel->iTabCur;
158908 pLevel->regFilter = ++pParse->nMem;
158909
@@ -158913,11 +158949,13 @@
158913 ** measure the size of the table at run-time using OP_Count with
158914 ** P3==1 and use that value to initialize the blob. But that makes
158915 ** testing complicated. By basing the blob size on the value in the
158916 ** sqlite_stat1 table, testing is much easier.
158917 */
158918 pItem = &pWInfo->pTabList->a[pLevel->iFrom];
 
 
158919 assert( pItem!=0 );
158920 pTab = pItem->pTab;
158921 assert( pTab!=0 );
158922 sz = sqlite3LogEstToInt(pTab->nRowLogEst);
158923 if( sz<10000 ){
@@ -158930,11 +158968,11 @@
158930 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
158931 pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm];
158932 for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
158933 Expr *pExpr = pTerm->pExpr;
158934 if( (pTerm->wtFlags & TERM_VIRTUAL)==0
158935 && sqlite3ExprIsSingleTableConstraint(pExpr, pItem)
158936 ){
158937 sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
158938 }
158939 }
158940 if( pLoop->wsFlags & WHERE_IPK ){
@@ -164162,15 +164200,15 @@
164162 int iOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
164163 sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
164164 sqlite3VdbeJumpHere(v, iOnce);
164165 }
164166 }
 
164167 if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){
164168 if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){
164169 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
164170 constructAutomaticIndex(pParse, &pWInfo->sWC,
164171 &pTabList->a[pLevel->iFrom], notReady, pLevel);
164172 #endif
164173 }else{
164174 sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady);
164175 }
164176 if( db->mallocFailed ) goto whereBeginError;
@@ -228819,10 +228857,14 @@
228819
228820
228821 /* #include "fts5Int.h" */
228822 /* #include "fts5parse.h" */
228823
 
 
 
 
228824 /*
228825 ** All token types in the generated fts5parse.h file are greater than 0.
228826 */
228827 #define FTS5_EOF 0
228828
@@ -228859,15 +228901,21 @@
228859 ** FTS5_AND (nChild, apChild valid)
228860 ** FTS5_OR (nChild, apChild valid)
228861 ** FTS5_NOT (nChild, apChild valid)
228862 ** FTS5_STRING (pNear valid)
228863 ** FTS5_TERM (pNear valid)
 
 
 
 
 
228864 */
228865 struct Fts5ExprNode {
228866 int eType; /* Node type */
228867 int bEof; /* True at EOF */
228868 int bNomatch; /* True if entry is not a match */
 
228869
228870 /* Next method for this node. */
228871 int (*xNext)(Fts5Expr*, Fts5ExprNode*, int, i64);
228872
228873 i64 iRowid; /* Current rowid */
@@ -228933,10 +228981,35 @@
228933 Fts5ExprPhrase **apPhrase; /* Array of all phrases */
228934 Fts5ExprNode *pExpr; /* Result of a successful parse */
228935 int bPhraseToAnd; /* Convert "a+b" to "a AND b" */
228936 };
228937
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228938 static void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){
228939 va_list ap;
228940 va_start(ap, zFmt);
228941 if( pParse->rc==SQLITE_OK ){
228942 assert( pParse->zErr==0 );
@@ -229046,10 +229119,12 @@
229046 do {
229047 t = fts5ExprGetToken(&sParse, &z, &token);
229048 sqlite3Fts5Parser(pEngine, t, token, &sParse);
229049 }while( sParse.rc==SQLITE_OK && t!=FTS5_EOF );
229050 sqlite3Fts5ParserFree(pEngine, fts5ParseFree);
 
 
229051
229052 /* If the LHS of the MATCH expression was a user column, apply the
229053 ** implicit column-filter. */
229054 if( iCol<pConfig->nCol && sParse.pExpr && sParse.rc==SQLITE_OK ){
229055 int n = sizeof(Fts5Colset);
@@ -231008,18 +231083,22 @@
231008 };
231009 }
231010 }
231011
231012 static void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){
 
231013 if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){
231014 int nByte = sizeof(Fts5ExprNode*) * pSub->nChild;
231015 memcpy(&p->apChild[p->nChild], pSub->apChild, nByte);
231016 p->nChild += pSub->nChild;
231017 sqlite3_free(pSub);
231018 }else{
231019 p->apChild[p->nChild++] = pSub;
231020 }
 
 
 
231021 }
231022
231023 /*
231024 ** This function is used when parsing LIKE or GLOB patterns against
231025 ** trigram indexes that specify either detail=column or detail=none.
@@ -231046,10 +231125,11 @@
231046 nByte = sizeof(Fts5ExprNode) + nTerm*sizeof(Fts5ExprNode*);
231047 pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
231048 if( pRet ){
231049 pRet->eType = FTS5_AND;
231050 pRet->nChild = nTerm;
 
231051 fts5ExprAssignXNext(pRet);
231052 pParse->nPhrase--;
231053 for(ii=0; ii<nTerm; ii++){
231054 Fts5ExprPhrase *pPhrase = (Fts5ExprPhrase*)sqlite3Fts5MallocZero(
231055 &pParse->rc, sizeof(Fts5ExprPhrase)
@@ -231151,10 +231231,18 @@
231151 }
231152 }
231153 }else{
231154 fts5ExprAddChildren(pRet, pLeft);
231155 fts5ExprAddChildren(pRet, pRight);
 
 
 
 
 
 
 
 
231156 }
231157 }
231158 }
231159 }
231160
@@ -242545,11 +242633,11 @@
242545 int nArg, /* Number of args */
242546 sqlite3_value **apUnused /* Function arguments */
242547 ){
242548 assert( nArg==0 );
242549 UNUSED_PARAM2(nArg, apUnused);
242550 sqlite3_result_text(pCtx, "fts5: 2023-05-11 21:15:55 3e9c9bbdb59b9d500ff218db538c047c83da7ac18ebb95c3ee7629ab15e0b43a", -1, SQLITE_TRANSIENT);
242551 }
242552
242553 /*
242554 ** Return true if zName is the extension on one of the shadow tables used
242555 ** by this module.
242556
--- 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-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0"
462
463 /*
464 ** CAPI3REF: Run-Time Library Version Numbers
465 ** KEYWORDS: sqlite3_version sqlite3_sourceid
466 **
@@ -8197,13 +8197,13 @@
8197 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
8198 ** previously entered by the same thread. The behavior
8199 ** is undefined if the mutex is not currently entered by the
8200 ** calling thread or is not currently allocated.
8201 **
8202 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
8203 ** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
8204 ** then any of the four routines behaves as a no-op.
8205 **
8206 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
8207 */
8208 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
8209 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
@@ -20506,11 +20506,11 @@
20506 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
20507 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
20508 SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
20509 SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
20510 SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
20511 SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int);
20512 #ifdef SQLITE_ENABLE_CURSOR_HINTS
20513 SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
20514 #endif
20515 SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*);
20516 SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
@@ -68240,11 +68240,11 @@
68240 ** Legal values for BtCursor.curFlags
68241 */
68242 #define BTCF_WriteFlag 0x01 /* True if a write cursor */
68243 #define BTCF_ValidNKey 0x02 /* True if info.nKey is valid */
68244 #define BTCF_ValidOvfl 0x04 /* True if aOverflow is valid */
68245 #define BTCF_AtLast 0x08 /* Cursor is pointing to the last entry */
68246 #define BTCF_Incrblob 0x10 /* True if an incremental I/O handle */
68247 #define BTCF_Multiple 0x20 /* Maybe another cursor on the same btree */
68248 #define BTCF_Pinned 0x40 /* Cursor is busy and cannot be moved */
68249
68250 /*
@@ -108615,14 +108615,15 @@
108615 SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
108616 return exprIsConst(p, 3, iCur);
108617 }
108618
108619 /*
108620 ** Check pExpr to see if it is an constraint on the single data source
108621 ** pSrc = &pSrcList->a[iSrc]. In other words, check to see if pExpr
108622 ** constrains pSrc but does not depend on any other tables or data
108623 ** sources anywhere else in the query. Return true (non-zero) if pExpr
108624 ** is a constraint on pSrc only.
108625 **
108626 ** This is an optimization. False negatives will perhaps cause slower
108627 ** queries, but false positives will yield incorrect answers. So when in
108628 ** doubt, return 0.
108629 **
@@ -108635,25 +108636,56 @@
108636 ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN.
108637 ** (Is there some way to relax this constraint?)
108638 **
108639 ** (4) If pSrc is the right operand of a LEFT JOIN, then...
108640 ** (4a) pExpr must come from an ON clause..
108641 ** (4b) and specifically the ON clause associated with the LEFT JOIN.
108642 **
108643 ** (5) If pSrc is not the right operand of a LEFT JOIN or the left
108644 ** operand of a RIGHT JOIN, then pExpr must be from the WHERE
108645 ** clause, not an ON clause.
108646 **
108647 ** (6) Either:
108648 **
108649 ** (6a) pExpr does not originate in an ON or USING clause, or
108650 **
108651 ** (6b) The ON or USING clause from which pExpr is derived is
108652 ** not to the left of a RIGHT JOIN (or FULL JOIN).
108653 **
108654 ** Without this restriction, accepting pExpr as a single-table
108655 ** constraint might move the the ON/USING filter expression
108656 ** from the left side of a RIGHT JOIN over to the right side,
108657 ** which leads to incorrect answers. See also restriction (9)
108658 ** on push-down.
108659 */
108660 SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(
108661 Expr *pExpr, /* The constraint */
108662 const SrcList *pSrcList, /* Complete FROM clause */
108663 int iSrc /* Which element of pSrcList to use */
108664 ){
108665 const SrcItem *pSrc = &pSrcList->a[iSrc];
108666 if( pSrc->fg.jointype & JT_LTORJ ){
108667 return 0; /* rule (3) */
108668 }
108669 if( pSrc->fg.jointype & JT_LEFT ){
108670 if( !ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (4a) */
108671 if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */
108672 }else{
108673 if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (5) */
108674 }
108675 if( ExprHasProperty(pExpr, EP_OuterON|EP_InnerON) /* (6a) */
108676 && (pSrcList->a[0].fg.jointype & JT_LTORJ)!=0 /* Fast pre-test of (6b) */
108677 ){
108678 int jj;
108679 for(jj=0; jj<iSrc; jj++){
108680 if( pExpr->w.iJoin==pSrcList->a[jj].iCursor ){
108681 if( (pSrcList->a[jj].fg.jointype & JT_LTORJ)!=0 ){
108682 return 0; /* restriction (6) */
108683 }
108684 break;
108685 }
108686 }
108687 }
108688 return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
108689 }
108690
108691
@@ -144080,11 +144112,12 @@
144112 ** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING
144113 ** clause and the subquery.
144114 **
144115 ** Without this restriction, the push-down optimization might move
144116 ** the ON/USING filter expression from the left side of a RIGHT JOIN
144117 ** over to the right side, which leads to incorrect answers. See
144118 ** also restriction (6) in sqlite3ExprIsSingleTableConstraint().
144119 **
144120 ** (10) The inner query is not the right-hand table of a RIGHT JOIN.
144121 **
144122 ** (11) The subquery is not a VALUES clause
144123 **
@@ -144165,10 +144198,11 @@
144198 while( pWhere->op==TK_AND ){
144199 nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrcList, iSrc);
144200 pWhere = pWhere->pLeft;
144201 }
144202
144203 #if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
144204 if( ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) /* (9a) */
144205 && (pSrcList->a[0].fg.jointype & JT_LTORJ)!=0 /* Fast pre-test of (9c) */
144206 ){
144207 int jj;
144208 for(jj=0; jj<iSrc; jj++){
@@ -144182,12 +144216,10 @@
144216 }
144217 }
144218 }
144219 }
144220 }
 
 
144221 if( isLeftJoin
144222 && (ExprHasProperty(pWhere,EP_OuterON)==0
144223 || pWhere->w.iJoin!=iCursor)
144224 ){
144225 return 0; /* restriction (4) */
@@ -144197,11 +144229,11 @@
144229 ){
144230 return 0; /* restriction (5) */
144231 }
144232 #endif
144233
144234 if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){
144235 nChng++;
144236 pSubq->selFlags |= SF_PushDown;
144237 while( pSubq ){
144238 SubstContext x;
144239 pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
@@ -158617,12 +158649,11 @@
158649 ** and to set up the WhereLevel object pLevel so that the code generator
158650 ** makes use of the automatic index.
158651 */
158652 static SQLITE_NOINLINE void constructAutomaticIndex(
158653 Parse *pParse, /* The parsing context */
158654 WhereClause *pWC, /* The WHERE clause */
 
158655 const Bitmask notReady, /* Mask of cursors that are not available */
158656 WhereLevel *pLevel /* Write new index here */
158657 ){
158658 int nKeyCol; /* Number of columns in the constructed index */
158659 WhereTerm *pTerm; /* A single term of the WHERE clause */
@@ -158643,11 +158674,12 @@
158674 Bitmask extraCols; /* Bitmap of additional columns */
158675 u8 sentWarning = 0; /* True if a warning has been issued */
158676 u8 useBloomFilter = 0; /* True to also add a Bloom filter */
158677 Expr *pPartial = 0; /* Partial Index Expression */
158678 int iContinue = 0; /* Jump here to skip excluded rows */
158679 SrcList *pTabList; /* The complete FROM clause */
158680 SrcItem *pSrc; /* The FROM clause term to get the next index */
158681 int addrCounter = 0; /* Address where integer counter is initialized */
158682 int regBase; /* Array of registers where record is assembled */
158683 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
158684 int addrExp = 0; /* Address of OP_Explain */
158685 #endif
@@ -158659,10 +158691,12 @@
158691 addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
158692
158693 /* Count the number of columns that will be added to the index
158694 ** and used to match WHERE clause constraints */
158695 nKeyCol = 0;
158696 pTabList = pWC->pWInfo->pTabList;
158697 pSrc = &pTabList->a[pLevel->iFrom];
158698 pTable = pSrc->pTab;
158699 pWCEnd = &pWC->a[pWC->nTerm];
158700 pLoop = pLevel->pWLoop;
158701 idxCols = 0;
158702 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
@@ -158669,11 +158703,11 @@
158703 Expr *pExpr = pTerm->pExpr;
158704 /* Make the automatic index a partial index if there are terms in the
158705 ** WHERE clause (or the ON clause of a LEFT join) that constrain which
158706 ** rows of the target table (pSrc) that can be used. */
158707 if( (pTerm->wtFlags & TERM_VIRTUAL)==0
158708 && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom)
158709 ){
158710 pPartial = sqlite3ExprAnd(pParse, pPartial,
158711 sqlite3ExprDup(pParse->db, pExpr, 0));
158712 }
158713 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
@@ -158799,18 +158833,18 @@
158833 pLevel->regFilter = ++pParse->nMem;
158834 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
158835 }
158836
158837 /* Fill the automatic index with content */
158838 assert( pSrc == &pWC->pWInfo->pTabList->a[pLevel->iFrom] );
158839 if( pSrc->fg.viaCoroutine ){
158840 int regYield = pSrc->regReturn;
158841 addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
158842 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pSrc->addrFillSub);
158843 addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
158844 VdbeCoverage(v);
158845 VdbeComment((v, "next row of %s", pSrc->pTab->zName));
158846 }else{
158847 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
158848 }
158849 if( pPartial ){
158850 iContinue = sqlite3VdbeMakeLabel(pParse);
@@ -158827,18 +158861,18 @@
158861 }
158862 sqlite3VdbeScanStatusCounters(v, addrExp, addrExp, sqlite3VdbeCurrentAddr(v));
158863 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
158864 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
158865 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
158866 if( pSrc->fg.viaCoroutine ){
158867 sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
158868 testcase( pParse->db->mallocFailed );
158869 assert( pLevel->iIdxCur>0 );
158870 translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
158871 pSrc->regResult, pLevel->iIdxCur);
158872 sqlite3VdbeGoto(v, addrTop);
158873 pSrc->fg.viaCoroutine = 0;
158874 }else{
158875 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
158876 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
158877 }
158878 sqlite3VdbeJumpHere(v, addrTop);
@@ -158897,13 +158931,15 @@
158931 assert( v!=0 );
158932 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158933
158934 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
158935 do{
158936 const SrcList *pTabList;
158937 const SrcItem *pItem;
158938 const Table *pTab;
158939 u64 sz;
158940 int iSrc;
158941 sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel);
158942 addrCont = sqlite3VdbeMakeLabel(pParse);
158943 iCur = pLevel->iTabCur;
158944 pLevel->regFilter = ++pParse->nMem;
158945
@@ -158913,11 +158949,13 @@
158949 ** measure the size of the table at run-time using OP_Count with
158950 ** P3==1 and use that value to initialize the blob. But that makes
158951 ** testing complicated. By basing the blob size on the value in the
158952 ** sqlite_stat1 table, testing is much easier.
158953 */
158954 pTabList = pWInfo->pTabList;
158955 iSrc = pLevel->iFrom;
158956 pItem = &pTabList->a[iSrc];
158957 assert( pItem!=0 );
158958 pTab = pItem->pTab;
158959 assert( pTab!=0 );
158960 sz = sqlite3LogEstToInt(pTab->nRowLogEst);
158961 if( sz<10000 ){
@@ -158930,11 +158968,11 @@
158968 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
158969 pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm];
158970 for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
158971 Expr *pExpr = pTerm->pExpr;
158972 if( (pTerm->wtFlags & TERM_VIRTUAL)==0
158973 && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc)
158974 ){
158975 sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
158976 }
158977 }
158978 if( pLoop->wsFlags & WHERE_IPK ){
@@ -164162,15 +164200,15 @@
164200 int iOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
164201 sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
164202 sqlite3VdbeJumpHere(v, iOnce);
164203 }
164204 }
164205 assert( pTabList == pWInfo->pTabList );
164206 if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){
164207 if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){
164208 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
164209 constructAutomaticIndex(pParse, &pWInfo->sWC, notReady, pLevel);
 
164210 #endif
164211 }else{
164212 sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady);
164213 }
164214 if( db->mallocFailed ) goto whereBeginError;
@@ -228819,10 +228857,14 @@
228857
228858
228859 /* #include "fts5Int.h" */
228860 /* #include "fts5parse.h" */
228861
228862 #ifndef SQLITE_FTS5_MAX_EXPR_DEPTH
228863 # define SQLITE_FTS5_MAX_EXPR_DEPTH 256
228864 #endif
228865
228866 /*
228867 ** All token types in the generated fts5parse.h file are greater than 0.
228868 */
228869 #define FTS5_EOF 0
228870
@@ -228859,15 +228901,21 @@
228901 ** FTS5_AND (nChild, apChild valid)
228902 ** FTS5_OR (nChild, apChild valid)
228903 ** FTS5_NOT (nChild, apChild valid)
228904 ** FTS5_STRING (pNear valid)
228905 ** FTS5_TERM (pNear valid)
228906 **
228907 ** iHeight:
228908 ** Distance from this node to furthest leaf. This is always 0 for nodes
228909 ** of type FTS5_STRING and FTS5_TERM. For all other nodes it is one
228910 ** greater than the largest child value.
228911 */
228912 struct Fts5ExprNode {
228913 int eType; /* Node type */
228914 int bEof; /* True at EOF */
228915 int bNomatch; /* True if entry is not a match */
228916 int iHeight; /* Distance to tree leaf nodes */
228917
228918 /* Next method for this node. */
228919 int (*xNext)(Fts5Expr*, Fts5ExprNode*, int, i64);
228920
228921 i64 iRowid; /* Current rowid */
@@ -228933,10 +228981,35 @@
228981 Fts5ExprPhrase **apPhrase; /* Array of all phrases */
228982 Fts5ExprNode *pExpr; /* Result of a successful parse */
228983 int bPhraseToAnd; /* Convert "a+b" to "a AND b" */
228984 };
228985
228986 /*
228987 ** Check that the Fts5ExprNode.iHeight variables are set correctly in
228988 ** the expression tree passed as the only argument.
228989 */
228990 #ifndef NDEBUG
228991 static void assert_expr_depth_ok(int rc, Fts5ExprNode *p){
228992 if( rc==SQLITE_OK ){
228993 if( p->eType==FTS5_TERM || p->eType==FTS5_STRING || p->eType==0 ){
228994 assert( p->iHeight==0 );
228995 }else{
228996 int ii;
228997 int iMaxChild = 0;
228998 for(ii=0; ii<p->nChild; ii++){
228999 Fts5ExprNode *pChild = p->apChild[ii];
229000 iMaxChild = MAX(iMaxChild, pChild->iHeight);
229001 assert_expr_depth_ok(SQLITE_OK, pChild);
229002 }
229003 assert( p->iHeight==iMaxChild+1 );
229004 }
229005 }
229006 }
229007 #else
229008 # define assert_expr_depth_ok(rc, p)
229009 #endif
229010
229011 static void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){
229012 va_list ap;
229013 va_start(ap, zFmt);
229014 if( pParse->rc==SQLITE_OK ){
229015 assert( pParse->zErr==0 );
@@ -229046,10 +229119,12 @@
229119 do {
229120 t = fts5ExprGetToken(&sParse, &z, &token);
229121 sqlite3Fts5Parser(pEngine, t, token, &sParse);
229122 }while( sParse.rc==SQLITE_OK && t!=FTS5_EOF );
229123 sqlite3Fts5ParserFree(pEngine, fts5ParseFree);
229124
229125 assert_expr_depth_ok(sParse.rc, sParse.pExpr);
229126
229127 /* If the LHS of the MATCH expression was a user column, apply the
229128 ** implicit column-filter. */
229129 if( iCol<pConfig->nCol && sParse.pExpr && sParse.rc==SQLITE_OK ){
229130 int n = sizeof(Fts5Colset);
@@ -231008,18 +231083,22 @@
231083 };
231084 }
231085 }
231086
231087 static void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){
231088 int ii = p->nChild;
231089 if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){
231090 int nByte = sizeof(Fts5ExprNode*) * pSub->nChild;
231091 memcpy(&p->apChild[p->nChild], pSub->apChild, nByte);
231092 p->nChild += pSub->nChild;
231093 sqlite3_free(pSub);
231094 }else{
231095 p->apChild[p->nChild++] = pSub;
231096 }
231097 for( ; ii<p->nChild; ii++){
231098 p->iHeight = MAX(p->iHeight, p->apChild[ii]->iHeight + 1);
231099 }
231100 }
231101
231102 /*
231103 ** This function is used when parsing LIKE or GLOB patterns against
231104 ** trigram indexes that specify either detail=column or detail=none.
@@ -231046,10 +231125,11 @@
231125 nByte = sizeof(Fts5ExprNode) + nTerm*sizeof(Fts5ExprNode*);
231126 pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
231127 if( pRet ){
231128 pRet->eType = FTS5_AND;
231129 pRet->nChild = nTerm;
231130 pRet->iHeight = 1;
231131 fts5ExprAssignXNext(pRet);
231132 pParse->nPhrase--;
231133 for(ii=0; ii<nTerm; ii++){
231134 Fts5ExprPhrase *pPhrase = (Fts5ExprPhrase*)sqlite3Fts5MallocZero(
231135 &pParse->rc, sizeof(Fts5ExprPhrase)
@@ -231151,10 +231231,18 @@
231231 }
231232 }
231233 }else{
231234 fts5ExprAddChildren(pRet, pLeft);
231235 fts5ExprAddChildren(pRet, pRight);
231236 if( pRet->iHeight>SQLITE_FTS5_MAX_EXPR_DEPTH ){
231237 sqlite3Fts5ParseError(pParse,
231238 "fts5 expression tree is too large (maximum depth %d)",
231239 SQLITE_FTS5_MAX_EXPR_DEPTH
231240 );
231241 sqlite3_free(pRet);
231242 pRet = 0;
231243 }
231244 }
231245 }
231246 }
231247 }
231248
@@ -242545,11 +242633,11 @@
242633 int nArg, /* Number of args */
242634 sqlite3_value **apUnused /* Function arguments */
242635 ){
242636 assert( nArg==0 );
242637 UNUSED_PARAM2(nArg, apUnused);
242638 sqlite3_result_text(pCtx, "fts5: 2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0", -1, SQLITE_TRANSIENT);
242639 }
242640
242641 /*
242642 ** Return true if zName is the extension on one of the shadow tables used
242643 ** by this module.
242644
--- 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-12 10:52:12 469718f106e1cfa7f8f4714a9e743108c361af81e0258061c2b76880a7c352ae"
151
+#define SQLITE_SOURCE_ID "2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -7887,13 +7887,13 @@
78877887
** ^The sqlite3_mutex_leave() routine exits a mutex that was
78887888
** previously entered by the same thread. The behavior
78897889
** is undefined if the mutex is not currently entered by the
78907890
** calling thread or is not currently allocated.
78917891
**
7892
-** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
7893
-** sqlite3_mutex_leave() is a NULL pointer, then all three routines
7894
-** behave as no-ops.
7892
+** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
7893
+** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
7894
+** then any of the four routines behaves as a no-op.
78957895
**
78967896
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
78977897
*/
78987898
SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
78997899
SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
79007900
--- 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-12 10:52:12 469718f106e1cfa7f8f4714a9e743108c361af81e0258061c2b76880a7c352ae"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -7887,13 +7887,13 @@
7887 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
7888 ** previously entered by the same thread. The behavior
7889 ** is undefined if the mutex is not currently entered by the
7890 ** calling thread or is not currently allocated.
7891 **
7892 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
7893 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
7894 ** behave as no-ops.
7895 **
7896 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
7897 */
7898 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
7899 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
7900
--- 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-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -7887,13 +7887,13 @@
7887 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
7888 ** previously entered by the same thread. The behavior
7889 ** is undefined if the mutex is not currently entered by the
7890 ** calling thread or is not currently allocated.
7891 **
7892 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
7893 ** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
7894 ** then any of the four routines behaves as a no-op.
7895 **
7896 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
7897 */
7898 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
7899 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
7900

Keyboard Shortcuts

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