10000 Snapshot of upstream SQLite 3.32.0 · sqlcipher/sqlcipher@5e3132e · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e3132e

Browse files
committed
Snapshot of upstream SQLite 3.32.0
1 parent 04c4033 commit 5e3132e

File tree

151 files changed

+6024
-1651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+6024
-1651
lines changed

Makefile.in

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
190190
table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
191191
update.lo userauth.lo upsert.lo util.lo vacuum.lo \
192192
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
193-
vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
193+
vdbetrace.lo vdbevtab.lo \
194+
wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
194195
window.lo utf.lo vtab.lo
195196

196197
# Object files for the amalgamation.
@@ -296,6 +297,7 @@ SRC = \
296297
$(TOP)/src/vdbemem.c \
297298
$(TOP)/src/vdbesort.c \
298299
$(TOP)/src/vdbetrace.c \
300+
$(TOP)/src/vdbevtab.c \
299301
$(TOP)/src/vdbeInt.h \
300302
$(TOP)/src/vtab.c \
301303
$(TOP)/src/vxworks.h \
@@ -502,6 +504,7 @@ TESTSRC2 = \
502504
$(TOP)/src/vdbe.c \
503505
$(TOP)/src/vdbemem.c \
504506
$(TOP)/src/vdbetrace.c \
507+
$(TOP)/src/vdbevtab.c \
505508
$(TOP)/src/where.c \
506509
$(TOP)/src/wherecode.c \
507510
$(TOP)/src/whereexpr.c \
@@ -607,6 +610,7 @@ SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
607610
SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
608611
SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
609612
SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
613+
SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
610614
SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
611615
SHELL_OPT += -DSQLITE_ENABLE_DESERIALIZE
612616
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
@@ -615,10 +619,12 @@ FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
615619
FUZZCHECK_OPT += -DSQLITE_PRINTF_PRECISION_LIMIT=1000
616620
FUZZCHECK_OPT += -DSQLITE_ENABLE_DESERIALIZE
617621
FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS4
622+
FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS3_PARENTHESIS
618623
#FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS5
619624
FUZZCHECK_OPT += -DSQLITE_ENABLE_RTREE
620625
FUZZCHECK_OPT += -DSQLITE_ENABLE_GEOPOLY
621626
FUZZCHECK_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
627+
FUZZCHECK_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
622628
FUZZCHECK_SRC = $(TOP)/test/fuzzcheck.c $(TOP)/test/ossfuzz.c
623629
DBFUZZ_OPT =
624630

@@ -688,6 +694,7 @@ DBFUZZ2_OPTS = \
688694
-DSQLITE_ENABLE_DESERIALIZE \
689695
-DSQLITE_DEBUG \
690696
-DSQLITE_ENABLE_DBSTAT_VTAB \
697+
-DSQLITE_ENABLE_BYTECODE_VTAB \
691698
-DSQLITE_ENABLE_RTREE \
692699
-DSQLITE_ENABLE_FTS4 \
693700
-DSQLITE_ENABLE_FTS5
@@ -1004,6 +1011,9 @@ vdbesort.lo: $(TOP)/src/vdbesort.c $(HDR)
10041011
vdbetrace.lo: $(TOP)/src/vdbetrace.c $(HDR)
10051012
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbetrace.c
10061013

1014+
vdbevtab.lo: $(TOP)/src/vdbevtab.c $(HDR)
1015+
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbevtab.c
1016+
10071017
vtab.lo: $(TOP)/src/vtab.c $(HDR)
10081018
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vtab.c
10091019

@@ -1069,6 +1079,7 @@ SHELL_SRC = \
10691079
$(TOP)/ext/misc/fileio.c \
10701080
$(TOP)/ext/misc/completion.c \
10711081
$(TOP)/ext/misc/sqlar.c \
1082+
$(TOP)/ext/misc/uint.c \
10721083
$(TOP)/ext/expert/sqlite3expert.c \
10731084
$(TOP)/ext/expert/sqlite3expert.h \
10741085
$(TOP)/ext/misc/zipfile.c \
@@ -1210,6 +1221,7 @@ TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
12101221
TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
12111222
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB
12121223
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DBPAGE_VTAB
1224+
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_BYTECODE_VTAB
12131225
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DESERIALIZE
12141226

12151227
TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la

Makefile.msc

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ OSTRACE = 0
234234
DEBUG = 0
235235
!ENDIF
236236

237+
# <<mark>>
238+
# Disable use of the --linemacros argument to the mksqlite3c.tcl tool, which
239+
# is used to build the amalgamation.
240+
#
241+
!IFNDEF NO_LINEMACROS
242+
NO_LINEMACROS = 0
243+
!ENDIF
244+
# <</mark>>
245+
237246
# Enable use of available compiler optimizations? Normally, this should be
238247
# non-zero. Setting this to zero, thus disabling all compiler optimizations,
239248
# can be useful for testing.
@@ -357,6 +366,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
357366
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
358367
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
359368
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
369+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
360370
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1
361371
!ENDIF
362372
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
@@ -775,7 +785,7 @@ MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c.tcl
775785
!ENDIF
776786

777787
!IFNDEF MKSQLITE3C_ARGS
778-
!IF $(DEBUG)>1
788+
!IF $(DEBUG)>1 && $(NO_LINEMACROS)==0
779789
MKSQLITE3C_ARGS = --linemacros
780790
!ELSE
781791
MKSQLITE3C_ARGS =
@@ -1246,7 +1256,8 @@ LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
12461256
table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
12471257
update.lo upsert.lo util.lo vacuum.lo \
12481258
vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
1249-
vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
1259+
vdbetrace.lo vdbevtab.lo wal.lo walker.lo where.lo wherecode.lo \
1260+
whereexpr.lo \
12501261
window.lo utf.lo vtab.lo
12511262
# <</mark>>
12521263

@@ -1353,6 +1364,7 @@ SRC01 = \
13531364
$(TOP)\src\vdbemem.c \
13541365
$(TOP)\src\vdbesort.c \
13551366
$(TOP)\src\vdbetrace.c \
1367+
$(TOP)\src\vdbevtab.c \
13561368
$(TOP)\src\vtab.c \
13571369
$(TOP)\src\wal.c \
13581370
$(TOP)\src\walker.c \
@@ -1684,6 +1696,7 @@ FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS4
16841696
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_RTREE
16851697
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_GEOPOLY
16861698
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBSTAT_VTAB
1699+
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
16871700

16881701
FUZZCHECK_SRC = $(TOP)\test\fuzzcheck.c $(TOP)\test\ossfuzz.c
16891702
OSSSHELL_SRC = $(TOP)\test\ossshell.c $(TOP)\test\ossfuzz.c
@@ -2109,6 +2122,9 @@ vdbesort.lo: $(TOP)\src\vdbesort.c $(HDR)
21092122
vdbetrace.lo: $(TOP)\src\vdbetrace.c $(HDR)
21102123
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbetrace.c
21112124

2125+
vdbevtab.lo: $(TOP)\src\vdbevtab.c $(HDR)
2126+
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbevtab.c
2127+
21122128
vtab.lo: $(TOP)\src\vtab.c $(HDR)
21132129
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vtab.c
21142130

@@ -2182,6 +2198,7 @@ SHELL_SRC = \
21822198
$(TOP)\ext\misc\shathree.c \
21832199
$(TOP)\ext\misc\fileio.c \
21842200
$(TOP)\ext\misc\completion.c \
2201+
$(TOP)\ext\misc\uint.c \
21852202
$(TOP)\ext\expert\sqlite3expert.c \
21862203
$(TOP)\ext\expert\sqlite3expert.h \
21872204
$(TOP)\ext\misc\memtrace.c \
@@ -2352,6 +2369,7 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
23522369
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
23532370
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
23542371
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
2372+
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
23552373
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
23562374
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1
23572375
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)

autoconf/Makefile.msc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ OSTRACE = 0
196196
DEBUG = 0
197197
!ENDIF
198198

199+
199200
# Enable use of available compiler optimizations? Normally, this should be
200201
# non-zero. Setting this to zero, thus disabling all compiler optimizations,
201202
# can be useful for testing.
@@ -288,6 +289,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
288289
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
289290
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
290291
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
292+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
291293
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1
292294
!ENDIF
293295
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1

doc/lemon.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ <h3>Command Line Options</h3>
123123
<li><b>-r</b>
124124
Do not sort or renumber the parser states as part of optimization.
125125
<li><b>-s</b>
126-
Show parser statistics before existing.
126+
Show parser statistics before exiting.
127127
<li><b>-T<i>file</i></b>
128128
Use <i>file</i> as the template for the generated C-code parser implementation.
129129
<li><b>-x</b>
@@ -488,7 +488,7 @@ <h3>Precedence Rules</h3>
488488
The precedence of a grammar rule is equal to the precedence of the
489489
left-most terminal symbol in the rule for which a precedence is
490490
defined. This is normally what you want, but in those cases where
491-
you want to precedence of a grammar rule to be something different,
491+
you want the precedence of a grammar rule to be something different,
492492
you can specify an alternative precedence symbol by putting the
493493
symbol in square braces after the period at the end of the rule and
494494
before any C-code. For example:</p>
@@ -689,7 +689,7 @@ <h4>The <tt>%extra_argument</tt> directive</h4>
689689
<a name='extractx'></a>
690690
<h4>The <tt>%extra_context</tt> directive</h4>
691691

692-
The <tt>%extra_context</tt> directive instructs Lemon to add a 2th parameter
692+
The <tt>%extra_context</tt> directive instructs Lemon to add a 2nd parameter
693693
to the parameter list of the ParseAlloc() and ParseInif() functions. Lemon
694694
doesn't do anything itself with these extra argument, but it does
695695
store the value make it available to C-code action routines, destructors,
@@ -699,9 +699,9 @@ <h4>The <tt>%extra_context</tt> directive</h4>
699699
%extra_context { MyStruct *pAbc }
700700
</pre></p>
701701

702-
<p>Then the ParseAlloc() and ParseInit() functions will have an 2th parameter
702+
<p>Then the ParseAlloc() and ParseInit() functions will have an 2nd parameter
703703
of type "MyStruct*" and all action routines will have access to
704-
a variable named "pAbc" that is the value of that 2th parameter.</p>
704+
a variable named "pAbc" that is the value of that 2nd parameter.</p>
705705

706706
<p>The <tt>%extra_argument</tt> directive works the same except that it
707707
is passed in on the Parse() routine instead of on ParseAlloc()/ParseInit().
@@ -996,7 +996,7 @@ <h4>The <tt>%token_type</tt> and <tt>%type</tt> directives</h4>
996996
symbols. The values of all terminal symbols must be of the same
997997
type. This turns out to be the same data type as the 3rd parameter
998998
to the Parse() function generated by Lemon. Typically, you will
999-
make the value of a terminal symbol by a pointer to some kind of
999+
make the value of a terminal symbol be a pointer to some kind of
10001000
token structure. Like this:</p>
10011001

10021002
<p><pre>

ext/expert/expert1.test

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ proc squish {txt} {
3737

3838
proc do_setup_rec_test {tn setup sql res} {
3939
reset_db
40+
if {[info exists ::set_main_db_name]} {
41+
dbconfig_maindbname_icecube db
42+
}
4043
db eval $setup
4144
uplevel [list do_rec_test $tn $sql $res]
4245
}
@@ -76,6 +79,10 @@ foreach {tn setup} {
7679
}
7780
}
7881
3 {
82+
if {[info commands sqlite3_expert_new]==""} { continue }
83+
set ::set_main_db_name 1
84+
}
85+
4 {
7986
if {![file executable $CLI]} { continue }
8087

8188
proc do_rec_test {tn sql res} {
@@ -336,7 +343,7 @@ proc do_candidates_test {tn sql res} {
336343

337344

338345
reset_db
339-
do_execsql_test 4.0 {
346+
do_execsql_test 5.0 {
340347
CREATE TABLE t1(a, b);
341348
CREATE TABLE t2(c, d);
342349

@@ -346,7 +353,7 @@ do_execsql_test 4.0 {
346353
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100)
347354
INSERT INTO t2 SELECT (i-1)/20, (i-1)/5 FROM s;
348355
}
349-
do_candidates_test 4.1 {
356+
do_candidates_test 5.1 {
350357
SELECT * FROM t1,t2 WHERE (b=? OR a=?) AND (c=? OR d=?)
351358
} {
352359
CREATE INDEX t1_idx_00000062 ON t1(b); -- stat1: 100 20
@@ -355,14 +362,14 @@ do_candidates_test 4.1 {
355362
CREATE INDEX t2_idx_00000064 ON t2(d); -- stat1: 100 5
356363
}
357364

358-
do_candidates_test 4.2 {
365+
do_candidates_test 5.2 {
359366
SELECT * FROM t1,t2 WHERE a=? AND b=? AND c=? AND d=?
360367
} {
361368
CREATE INDEX t1_idx_000123a7 ON t1(a, b); -- stat1: 100 50 17
362369
CREATE INDEX t2_idx_0001295b ON t2(c, d); -- stat1: 100 20 5
363370
}
364371

365-
do_execsql_test 4.3 {
372+
do_execsql_test 5.3 {
366373
CREATE INDEX t1_idx_00000061 ON t1(a); -- stat1: 100 50
367374
CREATE INDEX t1_idx_00000062 ON t1(b); -- stat1: 100 20
368375
CREATE INDEX t1_idx_000123a7 ON t1(a, b); -- stat1: 100 50 16

ext/expert/sqlite3expert.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,14 +1128,19 @@ int idxFindIndexes(
11281128
/* int iParent = sqlite3_column_int(pExplain, 1); */
11291129
/* int iNotUsed = sqlite3_column_int(pExplain, 2); */
11301130
const char *zDetail = (const char*)sqlite3_column_text(pExplain, 3);
1131-
int nDetail = STRLEN(zDetail);
1131+
int nDetail;
11321132
int i;
11331133

1134+
if( !zDetail ) continue;
1135+
nDetail = STRLEN(zDetail);
1136+
11341137
for(i=0; i<nDetail; i++){
11351138
const char *zIdx = 0;
1136-
if( memcmp(&zDetail[i], " USING INDEX ", 13)==0 ){
1139+
if( i+13<nDetail && memcmp(&zDetail[i], " USING INDEX ", 13)==0 ){
11371140
zIdx = &zDetail[i+13];
1138-
}else if( memcmp(&zDetail[i], " USING COVERING INDEX ", 22)==0 ){
1141+
}else if( i+22<nDetail
1142+
&& memcmp(&zDetail[i], " USING COVERING INDEX ", 22)==0
1143+
){
11391144
zIdx = &zDetail[i+22];
11401145
}
11411146
if( zIdx ){
@@ -1950,4 +1955,4 @@ void sqlite3_expert_destroy(sqlite3expert *p){
19501955
}
19511956
}
19521957

1953-
#endif /* ifndef SQLITE_OMIT_VIRTUAL_TABLE */
1958+
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */

0 commit comments

Comments
 (0)
0