Fossil SCM

Update the built-in SQLite to the latest 3.36.0 alpha for testing. Bring the regexp.c implementation into closer alignment with the canonical sources from the SQLite source tree.

drh 2021-06-07 00:55 trunk
Commit dfaa221bb58789ffb5b55a12fc1e36ff8bb2975e128a27c0f73cd7fa0fa2c9d2
+46 -6
--- src/regexp.c
+++ src/regexp.c
@@ -11,16 +11,52 @@
1111
**
1212
** Author contact information:
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
16
-*******************************************************************************
16
+******************************************************************************
1717
**
1818
** This file was adapted from the ext/misc/regexp.c file in SQLite3. That
1919
** file is in the public domain.
2020
**
2121
** See ../www/grep.md for details of the algorithm and RE dialect.
22
+**
23
+**
24
+** The following regular expression syntax is supported:
25
+**
26
+** X* zero or more occurrences of X
27
+** X+ one or more occurrences of X
28
+** X? zero or one occurrences of X
29
+** X{p,q} between p and q occurrences of X
30
+** (X) match X
31
+** X|Y X or Y
32
+** ^X X occurring at the beginning of the string
33
+** X$ X occurring at the end of the string
34
+** . Match any single character
35
+** \c Character c where c is one of \{}()[]|*+?.
36
+** \c C-language escapes for c in afnrtv. ex: \t or \n
37
+** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX
38
+** \xXX Where XX is exactly 2 hex digits, unicode value XX
39
+** [abc] Any single character from the set abc
40
+** [^abc] Any single character not in the set abc
41
+** [a-z] Any single character in the range a-z
42
+** [^a-z] Any single character not in the range a-z
43
+** \b Word boundary
44
+** \w Word character. [A-Za-z0-9_]
45
+** \W Non-word character
46
+** \d Digit
47
+** \D Non-digit
48
+** \s Whitespace character
49
+** \S Non-whitespace character
50
+**
51
+** A nondeterministic finite automaton (NFA) is used for matching, so the
52
+** performance is bounded by O(N*M) where N is the size of the regular
53
+** expression and M is the size of the input string. The matcher never
54
+** exhibits exponential behavior. Note that the X{p,q} operator expands
55
+** to p copies of X following by q-p copies of X? and that the size of the
56
+** regular expression in the O(N*M) performance bound is computed after
57
+** this expansion.
2258
*/
2359
#include "config.h"
2460
#include "regexp.h"
2561
2662
/* The end-of-input character */
@@ -205,27 +241,27 @@
205241
case RE_OP_WORD: {
206242
if( re_word_char(c) ) re_add_state(pNext, x+1);
207243
break;
208244
}
209245
case RE_OP_NOTWORD: {
210
- if( !re_word_char(c) ) re_add_state(pNext, x+1);
246
+ if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
211247
break;
212248
}
213249
case RE_OP_DIGIT: {
214250
if( re_digit_char(c) ) re_add_state(pNext, x+1);
215251
break;
216252
}
217253
case RE_OP_NOTDIGIT: {
218
- if( !re_digit_char(c) ) re_add_state(pNext, x+1);
254
+ if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
219255
break;
220256
}
221257
case RE_OP_SPACE: {
222258
if( re_space_char(c) ) re_add_state(pNext, x+1);
223259
break;
224260
}
225261
case RE_OP_NOTSPACE: {
226
- if( !re_space_char(c) ) re_add_state(pNext, x+1);
262
+ if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
227263
break;
228264
}
229265
case RE_OP_BOUNDARY: {
230266
if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
231267
break;
@@ -246,12 +282,15 @@
246282
}
247283
case RE_OP_ACCEPT: {
248284
rc = 1;
249285
goto re_match_end;
250286
}
251
- case RE_OP_CC_INC:
252287
case RE_OP_CC_EXC: {
288
+ if( c==0 ) break;
289
+ /* fall-through */
290
+ }
291
+ case RE_OP_CC_INC: {
253292
int j = 1;
254293
int n = pRe->aArg[x];
255294
int hit = 0;
256295
for(j=1; j>0 && j<n; j++){
257296
if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
@@ -623,11 +662,11 @@
623662
** string looking for the initial match without having to run the whole
624663
** regex engine over the string. Do not worry able trying to match
625664
** unicode characters beyond plane 0 - those are very rare and this is
626665
** just an optimization. */
627666
if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
628
- for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
667
+ for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
629668
unsigned x = pRe->aArg[i];
630669
if( x<=127 ){
631670
pRe->zInit[j++] = (unsigned char)x;
632671
}else if( x<=0xfff ){
633672
pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
@@ -664,10 +703,11 @@
664703
const char *zPattern; /* The regular expression */
665704
const unsigned char *zStr;/* String being searched */
666705
const char *zErr; /* Compile error message */
667706
int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
668707
708
+ (void)argc; /* Unused */
669709
pRe = sqlite3_get_auxdata(context, 0);
670710
if( pRe==0 ){
671711
zPattern = (const char*)sqlite3_value_text(argv[0]);
672712
if( zPattern==0 ) return;
673713
zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
674714
--- src/regexp.c
+++ src/regexp.c
@@ -11,16 +11,52 @@
11 **
12 ** Author contact information:
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file was adapted from the ext/misc/regexp.c file in SQLite3. That
19 ** file is in the public domain.
20 **
21 ** See ../www/grep.md for details of the algorithm and RE dialect.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22 */
23 #include "config.h"
24 #include "regexp.h"
25
26 /* The end-of-input character */
@@ -205,27 +241,27 @@
205 case RE_OP_WORD: {
206 if( re_word_char(c) ) re_add_state(pNext, x+1);
207 break;
208 }
209 case RE_OP_NOTWORD: {
210 if( !re_word_char(c) ) re_add_state(pNext, x+1);
211 break;
212 }
213 case RE_OP_DIGIT: {
214 if( re_digit_char(c) ) re_add_state(pNext, x+1);
215 break;
216 }
217 case RE_OP_NOTDIGIT: {
218 if( !re_digit_char(c) ) re_add_state(pNext, x+1);
219 break;
220 }
221 case RE_OP_SPACE: {
222 if( re_space_char(c) ) re_add_state(pNext, x+1);
223 break;
224 }
225 case RE_OP_NOTSPACE: {
226 if( !re_space_char(c) ) re_add_state(pNext, x+1);
227 break;
228 }
229 case RE_OP_BOUNDARY: {
230 if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
231 break;
@@ -246,12 +282,15 @@
246 }
247 case RE_OP_ACCEPT: {
248 rc = 1;
249 goto re_match_end;
250 }
251 case RE_OP_CC_INC:
252 case RE_OP_CC_EXC: {
 
 
 
 
253 int j = 1;
254 int n = pRe->aArg[x];
255 int hit = 0;
256 for(j=1; j>0 && j<n; j++){
257 if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
@@ -623,11 +662,11 @@
623 ** string looking for the initial match without having to run the whole
624 ** regex engine over the string. Do not worry able trying to match
625 ** unicode characters beyond plane 0 - those are very rare and this is
626 ** just an optimization. */
627 if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
628 for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
629 unsigned x = pRe->aArg[i];
630 if( x<=127 ){
631 pRe->zInit[j++] = (unsigned char)x;
632 }else if( x<=0xfff ){
633 pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
@@ -664,10 +703,11 @@
664 const char *zPattern; /* The regular expression */
665 const unsigned char *zStr;/* String being searched */
666 const char *zErr; /* Compile error message */
667 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
668
 
669 pRe = sqlite3_get_auxdata(context, 0);
670 if( pRe==0 ){
671 zPattern = (const char*)sqlite3_value_text(argv[0]);
672 if( zPattern==0 ) return;
673 zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
674
--- src/regexp.c
+++ src/regexp.c
@@ -11,16 +11,52 @@
11 **
12 ** Author contact information:
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 ******************************************************************************
17 **
18 ** This file was adapted from the ext/misc/regexp.c file in SQLite3. That
19 ** file is in the public domain.
20 **
21 ** See ../www/grep.md for details of the algorithm and RE dialect.
22 **
23 **
24 ** The following regular expression syntax is supported:
25 **
26 ** X* zero or more occurrences of X
27 ** X+ one or more occurrences of X
28 ** X? zero or one occurrences of X
29 ** X{p,q} between p and q occurrences of X
30 ** (X) match X
31 ** X|Y X or Y
32 ** ^X X occurring at the beginning of the string
33 ** X$ X occurring at the end of the string
34 ** . Match any single character
35 ** \c Character c where c is one of \{}()[]|*+?.
36 ** \c C-language escapes for c in afnrtv. ex: \t or \n
37 ** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX
38 ** \xXX Where XX is exactly 2 hex digits, unicode value XX
39 ** [abc] Any single character from the set abc
40 ** [^abc] Any single character not in the set abc
41 ** [a-z] Any single character in the range a-z
42 ** [^a-z] Any single character not in the range a-z
43 ** \b Word boundary
44 ** \w Word character. [A-Za-z0-9_]
45 ** \W Non-word character
46 ** \d Digit
47 ** \D Non-digit
48 ** \s Whitespace character
49 ** \S Non-whitespace character
50 **
51 ** A nondeterministic finite automaton (NFA) is used for matching, so the
52 ** performance is bounded by O(N*M) where N is the size of the regular
53 ** expression and M is the size of the input string. The matcher never
54 ** exhibits exponential behavior. Note that the X{p,q} operator expands
55 ** to p copies of X following by q-p copies of X? and that the size of the
56 ** regular expression in the O(N*M) performance bound is computed after
57 ** this expansion.
58 */
59 #include "config.h"
60 #include "regexp.h"
61
62 /* The end-of-input character */
@@ -205,27 +241,27 @@
241 case RE_OP_WORD: {
242 if( re_word_char(c) ) re_add_state(pNext, x+1);
243 break;
244 }
245 case RE_OP_NOTWORD: {
246 if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
247 break;
248 }
249 case RE_OP_DIGIT: {
250 if( re_digit_char(c) ) re_add_state(pNext, x+1);
251 break;
252 }
253 case RE_OP_NOTDIGIT: {
254 if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
255 break;
256 }
257 case RE_OP_SPACE: {
258 if( re_space_char(c) ) re_add_state(pNext, x+1);
259 break;
260 }
261 case RE_OP_NOTSPACE: {
262 if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
263 break;
264 }
265 case RE_OP_BOUNDARY: {
266 if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
267 break;
@@ -246,12 +282,15 @@
282 }
283 case RE_OP_ACCEPT: {
284 rc = 1;
285 goto re_match_end;
286 }
 
287 case RE_OP_CC_EXC: {
288 if( c==0 ) break;
289 /* fall-through */
290 }
291 case RE_OP_CC_INC: {
292 int j = 1;
293 int n = pRe->aArg[x];
294 int hit = 0;
295 for(j=1; j>0 && j<n; j++){
296 if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
@@ -623,11 +662,11 @@
662 ** string looking for the initial match without having to run the whole
663 ** regex engine over the string. Do not worry able trying to match
664 ** unicode characters beyond plane 0 - those are very rare and this is
665 ** just an optimization. */
666 if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
667 for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
668 unsigned x = pRe->aArg[i];
669 if( x<=127 ){
670 pRe->zInit[j++] = (unsigned char)x;
671 }else if( x<=0xfff ){
672 pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
@@ -664,10 +703,11 @@
703 const char *zPattern; /* The regular expression */
704 const unsigned char *zStr;/* String being searched */
705 const char *zErr; /* Compile error message */
706 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
707
708 (void)argc; /* Unused */
709 pRe = sqlite3_get_auxdata(context, 0);
710 if( pRe==0 ){
711 zPattern = (const char*)sqlite3_value_text(argv[0]);
712 if( zPattern==0 ) return;
713 zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
714
+41 -6
--- src/shell.c
+++ src/shell.c
@@ -6138,27 +6138,27 @@
61386138
case RE_OP_WORD: {
61396139
if( re_word_char(c) ) re_add_state(pNext, x+1);
61406140
break;
61416141
}
61426142
case RE_OP_NOTWORD: {
6143
- if( !re_word_char(c) ) re_add_state(pNext, x+1);
6143
+ if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
61446144
break;
61456145
}
61466146
case RE_OP_DIGIT: {
61476147
if( re_digit_char(c) ) re_add_state(pNext, x+1);
61486148
break;
61496149
}
61506150
case RE_OP_NOTDIGIT: {
6151
- if( !re_digit_char(c) ) re_add_state(pNext, x+1);
6151
+ if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
61526152
break;
61536153
}
61546154
case RE_OP_SPACE: {
61556155
if( re_space_char(c) ) re_add_state(pNext, x+1);
61566156
break;
61576157
}
61586158
case RE_OP_NOTSPACE: {
6159
- if( !re_space_char(c) ) re_add_state(pNext, x+1);
6159
+ if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
61606160
break;
61616161
}
61626162
case RE_OP_BOUNDARY: {
61636163
if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
61646164
break;
@@ -6179,12 +6179,15 @@
61796179
}
61806180
case RE_OP_ACCEPT: {
61816181
rc = 1;
61826182
goto re_match_end;
61836183
}
6184
- case RE_OP_CC_INC:
61856184
case RE_OP_CC_EXC: {
6185
+ if( c==0 ) break;
6186
+ /* fall-through */
6187
+ }
6188
+ case RE_OP_CC_INC: {
61866189
int j = 1;
61876190
int n = pRe->aArg[x];
61886191
int hit = 0;
61896192
for(j=1; j>0 && j<n; j++){
61906193
if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
@@ -6556,11 +6559,11 @@
65566559
** string looking for the initial match without having to run the whole
65576560
** regex engine over the string. Do not worry able trying to match
65586561
** unicode characters beyond plane 0 - those are very rare and this is
65596562
** just an optimization. */
65606563
if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
6561
- for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
6564
+ for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
65626565
unsigned x = pRe->aArg[i];
65636566
if( x<=127 ){
65646567
pRe->zInit[j++] = (unsigned char)x;
65656568
}else if( x<=0xfff ){
65666569
pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
@@ -6597,10 +6600,11 @@
65976600
const char *zPattern; /* The regular expression */
65986601
const unsigned char *zStr;/* String being searched */
65996602
const char *zErr; /* Compile error message */
66006603
int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
66016604
6605
+ (void)argc; /* Unused */
66026606
pRe = sqlite3_get_auxdata(context, 0);
66036607
if( pRe==0 ){
66046608
zPattern = (const char*)sqlite3_value_text(argv[0]);
66056609
if( zPattern==0 ) return;
66066610
zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
@@ -6636,10 +6640,11 @@
66366640
char **pzErrMsg,
66376641
const sqlite3_api_routines *pApi
66386642
){
66396643
int rc = SQLITE_OK;
66406644
SQLITE_EXTENSION_INIT2(pApi);
6645
+ (void)pzErrMsg; /* Unused */
66416646
rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
66426647
0, re_sql_func, 0, 0);
66436648
if( rc==SQLITE_OK ){
66446649
/* The regexpi(PATTERN,STRING) function is a case-insensitive version
66456650
** of regexp(PATTERN,STRING). */
@@ -20907,10 +20912,11 @@
2090720912
{ "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
2090820913
{ "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
2090920914
{ "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
2091020915
{ "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
2091120916
{ "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
20917
+ { "tune", SQLITE_TESTCTRL_TUNE, "ID VALUE" },
2091220918
};
2091320919
int testctrl = -1;
2091420920
int iCtrl = -1;
2091520921
int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
2091620922
int isOk = 0;
@@ -21051,15 +21057,44 @@
2105121057
isOk = 3;
2105221058
break;
2105321059
}
2105421060
2105521061
#ifdef YYCOVERAGE
21056
- case SQLITE_TESTCTRL_PARSER_COVERAGE:
21062
+ case SQLITE_TESTCTRL_PARSER_COVERAGE: {
2105721063
if( nArg==2 ){
2105821064
sqlite3_test_control(testctrl, p->out);
2105921065
isOk = 3;
2106021066
}
21067
+ break;
21068
+ }
21069
+#endif
21070
+#ifdef SQLITE_DEBUG
21071
+ case SQLITE_TESTCTRL_TUNE: {
21072
+ if( nArg==4 ){
21073
+ int id = (int)integerValue(azArg[2]);
21074
+ int val = (int)integerValue(azArg[3]);
21075
+ sqlite3_test_control(testctrl, id, &val);
21076
+ isOk = 3;
21077
+ }else if( nArg==3 ){
21078
+ int id = (int)integerValue(azArg[2]);
21079
+ sqlite3_test_control(testctrl, -id, &rc2);
21080
+ isOk = 1;
21081
+ }else if( nArg==2 ){
21082
+ int id = 1;
21083
+ while(1){
21084
+ int val = 0;
21085
+ rc2 = sqlite3_test_control(testctrl, -id, &val);
21086
+ if( rc2!=SQLITE_OK ) break;
21087
+ if( id>1 ) utf8_printf(p->out, " ");
21088
+ utf8_printf(p->out, "%d: %d", id, val);
21089
+ id++;
21090
+ }
21091
+ if( id>1 ) utf8_printf(p->out, "\n");
21092
+ isOk = 3;
21093
+ }
21094
+ break;
21095
+ }
2106121096
#endif
2106221097
}
2106321098
}
2106421099
if( isOk==0 && iCtrl>=0 ){
2106521100
utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage);
2106621101
--- src/shell.c
+++ src/shell.c
@@ -6138,27 +6138,27 @@
6138 case RE_OP_WORD: {
6139 if( re_word_char(c) ) re_add_state(pNext, x+1);
6140 break;
6141 }
6142 case RE_OP_NOTWORD: {
6143 if( !re_word_char(c) ) re_add_state(pNext, x+1);
6144 break;
6145 }
6146 case RE_OP_DIGIT: {
6147 if( re_digit_char(c) ) re_add_state(pNext, x+1);
6148 break;
6149 }
6150 case RE_OP_NOTDIGIT: {
6151 if( !re_digit_char(c) ) re_add_state(pNext, x+1);
6152 break;
6153 }
6154 case RE_OP_SPACE: {
6155 if( re_space_char(c) ) re_add_state(pNext, x+1);
6156 break;
6157 }
6158 case RE_OP_NOTSPACE: {
6159 if( !re_space_char(c) ) re_add_state(pNext, x+1);
6160 break;
6161 }
6162 case RE_OP_BOUNDARY: {
6163 if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
6164 break;
@@ -6179,12 +6179,15 @@
6179 }
6180 case RE_OP_ACCEPT: {
6181 rc = 1;
6182 goto re_match_end;
6183 }
6184 case RE_OP_CC_INC:
6185 case RE_OP_CC_EXC: {
 
 
 
 
6186 int j = 1;
6187 int n = pRe->aArg[x];
6188 int hit = 0;
6189 for(j=1; j>0 && j<n; j++){
6190 if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
@@ -6556,11 +6559,11 @@
6556 ** string looking for the initial match without having to run the whole
6557 ** regex engine over the string. Do not worry able trying to match
6558 ** unicode characters beyond plane 0 - those are very rare and this is
6559 ** just an optimization. */
6560 if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
6561 for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
6562 unsigned x = pRe->aArg[i];
6563 if( x<=127 ){
6564 pRe->zInit[j++] = (unsigned char)x;
6565 }else if( x<=0xfff ){
6566 pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
@@ -6597,10 +6600,11 @@
6597 const char *zPattern; /* The regular expression */
6598 const unsigned char *zStr;/* String being searched */
6599 const char *zErr; /* Compile error message */
6600 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
6601
 
6602 pRe = sqlite3_get_auxdata(context, 0);
6603 if( pRe==0 ){
6604 zPattern = (const char*)sqlite3_value_text(argv[0]);
6605 if( zPattern==0 ) return;
6606 zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
@@ -6636,10 +6640,11 @@
6636 char **pzErrMsg,
6637 const sqlite3_api_routines *pApi
6638 ){
6639 int rc = SQLITE_OK;
6640 SQLITE_EXTENSION_INIT2(pApi);
 
6641 rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
6642 0, re_sql_func, 0, 0);
6643 if( rc==SQLITE_OK ){
6644 /* The regexpi(PATTERN,STRING) function is a case-insensitive version
6645 ** of regexp(PATTERN,STRING). */
@@ -20907,10 +20912,11 @@
20907 { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
20908 { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
20909 { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
20910 { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
20911 { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
 
20912 };
20913 int testctrl = -1;
20914 int iCtrl = -1;
20915 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
20916 int isOk = 0;
@@ -21051,15 +21057,44 @@
21051 isOk = 3;
21052 break;
21053 }
21054
21055 #ifdef YYCOVERAGE
21056 case SQLITE_TESTCTRL_PARSER_COVERAGE:
21057 if( nArg==2 ){
21058 sqlite3_test_control(testctrl, p->out);
21059 isOk = 3;
21060 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21061 #endif
21062 }
21063 }
21064 if( isOk==0 && iCtrl>=0 ){
21065 utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage);
21066
--- src/shell.c
+++ src/shell.c
@@ -6138,27 +6138,27 @@
6138 case RE_OP_WORD: {
6139 if( re_word_char(c) ) re_add_state(pNext, x+1);
6140 break;
6141 }
6142 case RE_OP_NOTWORD: {
6143 if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
6144 break;
6145 }
6146 case RE_OP_DIGIT: {
6147 if( re_digit_char(c) ) re_add_state(pNext, x+1);
6148 break;
6149 }
6150 case RE_OP_NOTDIGIT: {
6151 if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
6152 break;
6153 }
6154 case RE_OP_SPACE: {
6155 if( re_space_char(c) ) re_add_state(pNext, x+1);
6156 break;
6157 }
6158 case RE_OP_NOTSPACE: {
6159 if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
6160 break;
6161 }
6162 case RE_OP_BOUNDARY: {
6163 if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
6164 break;
@@ -6179,12 +6179,15 @@
6179 }
6180 case RE_OP_ACCEPT: {
6181 rc = 1;
6182 goto re_match_end;
6183 }
 
6184 case RE_OP_CC_EXC: {
6185 if( c==0 ) break;
6186 /* fall-through */
6187 }
6188 case RE_OP_CC_INC: {
6189 int j = 1;
6190 int n = pRe->aArg[x];
6191 int hit = 0;
6192 for(j=1; j>0 && j<n; j++){
6193 if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
@@ -6556,11 +6559,11 @@
6559 ** string looking for the initial match without having to run the whole
6560 ** regex engine over the string. Do not worry able trying to match
6561 ** unicode characters beyond plane 0 - those are very rare and this is
6562 ** just an optimization. */
6563 if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
6564 for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
6565 unsigned x = pRe->aArg[i];
6566 if( x<=127 ){
6567 pRe->zInit[j++] = (unsigned char)x;
6568 }else if( x<=0xfff ){
6569 pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
@@ -6597,10 +6600,11 @@
6600 const char *zPattern; /* The regular expression */
6601 const unsigned char *zStr;/* String being searched */
6602 const char *zErr; /* Compile error message */
6603 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
6604
6605 (void)argc; /* Unused */
6606 pRe = sqlite3_get_auxdata(context, 0);
6607 if( pRe==0 ){
6608 zPattern = (const char*)sqlite3_value_text(argv[0]);
6609 if( zPattern==0 ) return;
6610 zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
@@ -6636,10 +6640,11 @@
6640 char **pzErrMsg,
6641 const sqlite3_api_routines *pApi
6642 ){
6643 int rc = SQLITE_OK;
6644 SQLITE_EXTENSION_INIT2(pApi);
6645 (void)pzErrMsg; /* Unused */
6646 rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
6647 0, re_sql_func, 0, 0);
6648 if( rc==SQLITE_OK ){
6649 /* The regexpi(PATTERN,STRING) function is a case-insensitive version
6650 ** of regexp(PATTERN,STRING). */
@@ -20907,10 +20912,11 @@
20912 { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
20913 { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
20914 { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
20915 { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
20916 { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
20917 { "tune", SQLITE_TESTCTRL_TUNE, "ID VALUE" },
20918 };
20919 int testctrl = -1;
20920 int iCtrl = -1;
20921 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
20922 int isOk = 0;
@@ -21051,15 +21057,44 @@
21057 isOk = 3;
21058 break;
21059 }
21060
21061 #ifdef YYCOVERAGE
21062 case SQLITE_TESTCTRL_PARSER_COVERAGE: {
21063 if( nArg==2 ){
21064 sqlite3_test_control(testctrl, p->out);
21065 isOk = 3;
21066 }
21067 break;
21068 }
21069 #endif
21070 #ifdef SQLITE_DEBUG
21071 case SQLITE_TESTCTRL_TUNE: {
21072 if( nArg==4 ){
21073 int id = (int)integerValue(azArg[2]);
21074 int val = (int)integerValue(azArg[3]);
21075 sqlite3_test_control(testctrl, id, &val);
21076 isOk = 3;
21077 }else if( nArg==3 ){
21078 int id = (int)integerValue(azArg[2]);
21079 sqlite3_test_control(testctrl, -id, &rc2);
21080 isOk = 1;
21081 }else if( nArg==2 ){
21082 int id = 1;
21083 while(1){
21084 int val = 0;
21085 rc2 = sqlite3_test_control(testctrl, -id, &val);
21086 if( rc2!=SQLITE_OK ) break;
21087 if( id>1 ) utf8_printf(p->out, " ");
21088 utf8_printf(p->out, "%d: %d", id, val);
21089 id++;
21090 }
21091 if( id>1 ) utf8_printf(p->out, "\n");
21092 isOk = 3;
21093 }
21094 break;
21095 }
21096 #endif
21097 }
21098 }
21099 if( isOk==0 && iCtrl>=0 ){
21100 utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage);
21101
+81 -21
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1205,11 +1205,11 @@
12051205
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
12061206
** [sqlite_version()] and [sqlite_source_id()].
12071207
*/
12081208
#define SQLITE_VERSION "3.36.0"
12091209
#define SQLITE_VERSION_NUMBER 3036000
1210
-#define SQLITE_SOURCE_ID "2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1"
1210
+#define SQLITE_SOURCE_ID "2021-06-07 00:41:18 2aa9368b63b42ac7c700516f109edcc6098c12b850eae591afed4e51a3f41819"
12111211
12121212
/*
12131213
** CAPI3REF: Run-Time Library Version Numbers
12141214
** KEYWORDS: sqlite3_version sqlite3_sourceid
12151215
**
@@ -6213,21 +6213,19 @@
62136213
** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
62146214
** flag, which if present prevents the function from being invoked from
62156215
** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
62166216
** index expressions, or the WHERE clause of partial indexes.
62176217
**
6218
-** <span style="background-color:#ffff90;">
62196218
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
62206219
** all application-defined SQL functions that do not need to be
62216220
** used inside of triggers, view, CHECK constraints, or other elements of
62226221
** the database schema. This flags is especially recommended for SQL
62236222
** functions that have side effects or reveal internal application state.
62246223
** Without this flag, an attacker might be able to modify the schema of
62256224
** a database file to include invocations of the function with parameters
62266225
** chosen by the attacker, which the application will then execute when
62276226
** the database file is opened and read.
6228
-** </span>
62296227
**
62306228
** ^(The fifth parameter is an arbitrary pointer. The implementation of the
62316229
** function can gain access to this pointer using [sqlite3_user_data()].)^
62326230
**
62336231
** ^The sixth, seventh and eighth parameters passed to the three
@@ -8891,11 +8889,12 @@
88918889
#define SQLITE_TESTCTRL_RESULT_INTREAL 27
88928890
#define SQLITE_TESTCTRL_PRNG_SEED 28
88938891
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
88948892
#define SQLITE_TESTCTRL_SEEK_COUNT 30
88958893
#define SQLITE_TESTCTRL_TRACEFLAGS 31
8896
-#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
8894
+#define SQLITE_TESTCTRL_TUNE 32
8895
+#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
88978896
88988897
/*
88998898
** CAPI3REF: SQL Keyword Checking
89008899
**
89018900
** These routines provide access to the set of SQL language keywords
@@ -17314,10 +17313,11 @@
1731417313
#define SQLITE_PushDown 0x00001000 /* The push-down optimization */
1731517314
#define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
1731617315
#define SQLITE_SkipScan 0x00004000 /* Skip-scans */
1731717316
#define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
1731817317
#define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
17318
+#define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
1731917319
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1732017320
1732117321
/*
1732217322
** Macros for testing whether or not optimizations are enabled or disabled.
1732317323
*/
@@ -19323,10 +19323,26 @@
1932319323
** Allowed values for mInitFlags
1932419324
*/
1932519325
#define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
1932619326
#define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
1932719327
19328
+/* Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled
19329
+** on debug-builds of the CLI using ".testctrl tune ID VALUE". Tuning
19330
+** parameters are for temporary use during development, to help find
19331
+** optimial values for parameters in the query planner. The should not
19332
+** be used on trunk check-ins. They are a temporary mechanism available
19333
+** for transient development builds only.
19334
+**
19335
+** Tuning parameters are numbered starting with 1.
19336
+*/
19337
+#define SQLITE_NTUNE 6 /* Should be zero for all trunk check-ins */
19338
+#ifdef SQLITE_DEBUG
19339
+# define Tuning(X) (sqlite3Config.aTune[(X)-1])
19340
+#else
19341
+# define Tuning(X) 0
19342
+#endif
19343
+
1932819344
/*
1932919345
** Structure containing global configuration data for the SQLite library.
1933019346
**
1933119347
** This structure also contains some state information.
1933219348
*/
@@ -19387,10 +19403,14 @@
1938719403
#endif
1938819404
int bLocaltimeFault; /* True to fail localtime() calls */
1938919405
int iOnceResetThreshold; /* When to reset OP_Once counters */
1939019406
u32 szSorterRef; /* Min size in bytes to use sorter-refs */
1939119407
unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */
19408
+ /* vvvv--- must be last ---vvv */
19409
+#ifdef SQLITE_DEBUG
19410
+ sqlite3_int64 aTune[SQLITE_NTUNE]; /* Tuning parameters */
19411
+#endif
1939219412
};
1939319413
1939419414
/*
1939519415
** This macro is used inside of assert() statements to indicate that
1939619416
** the assert is only valid on a well-formed database. Instead of:
@@ -90937,12 +90957,11 @@
9093790957
assert( pOp[1].opcode==OP_SeekGE );
9093890958
9093990959
/* pOp->p2 points to the first instruction past the OP_IdxGT that
9094090960
** follows the OP_SeekGE. */
9094190961
assert( pOp->p2>=(int)(pOp-aOp)+2 );
90942
- assert( aOp[pOp->p2-1].opcode==OP_IdxGT || aOp[pOp->p2-1].opcode==OP_IdxGE );
90943
- testcase( aOp[pOp->p2-1].opcode==OP_IdxGE );
90962
+ assert( aOp[pOp->p2-1].opcode==OP_IdxGT );
9094490963
assert( pOp[1].p1==aOp[pOp->p2-1].p1 );
9094590964
assert( pOp[1].p2==aOp[pOp->p2-1].p2 );
9094690965
assert( pOp[1].p3==aOp[pOp->p2-1].p3 );
9094790966
9094890967
assert( pOp->p1>0 );
@@ -101823,11 +101842,11 @@
101823101842
regRight = exprCodeSubselect(pParse, pRight);
101824101843
101825101844
sqlite3VdbeAddOp2(v, OP_Integer, 1, dest);
101826101845
for(i=0; 1 /*Loop exits by "break"*/; i++){
101827101846
int regFree1 = 0, regFree2 = 0;
101828
- Expr *pL, *pR;
101847
+ Expr *pL = 0, *pR = 0;
101829101848
int r1, r2;
101830101849
assert( i>=0 && i<nLeft );
101831101850
if( addrCmp ) sqlite3VdbeJumpHere(v, addrCmp);
101832101851
r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
101833101852
r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
@@ -108284,11 +108303,11 @@
108284108303
Parse *pParse,
108285108304
struct RenameCtx *pCtx,
108286108305
void *pPtr
108287108306
){
108288108307
RenameToken **pp;
108289
- if( pPtr==0 ){
108308
+ if( NEVER(pPtr==0) ){
108290108309
return 0;
108291108310
}
108292108311
for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
108293108312
if( (*pp)->p==pPtr ){
108294108313
RenameToken *pToken = *pp;
@@ -108838,13 +108857,15 @@
108838108857
int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName);
108839108858
FKey *pFKey;
108840108859
assert( sParse.pNewTable->pSelect==0 );
108841108860
sCtx.pTab = sParse.pNewTable;
108842108861
if( bFKOnly==0 ){
108843
- renameTokenFind(
108844
- &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName
108845
- );
108862
+ if( iCol<sParse.pNewTable->nCol ){
108863
+ renameTokenFind(
108864
+ &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName
108865
+ );
108866
+ }
108846108867
if( sCtx.iCol<0 ){
108847108868
renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey);
108848108869
}
108849108870
sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck);
108850108871
for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){
@@ -151728,11 +151749,11 @@
151728151749
}else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
151729151750
/* "x IN (value, value, ...)" */
151730151751
nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
151731151752
}
151732151753
if( pProbe->hasStat1 && rLogSize>=10 ){
151733
- LogEst M, logK, safetyMargin;
151754
+ LogEst M, logK, x;
151734151755
/* Let:
151735151756
** N = the total number of rows in the table
151736151757
** K = the number of entries on the RHS of the IN operator
151737151758
** M = the number of rows in the table that match terms to the
151738151759
** to the left in the same index. If the IN operator is on
@@ -151751,20 +151772,29 @@
151751151772
** the index. Do not bother with this optimization on very small
151752151773
** tables (less than 2 rows) as it is pointless in that case.
151753151774
*/
151754151775
M = pProbe->aiRowLogEst[saved_nEq];
151755151776
logK = estLog(nIn);
151756
- safetyMargin = 10; /* TUNING: extra weight for indexed IN */
151757
- if( M + logK + safetyMargin < nIn + rLogSize ){
151777
+ /* TUNING v----- 10 to bias toward indexed IN */
151778
+ x = M + logK + 10 - (nIn + rLogSize);
151779
+ if( x>=0 ){
151780
+ WHERETRACE(0x40,
151781
+ ("IN operator (N=%d M=%d logK=%d nIn=%d rLogSize=%d x=%d) "
151782
+ "prefers indexed lookup\n",
151783
+ saved_nEq, M, logK, nIn, rLogSize, x));
151784
+ }else if( nInMul<2 && OptimizationEnabled(db, SQLITE_SeekScan) ){
151758151785
WHERETRACE(0x40,
151759
- ("Scan preferred over IN operator on column %d of \"%s\" (%d<%d)\n",
151760
- saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
151786
+ ("IN operator (N=%d M=%d logK=%d nIn=%d rLogSize=%d x=%d"
151787
+ " nInMul=%d) prefers skip-scan\n",
151788
+ saved_nEq, M, logK, nIn, rLogSize, x, nInMul));
151761151789
pNew->wsFlags |= WHERE_IN_SEEKSCAN;
151762151790
}else{
151763151791
WHERETRACE(0x40,
151764
- ("IN operator preferred on column %d of \"%s\" (%d>=%d)\n",
151765
- saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
151792
+ ("IN operator (N=%d M=%d logK=%d nIn=%d rLogSize=%d x=%d"
151793
+ " nInMul=%d) prefers normal scan\n",
151794
+ saved_nEq, M, logK, nIn, rLogSize, x, nInMul));
151795
+ continue;
151766151796
}
151767151797
}
151768151798
pNew->wsFlags |= WHERE_COLUMN_IN;
151769151799
}else if( eOp & (WO_EQ|WO_IS) ){
151770151800
int iCol = pProbe->aiColumn[saved_nEq];
@@ -169257,10 +169287,40 @@
169257169287
case 2: *ptr = sqlite3WhereTrace; break;
169258169288
case 3: sqlite3WhereTrace = *ptr; break;
169259169289
}
169260169290
break;
169261169291
}
169292
+
169293
+#ifdef SQLITE_DEBUG
169294
+ /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
169295
+ **
169296
+ ** If "id" is an integer between 1 and SQLITE_NTUNE then set the value
169297
+ ** of the id-th tuning parameter to *piValue. If "id" is between -1
169298
+ ** and -SQLITE_NTUNE, then write the current value of the (-id)-th
169299
+ ** tuning parameter into *piValue.
169300
+ **
169301
+ ** Tuning parameters are for use during transient development builds,
169302
+ ** to help find the best values for constants in the query planner.
169303
+ ** Access tuning parameters using the Tuning(ID) macro. Set the
169304
+ ** parameters in the CLI using ".testctrl tune ID VALUE".
169305
+ **
169306
+ ** Transient use only. Tuning parameters should not be used in
169307
+ ** checked-in code.
169308
+ */
169309
+ case SQLITE_TESTCTRL_TUNE: {
169310
+ int id = va_arg(ap, int);
169311
+ int *piValue = va_arg(ap, int*);
169312
+ if( id>0 && id<=SQLITE_NTUNE ){
169313
+ Tuning(id) = *piValue;
169314
+ }else if( id<0 && id>=-SQLITE_NTUNE ){
169315
+ *piValue = Tuning(-id);
169316
+ }else{
169317
+ rc = SQLITE_NOTFOUND;
169318
+ }
169319
+ break;
169320
+ }
169321
+#endif
169262169322
}
169263169323
va_end(ap);
169264169324
#endif /* SQLITE_UNTESTABLE */
169265169325
return rc;
169266169326
}
@@ -230441,11 +230501,11 @@
230441230501
int nArg, /* Number of args */
230442230502
sqlite3_value **apUnused /* Function arguments */
230443230503
){
230444230504
assert( nArg==0 );
230445230505
UNUSED_PARAM2(nArg, apUnused);
230446
- sqlite3_result_text(pCtx, "fts5: 2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1", -1, SQLITE_TRANSIENT);
230506
+ sqlite3_result_text(pCtx, "fts5: 2021-06-04 23:26:56 1c71de43dbc68002c4a6229e7efffb019655baff67a51fe922571fe420c95835", -1, SQLITE_TRANSIENT);
230447230507
}
230448230508
230449230509
/*
230450230510
** Return true if zName is the extension on one of the shadow tables used
230451230511
** by this module.
@@ -235367,12 +235427,12 @@
235367235427
}
235368235428
#endif /* SQLITE_CORE */
235369235429
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
235370235430
235371235431
/************** End of stmt.c ************************************************/
235372
-#if __LINE__!=235372
235432
+#if __LINE__!=235432
235373235433
#undef SQLITE_SOURCE_ID
235374
-#define SQLITE_SOURCE_ID "2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258balt2"
235434
+#define SQLITE_SOURCE_ID "2021-06-07 00:41:18 2aa9368b63b42ac7c700516f109edcc6098c12b850eae591afed4e51a3f4alt2"
235375235435
#endif
235376235436
/* Return the source-id for this library */
235377235437
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
235378235438
/************************** End of sqlite3.c ******************************/
235379235439
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1205,11 +1205,11 @@
1205 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1206 ** [sqlite_version()] and [sqlite_source_id()].
1207 */
1208 #define SQLITE_VERSION "3.36.0"
1209 #define SQLITE_VERSION_NUMBER 3036000
1210 #define SQLITE_SOURCE_ID "2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1"
1211
1212 /*
1213 ** CAPI3REF: Run-Time Library Version Numbers
1214 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1215 **
@@ -6213,21 +6213,19 @@
6213 ** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
6214 ** flag, which if present prevents the function from being invoked from
6215 ** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
6216 ** index expressions, or the WHERE clause of partial indexes.
6217 **
6218 ** <span style="background-color:#ffff90;">
6219 ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
6220 ** all application-defined SQL functions that do not need to be
6221 ** used inside of triggers, view, CHECK constraints, or other elements of
6222 ** the database schema. This flags is especially recommended for SQL
6223 ** functions that have side effects or reveal internal application state.
6224 ** Without this flag, an attacker might be able to modify the schema of
6225 ** a database file to include invocations of the function with parameters
6226 ** chosen by the attacker, which the application will then execute when
6227 ** the database file is opened and read.
6228 ** </span>
6229 **
6230 ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
6231 ** function can gain access to this pointer using [sqlite3_user_data()].)^
6232 **
6233 ** ^The sixth, seventh and eighth parameters passed to the three
@@ -8891,11 +8889,12 @@
8891 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
8892 #define SQLITE_TESTCTRL_PRNG_SEED 28
8893 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
8894 #define SQLITE_TESTCTRL_SEEK_COUNT 30
8895 #define SQLITE_TESTCTRL_TRACEFLAGS 31
8896 #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
 
8897
8898 /*
8899 ** CAPI3REF: SQL Keyword Checking
8900 **
8901 ** These routines provide access to the set of SQL language keywords
@@ -17314,10 +17313,11 @@
17314 #define SQLITE_PushDown 0x00001000 /* The push-down optimization */
17315 #define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
17316 #define SQLITE_SkipScan 0x00004000 /* Skip-scans */
17317 #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
17318 #define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
 
17319 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17320
17321 /*
17322 ** Macros for testing whether or not optimizations are enabled or disabled.
17323 */
@@ -19323,10 +19323,26 @@
19323 ** Allowed values for mInitFlags
19324 */
19325 #define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
19326 #define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
19327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19328 /*
19329 ** Structure containing global configuration data for the SQLite library.
19330 **
19331 ** This structure also contains some state information.
19332 */
@@ -19387,10 +19403,14 @@
19387 #endif
19388 int bLocaltimeFault; /* True to fail localtime() calls */
19389 int iOnceResetThreshold; /* When to reset OP_Once counters */
19390 u32 szSorterRef; /* Min size in bytes to use sorter-refs */
19391 unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */
 
 
 
 
19392 };
19393
19394 /*
19395 ** This macro is used inside of assert() statements to indicate that
19396 ** the assert is only valid on a well-formed database. Instead of:
@@ -90937,12 +90957,11 @@
90937 assert( pOp[1].opcode==OP_SeekGE );
90938
90939 /* pOp->p2 points to the first instruction past the OP_IdxGT that
90940 ** follows the OP_SeekGE. */
90941 assert( pOp->p2>=(int)(pOp-aOp)+2 );
90942 assert( aOp[pOp->p2-1].opcode==OP_IdxGT || aOp[pOp->p2-1].opcode==OP_IdxGE );
90943 testcase( aOp[pOp->p2-1].opcode==OP_IdxGE );
90944 assert( pOp[1].p1==aOp[pOp->p2-1].p1 );
90945 assert( pOp[1].p2==aOp[pOp->p2-1].p2 );
90946 assert( pOp[1].p3==aOp[pOp->p2-1].p3 );
90947
90948 assert( pOp->p1>0 );
@@ -101823,11 +101842,11 @@
101823 regRight = exprCodeSubselect(pParse, pRight);
101824
101825 sqlite3VdbeAddOp2(v, OP_Integer, 1, dest);
101826 for(i=0; 1 /*Loop exits by "break"*/; i++){
101827 int regFree1 = 0, regFree2 = 0;
101828 Expr *pL, *pR;
101829 int r1, r2;
101830 assert( i>=0 && i<nLeft );
101831 if( addrCmp ) sqlite3VdbeJumpHere(v, addrCmp);
101832 r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
101833 r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
@@ -108284,11 +108303,11 @@
108284 Parse *pParse,
108285 struct RenameCtx *pCtx,
108286 void *pPtr
108287 ){
108288 RenameToken **pp;
108289 if( pPtr==0 ){
108290 return 0;
108291 }
108292 for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
108293 if( (*pp)->p==pPtr ){
108294 RenameToken *pToken = *pp;
@@ -108838,13 +108857,15 @@
108838 int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName);
108839 FKey *pFKey;
108840 assert( sParse.pNewTable->pSelect==0 );
108841 sCtx.pTab = sParse.pNewTable;
108842 if( bFKOnly==0 ){
108843 renameTokenFind(
108844 &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName
108845 );
 
 
108846 if( sCtx.iCol<0 ){
108847 renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey);
108848 }
108849 sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck);
108850 for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){
@@ -151728,11 +151749,11 @@
151728 }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
151729 /* "x IN (value, value, ...)" */
151730 nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
151731 }
151732 if( pProbe->hasStat1 && rLogSize>=10 ){
151733 LogEst M, logK, safetyMargin;
151734 /* Let:
151735 ** N = the total number of rows in the table
151736 ** K = the number of entries on the RHS of the IN operator
151737 ** M = the number of rows in the table that match terms to the
151738 ** to the left in the same index. If the IN operator is on
@@ -151751,20 +151772,29 @@
151751 ** the index. Do not bother with this optimization on very small
151752 ** tables (less than 2 rows) as it is pointless in that case.
151753 */
151754 M = pProbe->aiRowLogEst[saved_nEq];
151755 logK = estLog(nIn);
151756 safetyMargin = 10; /* TUNING: extra weight for indexed IN */
151757 if( M + logK + safetyMargin < nIn + rLogSize ){
 
 
 
 
 
 
151758 WHERETRACE(0x40,
151759 ("Scan preferred over IN operator on column %d of \"%s\" (%d<%d)\n",
151760 saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
 
151761 pNew->wsFlags |= WHERE_IN_SEEKSCAN;
151762 }else{
151763 WHERETRACE(0x40,
151764 ("IN operator preferred on column %d of \"%s\" (%d>=%d)\n",
151765 saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
 
 
151766 }
151767 }
151768 pNew->wsFlags |= WHERE_COLUMN_IN;
151769 }else if( eOp & (WO_EQ|WO_IS) ){
151770 int iCol = pProbe->aiColumn[saved_nEq];
@@ -169257,10 +169287,40 @@
169257 case 2: *ptr = sqlite3WhereTrace; break;
169258 case 3: sqlite3WhereTrace = *ptr; break;
169259 }
169260 break;
169261 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169262 }
169263 va_end(ap);
169264 #endif /* SQLITE_UNTESTABLE */
169265 return rc;
169266 }
@@ -230441,11 +230501,11 @@
230441 int nArg, /* Number of args */
230442 sqlite3_value **apUnused /* Function arguments */
230443 ){
230444 assert( nArg==0 );
230445 UNUSED_PARAM2(nArg, apUnused);
230446 sqlite3_result_text(pCtx, "fts5: 2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1", -1, SQLITE_TRANSIENT);
230447 }
230448
230449 /*
230450 ** Return true if zName is the extension on one of the shadow tables used
230451 ** by this module.
@@ -235367,12 +235427,12 @@
235367 }
235368 #endif /* SQLITE_CORE */
235369 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
235370
235371 /************** End of stmt.c ************************************************/
235372 #if __LINE__!=235372
235373 #undef SQLITE_SOURCE_ID
235374 #define SQLITE_SOURCE_ID "2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258balt2"
235375 #endif
235376 /* Return the source-id for this library */
235377 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
235378 /************************** End of sqlite3.c ******************************/
235379
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1205,11 +1205,11 @@
1205 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1206 ** [sqlite_version()] and [sqlite_source_id()].
1207 */
1208 #define SQLITE_VERSION "3.36.0"
1209 #define SQLITE_VERSION_NUMBER 3036000
1210 #define SQLITE_SOURCE_ID "2021-06-07 00:41:18 2aa9368b63b42ac7c700516f109edcc6098c12b850eae591afed4e51a3f41819"
1211
1212 /*
1213 ** CAPI3REF: Run-Time Library Version Numbers
1214 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1215 **
@@ -6213,21 +6213,19 @@
6213 ** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
6214 ** flag, which if present prevents the function from being invoked from
6215 ** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
6216 ** index expressions, or the WHERE clause of partial indexes.
6217 **
 
6218 ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
6219 ** all application-defined SQL functions that do not need to be
6220 ** used inside of triggers, view, CHECK constraints, or other elements of
6221 ** the database schema. This flags is especially recommended for SQL
6222 ** functions that have side effects or reveal internal application state.
6223 ** Without this flag, an attacker might be able to modify the schema of
6224 ** a database file to include invocations of the function with parameters
6225 ** chosen by the attacker, which the application will then execute when
6226 ** the database file is opened and read.
 
6227 **
6228 ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
6229 ** function can gain access to this pointer using [sqlite3_user_data()].)^
6230 **
6231 ** ^The sixth, seventh and eighth parameters passed to the three
@@ -8891,11 +8889,12 @@
8889 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
8890 #define SQLITE_TESTCTRL_PRNG_SEED 28
8891 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
8892 #define SQLITE_TESTCTRL_SEEK_COUNT 30
8893 #define SQLITE_TESTCTRL_TRACEFLAGS 31
8894 #define SQLITE_TESTCTRL_TUNE 32
8895 #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
8896
8897 /*
8898 ** CAPI3REF: SQL Keyword Checking
8899 **
8900 ** These routines provide access to the set of SQL language keywords
@@ -17314,10 +17313,11 @@
17313 #define SQLITE_PushDown 0x00001000 /* The push-down optimization */
17314 #define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
17315 #define SQLITE_SkipScan 0x00004000 /* Skip-scans */
17316 #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
17317 #define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
17318 #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
17319 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17320
17321 /*
17322 ** Macros for testing whether or not optimizations are enabled or disabled.
17323 */
@@ -19323,10 +19323,26 @@
19323 ** Allowed values for mInitFlags
19324 */
19325 #define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
19326 #define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
19327
19328 /* Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled
19329 ** on debug-builds of the CLI using ".testctrl tune ID VALUE". Tuning
19330 ** parameters are for temporary use during development, to help find
19331 ** optimial values for parameters in the query planner. The should not
19332 ** be used on trunk check-ins. They are a temporary mechanism available
19333 ** for transient development builds only.
19334 **
19335 ** Tuning parameters are numbered starting with 1.
19336 */
19337 #define SQLITE_NTUNE 6 /* Should be zero for all trunk check-ins */
19338 #ifdef SQLITE_DEBUG
19339 # define Tuning(X) (sqlite3Config.aTune[(X)-1])
19340 #else
19341 # define Tuning(X) 0
19342 #endif
19343
19344 /*
19345 ** Structure containing global configuration data for the SQLite library.
19346 **
19347 ** This structure also contains some state information.
19348 */
@@ -19387,10 +19403,14 @@
19403 #endif
19404 int bLocaltimeFault; /* True to fail localtime() calls */
19405 int iOnceResetThreshold; /* When to reset OP_Once counters */
19406 u32 szSorterRef; /* Min size in bytes to use sorter-refs */
19407 unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */
19408 /* vvvv--- must be last ---vvv */
19409 #ifdef SQLITE_DEBUG
19410 sqlite3_int64 aTune[SQLITE_NTUNE]; /* Tuning parameters */
19411 #endif
19412 };
19413
19414 /*
19415 ** This macro is used inside of assert() statements to indicate that
19416 ** the assert is only valid on a well-formed database. Instead of:
@@ -90937,12 +90957,11 @@
90957 assert( pOp[1].opcode==OP_SeekGE );
90958
90959 /* pOp->p2 points to the first instruction past the OP_IdxGT that
90960 ** follows the OP_SeekGE. */
90961 assert( pOp->p2>=(int)(pOp-aOp)+2 );
90962 assert( aOp[pOp->p2-1].opcode==OP_IdxGT );
 
90963 assert( pOp[1].p1==aOp[pOp->p2-1].p1 );
90964 assert( pOp[1].p2==aOp[pOp->p2-1].p2 );
90965 assert( pOp[1].p3==aOp[pOp->p2-1].p3 );
90966
90967 assert( pOp->p1>0 );
@@ -101823,11 +101842,11 @@
101842 regRight = exprCodeSubselect(pParse, pRight);
101843
101844 sqlite3VdbeAddOp2(v, OP_Integer, 1, dest);
101845 for(i=0; 1 /*Loop exits by "break"*/; i++){
101846 int regFree1 = 0, regFree2 = 0;
101847 Expr *pL = 0, *pR = 0;
101848 int r1, r2;
101849 assert( i>=0 && i<nLeft );
101850 if( addrCmp ) sqlite3VdbeJumpHere(v, addrCmp);
101851 r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
101852 r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
@@ -108284,11 +108303,11 @@
108303 Parse *pParse,
108304 struct RenameCtx *pCtx,
108305 void *pPtr
108306 ){
108307 RenameToken **pp;
108308 if( NEVER(pPtr==0) ){
108309 return 0;
108310 }
108311 for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
108312 if( (*pp)->p==pPtr ){
108313 RenameToken *pToken = *pp;
@@ -108838,13 +108857,15 @@
108857 int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName);
108858 FKey *pFKey;
108859 assert( sParse.pNewTable->pSelect==0 );
108860 sCtx.pTab = sParse.pNewTable;
108861 if( bFKOnly==0 ){
108862 if( iCol<sParse.pNewTable->nCol ){
108863 renameTokenFind(
108864 &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName
108865 );
108866 }
108867 if( sCtx.iCol<0 ){
108868 renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey);
108869 }
108870 sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck);
108871 for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){
@@ -151728,11 +151749,11 @@
151749 }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
151750 /* "x IN (value, value, ...)" */
151751 nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
151752 }
151753 if( pProbe->hasStat1 && rLogSize>=10 ){
151754 LogEst M, logK, x;
151755 /* Let:
151756 ** N = the total number of rows in the table
151757 ** K = the number of entries on the RHS of the IN operator
151758 ** M = the number of rows in the table that match terms to the
151759 ** to the left in the same index. If the IN operator is on
@@ -151751,20 +151772,29 @@
151772 ** the index. Do not bother with this optimization on very small
151773 ** tables (less than 2 rows) as it is pointless in that case.
151774 */
151775 M = pProbe->aiRowLogEst[saved_nEq];
151776 logK = estLog(nIn);
151777 /* TUNING v----- 10 to bias toward indexed IN */
151778 x = M + logK + 10 - (nIn + rLogSize);
151779 if( x>=0 ){
151780 WHERETRACE(0x40,
151781 ("IN operator (N=%d M=%d logK=%d nIn=%d rLogSize=%d x=%d) "
151782 "prefers indexed lookup\n",
151783 saved_nEq, M, logK, nIn, rLogSize, x));
151784 }else if( nInMul<2 && OptimizationEnabled(db, SQLITE_SeekScan) ){
151785 WHERETRACE(0x40,
151786 ("IN operator (N=%d M=%d logK=%d nIn=%d rLogSize=%d x=%d"
151787 " nInMul=%d) prefers skip-scan\n",
151788 saved_nEq, M, logK, nIn, rLogSize, x, nInMul));
151789 pNew->wsFlags |= WHERE_IN_SEEKSCAN;
151790 }else{
151791 WHERETRACE(0x40,
151792 ("IN operator (N=%d M=%d logK=%d nIn=%d rLogSize=%d x=%d"
151793 " nInMul=%d) prefers normal scan\n",
151794 saved_nEq, M, logK, nIn, rLogSize, x, nInMul));
151795 continue;
151796 }
151797 }
151798 pNew->wsFlags |= WHERE_COLUMN_IN;
151799 }else if( eOp & (WO_EQ|WO_IS) ){
151800 int iCol = pProbe->aiColumn[saved_nEq];
@@ -169257,10 +169287,40 @@
169287 case 2: *ptr = sqlite3WhereTrace; break;
169288 case 3: sqlite3WhereTrace = *ptr; break;
169289 }
169290 break;
169291 }
169292
169293 #ifdef SQLITE_DEBUG
169294 /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
169295 **
169296 ** If "id" is an integer between 1 and SQLITE_NTUNE then set the value
169297 ** of the id-th tuning parameter to *piValue. If "id" is between -1
169298 ** and -SQLITE_NTUNE, then write the current value of the (-id)-th
169299 ** tuning parameter into *piValue.
169300 **
169301 ** Tuning parameters are for use during transient development builds,
169302 ** to help find the best values for constants in the query planner.
169303 ** Access tuning parameters using the Tuning(ID) macro. Set the
169304 ** parameters in the CLI using ".testctrl tune ID VALUE".
169305 **
169306 ** Transient use only. Tuning parameters should not be used in
169307 ** checked-in code.
169308 */
169309 case SQLITE_TESTCTRL_TUNE: {
169310 int id = va_arg(ap, int);
169311 int *piValue = va_arg(ap, int*);
169312 if( id>0 && id<=SQLITE_NTUNE ){
169313 Tuning(id) = *piValue;
169314 }else if( id<0 && id>=-SQLITE_NTUNE ){
169315 *piValue = Tuning(-id);
169316 }else{
169317 rc = SQLITE_NOTFOUND;
169318 }
169319 break;
169320 }
169321 #endif
169322 }
169323 va_end(ap);
169324 #endif /* SQLITE_UNTESTABLE */
169325 return rc;
169326 }
@@ -230441,11 +230501,11 @@
230501 int nArg, /* Number of args */
230502 sqlite3_value **apUnused /* Function arguments */
230503 ){
230504 assert( nArg==0 );
230505 UNUSED_PARAM2(nArg, apUnused);
230506 sqlite3_result_text(pCtx, "fts5: 2021-06-04 23:26:56 1c71de43dbc68002c4a6229e7efffb019655baff67a51fe922571fe420c95835", -1, SQLITE_TRANSIENT);
230507 }
230508
230509 /*
230510 ** Return true if zName is the extension on one of the shadow tables used
230511 ** by this module.
@@ -235367,12 +235427,12 @@
235427 }
235428 #endif /* SQLITE_CORE */
235429 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
235430
235431 /************** End of stmt.c ************************************************/
235432 #if __LINE__!=235432
235433 #undef SQLITE_SOURCE_ID
235434 #define SQLITE_SOURCE_ID "2021-06-07 00:41:18 2aa9368b63b42ac7c700516f109edcc6098c12b850eae591afed4e51a3f4alt2"
235435 #endif
235436 /* Return the source-id for this library */
235437 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
235438 /************************** End of sqlite3.c ******************************/
235439
+3 -4
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.36.0"
127127
#define SQLITE_VERSION_NUMBER 3036000
128
-#define SQLITE_SOURCE_ID "2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1"
128
+#define SQLITE_SOURCE_ID "2021-06-07 00:41:18 2aa9368b63b42ac7c700516f109edcc6098c12b850eae591afed4e51a3f41819"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -5131,21 +5131,19 @@
51315131
** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
51325132
** flag, which if present prevents the function from being invoked from
51335133
** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
51345134
** index expressions, or the WHERE clause of partial indexes.
51355135
**
5136
-** <span style="background-color:#ffff90;">
51375136
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
51385137
** all application-defined SQL functions that do not need to be
51395138
** used inside of triggers, view, CHECK constraints, or other elements of
51405139
** the database schema. This flags is especially recommended for SQL
51415140
** functions that have side effects or reveal internal application state.
51425141
** Without this flag, an attacker might be able to modify the schema of
51435142
** a database file to include invocations of the function with parameters
51445143
** chosen by the attacker, which the application will then execute when
51455144
** the database file is opened and read.
5146
-** </span>
51475145
**
51485146
** ^(The fifth parameter is an arbitrary pointer. The implementation of the
51495147
** function can gain access to this pointer using [sqlite3_user_data()].)^
51505148
**
51515149
** ^The sixth, seventh and eighth parameters passed to the three
@@ -7809,11 +7807,12 @@
78097807
#define SQLITE_TESTCTRL_RESULT_INTREAL 27
78107808
#define SQLITE_TESTCTRL_PRNG_SEED 28
78117809
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
78127810
#define SQLITE_TESTCTRL_SEEK_COUNT 30
78137811
#define SQLITE_TESTCTRL_TRACEFLAGS 31
7814
-#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
7812
+#define SQLITE_TESTCTRL_TUNE 32
7813
+#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
78157814
78167815
/*
78177816
** CAPI3REF: SQL Keyword Checking
78187817
**
78197818
** These routines provide access to the set of SQL language keywords
78207819
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.36.0"
127 #define SQLITE_VERSION_NUMBER 3036000
128 #define SQLITE_SOURCE_ID "2021-06-03 18:56:42 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -5131,21 +5131,19 @@
5131 ** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
5132 ** flag, which if present prevents the function from being invoked from
5133 ** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
5134 ** index expressions, or the WHERE clause of partial indexes.
5135 **
5136 ** <span style="background-color:#ffff90;">
5137 ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
5138 ** all application-defined SQL functions that do not need to be
5139 ** used inside of triggers, view, CHECK constraints, or other elements of
5140 ** the database schema. This flags is especially recommended for SQL
5141 ** functions that have side effects or reveal internal application state.
5142 ** Without this flag, an attacker might be able to modify the schema of
5143 ** a database file to include invocations of the function with parameters
5144 ** chosen by the attacker, which the application will then execute when
5145 ** the database file is opened and read.
5146 ** </span>
5147 **
5148 ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
5149 ** function can gain access to this pointer using [sqlite3_user_data()].)^
5150 **
5151 ** ^The sixth, seventh and eighth parameters passed to the three
@@ -7809,11 +7807,12 @@
7809 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
7810 #define SQLITE_TESTCTRL_PRNG_SEED 28
7811 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7812 #define SQLITE_TESTCTRL_SEEK_COUNT 30
7813 #define SQLITE_TESTCTRL_TRACEFLAGS 31
7814 #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
 
7815
7816 /*
7817 ** CAPI3REF: SQL Keyword Checking
7818 **
7819 ** These routines provide access to the set of SQL language keywords
7820
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.36.0"
127 #define SQLITE_VERSION_NUMBER 3036000
128 #define SQLITE_SOURCE_ID "2021-06-07 00:41:18 2aa9368b63b42ac7c700516f109edcc6098c12b850eae591afed4e51a3f41819"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -5131,21 +5131,19 @@
5131 ** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
5132 ** flag, which if present prevents the function from being invoked from
5133 ** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
5134 ** index expressions, or the WHERE clause of partial indexes.
5135 **
 
5136 ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
5137 ** all application-defined SQL functions that do not need to be
5138 ** used inside of triggers, view, CHECK constraints, or other elements of
5139 ** the database schema. This flags is especially recommended for SQL
5140 ** functions that have side effects or reveal internal application state.
5141 ** Without this flag, an attacker might be able to modify the schema of
5142 ** a database file to include invocations of the function with parameters
5143 ** chosen by the attacker, which the application will then execute when
5144 ** the database file is opened and read.
 
5145 **
5146 ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
5147 ** function can gain access to this pointer using [sqlite3_user_data()].)^
5148 **
5149 ** ^The sixth, seventh and eighth parameters passed to the three
@@ -7809,11 +7807,12 @@
7807 #define SQLITE_TESTCTRL_RESULT_INTREAL 27
7808 #define SQLITE_TESTCTRL_PRNG_SEED 28
7809 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7810 #define SQLITE_TESTCTRL_SEEK_COUNT 30
7811 #define SQLITE_TESTCTRL_TRACEFLAGS 31
7812 #define SQLITE_TESTCTRL_TUNE 32
7813 #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
7814
7815 /*
7816 ** CAPI3REF: SQL Keyword Checking
7817 **
7818 ** These routines provide access to the set of SQL language keywords
7819

Keyboard Shortcuts

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