Skip to content

Commit 5394d77

Browse files
Update SQLite to 3.16.1
1 parent eb6c681 commit 5394d77

File tree

145 files changed

+7475
-2485
lines changed

Some content is hidden

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

145 files changed

+7475
-2485
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ If you need a specific version of SQLite, or specific SQLite compilation options
88

99

1010

11-
**December 3, 2016: Update SQLite to 3.15.2** ([changelog](CHANGELOG.md)).
11+
**January 3, 2017: Update SQLite to 3.16.1** ([changelog](CHANGELOG.md)).
1212

1313
**Requirements**: iOS 8.0+ / OSX 10.9+, Xcode 7.3+
1414

15-
**SQLite Included:** **[3.15.2](https://www.sqlite.org/releaselog/3_15_2.html)**
15+
**SQLite Included:** **[3.16.1](https://www.sqlite.org/releaselog/3_16_1.html)**
1616

1717

1818

@@ -65,7 +65,7 @@ There is no need to modify any other files.
6565

6666
#### Compiling a Specific Version of SQLite:
6767

68-
SQLiteLib currently ships with the source for SQLite 3.15.2.
68+
SQLiteLib currently ships with the source for SQLite 3.16.1.
6969

7070
If you'd like to compile a newer (or older) version, the process is simple:
7171

@@ -127,7 +127,7 @@ The built-in OSX/iOS version of SQLite were built with the following compilation
127127

128128
SQLiteLib uses these settings with one exception - on iOS:
129129

130-
The SQLite code (verified in: 3.15.2) uses a deprecated function (`gethostuuid()`).
130+
The SQLite code uses a deprecated function (`gethostuuid()`).
131131

132132
D. Richard Hipp (SQLite architect), suggests working around this on iOS using `-DSQLITE_ENABLE_LOCKING_STYLE=0`:
133133
> "The SQLITE_ENABLE_LOCKING_STYLE thing is an apple-only extension that

sqlite/Makefile.in

+20-6
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ TESTSRC += \
430430
$(TOP)/ext/misc/nextchar.c \
431431
$(TOP)/ext/misc/percentile.c \
432432
$(TOP)/ext/misc/regexp.c \
433+
$(TOP)/ext/misc/remember.c \
433434
$(TOP)/ext/misc/series.c \
434435
$(TOP)/ext/misc/spellfix.c \
435436
$(TOP)/ext/misc/totype.c \
@@ -550,7 +551,8 @@ FUZZDATA = \
550551
$(TOP)/test/fuzzdata1.db \
551552
$(TOP)/test/fuzzdata2.db \
552553
$(TOP)/test/fuzzdata3.db \
553-
$(TOP)/test/fuzzdata4.db
554+
$(TOP)/test/fuzzdata4.db \
555+
$(TOP)/test/fuzzdata5.db
554556

555557
# Standard options to testfixture
556558
#
@@ -563,7 +565,9 @@ SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4
563565
SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
564566
SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
565567
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
566-
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
568+
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
569+
FUZZCHECK_SRC = $(TOP)/test/fuzzcheck.c $(TOP)/test/ossfuzz.c
570+
DBFUZZ_OPT =
567571

568572
# This is the default Makefile target. The objects listed here
569573
# are what get build when you type just "make" with no arguments.
@@ -612,8 +616,14 @@ fuzzershell$(TEXE): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
612616
$(LTLINK) -o $@ $(FUZZERSHELL_OPT) \
613617
$(TOP)/tool/fuzzershell.c sqlite3.c $(TLIBS)
614618

615-
fuzzcheck$(TEXE): $(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
616-
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS)
619+
fuzzcheck$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h
620+
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS)
621+
622+
ossshell$(TEXE): $(TOP)/test/ossfuzz.c $(TOP)/test/ossshell.c sqlite3.c sqlite3.h
623+
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c sqlite3.c sqlite3.h $(TLIBS)
624+
625+
dbfuzz$(TEXE): $(TOP)/test/dbfuzz.c sqlite3.c sqlite3.h
626+
$(LTLINK) -o $@ $(DBFUZZ_OPT) $(TOP)/test/dbfuzz.c sqlite3.c $(TLIBS)
617627

618628
mptester$(TEXE): sqlite3.lo $(TOP)/mptest/mptest.c
619629
$(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.lo \
@@ -1103,6 +1113,11 @@ fastfuzztest: fuzzcheck$(TEXE) $(FUZZDATA)
11031113
valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA)
11041114
valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
11051115

1116+
# The veryquick.test TCL tests.
1117+
#
1118+
tcltest: ./testfixture$(TEXE)
1119+
./testfixture$(TEXE) $(TOP)/test/veryquick.test $(TESTOPTS)
1120+
11061121
# Minimal testing that runs in less than 3 minutes
11071122
#
11081123
quicktest: ./testfixture$(TEXE)
@@ -1111,8 +1126,7 @@ quicktest: ./testfixture$(TEXE)
11111126
# This is the common case. Run many tests that do not take too long,
11121127
# including fuzzcheck, sqlite3_analyzer, and sqldiff tests.
11131128
#
1114-
test: $(TESTPROGS) sourcetest fastfuzztest
1115-
./testfixture$(TEXE) $(TOP)/test/veryquick.test $(TESTOPTS)
1129+
test: fastfuzztest sourcetest $(TESTPROGS) tcltest
11161130

11171131
# Run a test using valgrind. This can take a really long time
11181132
# because valgrind is so much slower than a native machine.

sqlite/Makefile.msc

+11-4
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ TESTEXT = \
13961396
$(TOP)\ext\misc\nextchar.c \
13971397
$(TOP)\ext\misc\percentile.c \
13981398
$(TOP)\ext\misc\regexp.c \
1399+
$(TOP)\ext\misc\remember.c \
13991400
$(TOP)\ext\misc\series.c \
14001401
$(TOP)\ext\misc\spellfix.c \
14011402
$(TOP)\ext\misc\totype.c \
@@ -1479,7 +1480,8 @@ FUZZDATA = \
14791480
$(TOP)\test\fuzzdata1.db \
14801481
$(TOP)\test\fuzzdata2.db \
14811482
$(TOP)\test\fuzzdata3.db \
1482-
$(TOP)\test\fuzzdata4.db
1483+
$(TOP)\test\fuzzdata4.db \
1484+
$(TOP)\test\fuzzdata5.db
14831485
# <</mark>>
14841486

14851487
# Additional compiler options for the shell. These are only effective
@@ -1494,7 +1496,9 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_
14941496
#
14951497
MPTESTER_COMPILE_OPTS = -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS5
14961498
FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
1497-
FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
1499+
FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
1500+
FUZZCHECK_SRC = $(TOP)\test\fuzzcheck.c $(TOP)\test\ossfuzz.c
1501+
OSSSHELL_SRC = $(TOP)\test\ossshell.c $(TOP)\test\ossfuzz.c
14981502

14991503
# Standard options to testfixture.
15001504
#
@@ -1564,8 +1568,11 @@ sourcetest: srcck1.exe sqlite3.c
15641568
fuzzershell.exe: $(TOP)\tool\fuzzershell.c $(SQLITE3C) $(SQLITE3H)
15651569
$(LTLINK) $(NO_WARN) $(FUZZERSHELL_COMPILE_OPTS) $(TOP)\tool\fuzzershell.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
15661570

1567-
fuzzcheck.exe: $(TOP)\test\fuzzcheck.c $(SQLITE3C) $(SQLITE3H)
1568-
$(LTLINK) $(NO_WARN) $(FUZZCHECK_COMPILE_OPTS) $(TOP)\test\fuzzcheck.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1571+
fuzzcheck.exe: $(FUZZCHECK_SRC) $(SQLITE3C) $(SQLITE3H)
1572+
$(LTLINK) $(NO_WARN) $(FUZZCHECK_COMPILE_OPTS) $(FUZZCHECK_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1573+
1574+
ossshell.exe: $(OSSSHELL_SRC) $(SQLITE3C) $(SQLITE3H)
1575+
$(LTLINK) $(NO_WARN) $(FUZZCHECK_COMPILE_OPTS) $(OSSSHELL_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
15691576

15701577
mptester.exe: $(TOP)\mptest\mptest.c $(SQLITE3C) $(SQLITE3H)
15711578
$(LTLINK) $(NO_WARN) $(MPTESTER_COMPILE_OPTS) $(TOP)\mptest\mptest.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)

sqlite/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.15.2
1+
3.16.1

sqlite/configure

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for sqlite 3.15.2.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.16.1.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
726726
# Identity of this package.
727727
PACKAGE_NAME='sqlite'
728728
PACKAGE_TARNAME='sqlite'
729-
PACKAGE_VERSION='3.15.2'
730-
PACKAGE_STRING='sqlite 3.15.2'
729+
PACKAGE_VERSION='3.16.1'
730+
PACKAGE_STRING='sqlite 3.16.1'
731731
PACKAGE_BUGREPORT=''
732732
PACKAGE_URL=''
733733

@@ -1463,7 +1463,7 @@ if test "$ac_init_help" = "long"; then
14631463
# Omit some internal or obsolete options to make the list less imposing.
14641464
# This message is too long to be a string in the A/UX 3.1 sh.
14651465
cat <<_ACEOF
1466-
\`configure' configures sqlite 3.15.2 to adapt to many kinds of systems.
1466+
\`configure' configures sqlite 3.16.1 to adapt to many kinds of systems.
14671467
14681468
Usage: $0 [OPTION]... [VAR=VALUE]...
14691469
@@ -1528,7 +1528,7 @@ fi
15281528

15291529
if test -n "$ac_init_help"; then
15301530
case $ac_init_help in
1531-
short | recursive ) echo "Configuration of sqlite 3.15.2:";;
1531+
short | recursive ) echo "Configuration of sqlite 3.16.1:";;
15321532
esac
15331533
cat <<\_ACEOF
15341534
@@ -1652,7 +1652,7 @@ fi
16521652
test -n "$ac_init_help" && exit $ac_status
16531653
if $ac_init_version; then
16541654
cat <<\_ACEOF
1655-
sqlite configure 3.15.2
1655+
sqlite configure 3.16.1
16561656
generated by GNU Autoconf 2.69
16571657
16581658
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2071,7 +2071,7 @@ cat >config.log <<_ACEOF
20712071
This file contains any messages produced by compilers while
20722072
running configure, to aid debugging if configure makes a mistake.
20732073
2074-
It was created by sqlite $as_me 3.15.2, which was
2074+
It was created by sqlite $as_me 3.16.1, which was
20752075
generated by GNU Autoconf 2.69. Invocation command line was
20762076
20772077
$ $0 $@
@@ -11252,7 +11252,7 @@ else
1125211252
fi
1125311253

1125411254
if test "${use_debug}" = "yes" ; then
11255-
TARGET_DEBUG="-DSQLITE_DEBUG=1"
11255+
TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE"
1125611256
else
1125711257
TARGET_DEBUG="-DNDEBUG"
1125811258
fi
@@ -12151,7 +12151,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1215112151
# report actual input values of CONFIG_FILES etc. instead of their
1215212152
# values after options handling.
1215312153
ac_log="
12154-
This file was extended by sqlite $as_me 3.15.2, which was
12154+
This file was extended by sqlite $as_me 3.16.1, which was
1215512155
generated by GNU Autoconf 2.69. Invocation command line was
1215612156
1215712157
CONFIG_FILES = $CONFIG_FILES
@@ -12217,7 +12217,7 @@ _ACEOF
1221712217
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1221812218
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1221912219
ac_cs_version="\\
12220-
sqlite config.status 3.15.2
12220+
sqlite config.status 3.16.1
1222112221
configured by $0, generated by GNU Autoconf 2.69,
1222212222
with options \\"\$ac_cs_config\\"
1222312223

sqlite/configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ AC_SEARCH_LIBS(fdatasync, [rt])
560560
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
561561
[use_debug=$enableval],[use_debug=no])
562562
if test "${use_debug}" = "yes" ; then
563-
TARGET_DEBUG="-DSQLITE_DEBUG=1"
563+
TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE"
564564
else
565565
TARGET_DEBUG="-DNDEBUG"
566566
fi

sqlite/ext/fts5/fts5_expr.c

+44-28
Original file line numberDiff line numberDiff line change
@@ -746,48 +746,61 @@ static int fts5ExprNearTest(
746746
** Initialize all term iterators in the pNear object. If any term is found
747747
** to match no documents at all, return immediately without initializing any
748748
** further iterators.
749+
**
750+
** If an error occurs, return an SQLite error code. Otherwise, return
751+
** SQLITE_OK. It is not considered an error if some term matches zero
752+
** documents.
749753
*/
750754
static int fts5ExprNearInitAll(
751755
Fts5Expr *pExpr,
752756
Fts5ExprNode *pNode
753757
){
754758
Fts5ExprNearset *pNear = pNode->pNear;
755-
int i, j;
756-
int rc = SQLITE_OK;
757-
int bEof = 1;
759+
int i;
758760

759761
assert( pNode->bNomatch==0 );
760-
for(i=0; rc==SQLITE_OK && i<pNear->nPhrase; i++){
762+
for(i=0; i<pNear->nPhrase; i++){
761763
Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];
762-
for(j=0; j<pPhrase->nTerm; j++){
763-
Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];
764-
Fts5ExprTerm *p;
765-
766-
for(p=pTerm; p && rc==SQLITE_OK; p=p->pSynonym){
767-
if( p->pIter ){
768-
sqlite3Fts5IterClose(p->pIter);
769-
p->pIter = 0;
764+
if( pPhrase->nTerm==0 ){
765+
pNode->bEof = 1;
766+
return SQLITE_OK;
767+
}else{
768+
int j;
769+
for(j=0; j<pPhrase->nTerm; j++){
770+
Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];
771+
Fts5ExprTerm *p;
772+
int bHit = 0;
773+
774+
for(p=pTerm; p; p=p->pSynonym){
775+
int rc;
776+
if( p->pIter ){
777+
sqlite3Fts5IterClose(p->pIter);
778+
p->pIter = 0;
779+
}
780+
rc = sqlite3Fts5IndexQuery(
781+
pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm),
782+
(pTerm->bPrefix ? FTS5INDEX_QUERY_PREFIX : 0) |
783+
(pExpr->bDesc ? FTS5INDEX_QUERY_DESC : 0),
784+
pNear->pColset,
785+
&p->pIter
786+
);
787+
assert( (rc==SQLITE_OK)==(p->pIter!=0) );
788+
if( rc!=SQLITE_OK ) return rc;
789+
if( 0==sqlite3Fts5IterEof(p->pIter) ){
790+
bHit = 1;
791+
}
770792
}
771-
rc = sqlite3Fts5IndexQuery(
772-
pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm),
773-
(pTerm->bPrefix ? FTS5INDEX_QUERY_PREFIX : 0) |
774-
(pExpr->bDesc ? FTS5INDEX_QUERY_DESC : 0),
775-
pNear->pColset,
776-
&p->pIter
777-
);
778-
assert( rc==SQLITE_OK || p->pIter==0 );
779-
if( p->pIter && 0==sqlite3Fts5IterEof(p->pIter) ){
780-
bEof = 0;
793+
794+
if( bHit==0 ){
795+
pNode->bEof = 1;
796+
return SQLITE_OK;
781797
}
782798
}
783-
784-
if( bEof ) break;
785799
}
786-
if( bEof ) break;
787800
}
788801

789-
pNode->bEof = bEof;
790-
return rc;
802+
pNode->bEof = 0;
803+
return SQLITE_OK;
791804
}
792805

793806
/*
@@ -1331,7 +1344,10 @@ int sqlite3Fts5ExprFirst(Fts5Expr *p, Fts5Index *pIdx, i64 iFirst, int bDesc){
13311344

13321345
/* If not at EOF but the current rowid occurs earlier than iFirst in
13331346
** the iteration order, move to document iFirst or later. */
1334-
if( pRoot->bEof==0 && fts5RowidCmp(p, pRoot->iRowid, iFirst)<0 ){
1347+
if( rc==SQLITE_OK
1348+
&& 0==pRoot->bEof
1349+
&& fts5RowidCmp(p, pRoot->iRowid, iFirst)<0
1350+
){
13351351
rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
13361352
}
13371353

sqlite/ext/fts5/test/fts5faultB.test

+28
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,34 @@ do_faultsim_test 2.4 -faults oom* -body {
7878
faultsim_test_result {0 {{3 2} {2 3}}}
7979
}
8080

81+
#-------------------------------------------------------------------------
82+
#
83+
reset_db
84+
do_execsql_test 3.0 {
85+
CREATE VIRTUAL TABLE x1 USING fts5(z);
86+
}
87+
88+
do_faultsim_test 3.1 -faults oom* -body {
89+
execsql {
90+
SELECT rowid FROM x1('c') WHERE rowid>1;
91+
}
92+
} -test {
93+
faultsim_test_result {0 {}}
94+
}
95+
96+
do_execsql_test 3.2 {
97+
INSERT INTO x1 VALUES('a b c');
98+
INSERT INTO x1 VALUES('b c d');
99+
INSERT INTO x1 VALUES('c d e');
100+
INSERT INTO x1 VALUES('d e f');
101+
}
102+
do_faultsim_test 3.3 -faults oom* -body {
103+
execsql {
104+
SELECT rowid FROM x1('c') WHERE rowid>1;
105+
}
106+
} -test {
107+
faultsim_test_result {0 {2 3}}
108+
}
81109

82110
finish_test
83111

sqlite/ext/fts5/test/fts5prefix.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
#***********************************************************************
1111
#
12-
# This file containst tests focused on prefix indexes.
12+
# This file contains tests focused on prefix indexes.
1313
#
1414

1515
source [file join [file dirname [info script]] fts5_common.tcl]

0 commit comments

Comments
 (0)