Skip to content

Commit 159a531

Browse files
groueswiftlyfalling
authored andcommitted
Update SQLite to 3.18.0
1 parent b0cb086 commit 159a531

Some content is hidden

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

107 files changed

+6141
-1783
lines changed

sqlite/Makefile.in

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
566566
SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
567567
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
568568
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
569+
FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
569570
FUZZCHECK_SRC = $(TOP)/test/fuzzcheck.c $(TOP)/test/ossfuzz.c
570571
DBFUZZ_OPT =
571572

@@ -620,7 +621,8 @@ fuzzcheck$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h
620621
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS)
621622

622623
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+
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c \
625+
$(TOP)/test/ossfuzz.c sqlite3.c $(TLIBS)
624626

625627
dbfuzz$(TEXE): $(TOP)/test/dbfuzz.c sqlite3.c sqlite3.h
626628
$(LTLINK) -o $@ $(DBFUZZ_OPT) $(TOP)/test/dbfuzz.c sqlite3.c $(TLIBS)
@@ -1153,6 +1155,10 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
11531155
sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
11541156
$(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
11551157

1158+
dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo
1159+
$(LTLINK) -DDBDUMP_STANDALONE -o $@ \
1160+
$(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS)
1161+
11561162
showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo
11571163
$(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS)
11581164

@@ -1185,11 +1191,6 @@ KV_OPT += -DSQLITE_DIRECT_OVERFLOW_READ
11851191
kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c
11861192
$(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS)
11871193

1188-
DBSELFTEST_OPT += -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS4
1189-
1190-
dbselftest$(TEXE): $(TOP)/test/dbselftest.c sqlite3.c
1191-
$(LTLINK) $(DBSELFTEST_OPT) -o $@ $(TOP)/test/dbselftest.c sqlite3.c $(TLIBS)
1192-
11931194
rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo
11941195
$(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS)
11951196

sqlite/Makefile.msc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
745745

746746
!IF $(DEBUG)>2
747747
TCC = $(TCC) -DSQLITE_DEBUG=1
748+
TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
748749
RCC = $(RCC) -DSQLITE_DEBUG=1
749750
!ENDIF
750751

@@ -1509,7 +1510,7 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_
15091510
#
15101511
MPTESTER_COMPILE_OPTS = -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS5
15111512
FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
1512-
FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
1513+
FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ -DSQLITE_MAX_MEMORY=50000000
15131514
FUZZCHECK_SRC = $(TOP)\test\fuzzcheck.c $(TOP)\test\ossfuzz.c
15141515
OSSSHELL_SRC = $(TOP)\test\ossshell.c $(TOP)\test\ossfuzz.c
15151516
DBFUZZ_COMPILE_OPTS = -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
@@ -2177,6 +2178,10 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
21772178
$(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_analyzer.c \
21782179
/link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
21792180

2181+
dbdump.exe: $(TOP)\ext\misc\dbdump.c $(SQLITE3C) $(SQLITE3H)
2182+
$(LTLINK) $(NO_WARN) -DDBDUMP_STANDALONE $(TOP)\ext\misc\dbdump.c $(SQLITE3C) \
2183+
/link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS)
2184+
21802185
testloadext.lo: $(TOP)\src\test_loadext.c
21812186
$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
21822187

@@ -2255,7 +2260,7 @@ clean:
22552260
del /Q tclsqlite3.exe $(SQLITETCLH) $(SQLITETCLDECLSH) 2>NUL
22562261
del /Q testloadext.dll 2>NUL
22572262
del /Q testfixture.exe test.db 2>NUL
2258-
del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
2263+
del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe dbdump.exe 2>NUL
22592264
del /Q changeset.exe 2>NUL
22602265
del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
22612266
del /Q mptester.exe wordcount.exe rbu.exe srcck1.exe 2>NUL

sqlite/README.md

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,48 @@ If you are reading this on a Git mirror someplace, you are doing it wrong.
88
The [official repository](https://www.sqlite.org/src/) is better. Go there
99
now.
1010

11+
## Obtaining The Code
12+
13+
SQLite sources are managed using the
14+
[Fossil](https://www.fossil-scm.org/), a distributed version control system
15+
that was specifically designed to support SQLite development.
16+
If you do not want to use Fossil, you can download tarballs or ZIP
17+
archives as follows:
18+
19+
* Lastest trunk check-in:
20+
<https://www.sqlite.org/src/tarball/sqlite.tar.gz> or
21+
<https://www.sqlite.org/src/zip/sqlite.zip>.
22+
23+
* Latest release:
24+
<https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release> or
25+
<https://www.sqlite.org/src/zip/sqlite.zip?r=release>.
26+
27+
* For other check-ins, substitute an appropriate branch name or
28+
tag or hash prefix for "release" in the URLs of the previous
29+
bullet. Or browse the [timeline](https://www.sqlite.org/src/timeline)
30+
to locate the check-in desired, click on its information page link,
31+
then click on the "Tarball" or "ZIP Archive" links on the information
32+
page.
33+
34+
If you do want to use Fossil to check out the source tree,
35+
first install Fossil version 2.0 or later.
36+
(Source tarballs and precompiled binaries available
37+
[here](https://www.fossil-scm.org/fossil/uv/download.html).)
38+
Then run commands like this:
39+
40+
mkdir ~/sqlite
41+
cd ~/sqlite
42+
fossil clone https://www.sqlite.org/src sqlite.fossil
43+
fossil open sqlite.fossil
44+
45+
After setting up a repository using the steps above, you can always
46+
update to the lastest version using:
47+
48+
fossil update trunk ;# latest trunk check-in
49+
fossil update release ;# latest official release
50+
51+
Or type "fossil ui" to get a web-based user interface.
52+
1153
## Compiling
1254

1355
First create a directory in which to place
@@ -18,13 +60,13 @@ script found at the root of the source tree. Then run "make".
1860

1961
For example:
2062

21-
tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
22-
mkdir bld ;# Build will occur in a sibling directory
23-
cd bld ;# Change to the build directory
24-
../sqlite/configure ;# Run the configure script
25-
make ;# Run the makefile.
26-
make sqlite3.c ;# Build the "amalgamation" source file
27-
make test ;# Run some tests (requires Tcl)
63+
tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
64+
mkdir bld ;# Build will occur in a sibling directory
65+
cd bld ;# Change to the build directory
66+
../sqlite/configure ;# Run the configure script
67+
make ;# Run the makefile.
68+
make sqlite3.c ;# Build the "amalgamation" source file
69+
make test ;# Run some tests (requires Tcl)
2870

2971
See the makefile for additional targets.
3072

@@ -43,13 +85,13 @@ with the provided "Makefile.msc" to build one of the supported targets.
4385

4486
For example:
4587

46-
mkdir bld
47-
cd bld
48-
nmake /f Makefile.msc TOP=..\sqlite
49-
nmake /f Makefile.msc sqlite3.c TOP=..\sqlite
50-
nmake /f Makefile.msc sqlite3.dll TOP=..\sqlite
51-
nmake /f Makefile.msc sqlite3.exe TOP=..\sqlite
52-
nmake /f Makefile.msc test TOP=..\sqlite
88+
mkdir bld
89+
cd bld
90+
nmake /f Makefile.msc TOP=..\sqlite
91+
nmake /f Makefile.msc sqlite3.c TOP=..\sqlite
92+
nmake /f Makefile.msc sqlite3.dll TOP=..\sqlite
93+
nmake /f Makefile.msc sqlite3.exe TOP=..\sqlite
94+
nmake /f Makefile.msc test TOP=..\sqlite
5395

5496
There are several build options that can be set via the NMAKE command
5597
line. For example, to build for WinRT, simply add "FOR_WINRT=1" argument

sqlite/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.17.0
1+
3.18.0

sqlite/autoconf/Makefile.msc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
644644

645645
!IF $(DEBUG)>2
646646
TCC = $(TCC) -DSQLITE_DEBUG=1
647+
TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
647648
RCC = $(RCC) -DSQLITE_DEBUG=1
648649
!ENDIF
649650

sqlite/autoconf/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ AS_IF([ test x"$enable_editline" != xno ],[
5555
LIBS=""
5656
AC_SEARCH_LIBS([readline],[edit],[
5757
AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
58-
READLINE_LIBS=$LIBS
58+
READLINE_LIBS="$LIBS -ltinfo"
5959
enable_readline=no
60-
])
60+
],[],[-ltinfo])
6161
AS_UNSET(ac_cv_search_readline)
6262
LIBS=$sLIBS
6363
])

sqlite/configure

Lines changed: 9 additions & 9 deletions
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.17.0.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.18.0.
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.17.0'
730-
PACKAGE_STRING='sqlite 3.17.0'
729+
PACKAGE_VERSION='3.18.0'
730+
PACKAGE_STRING='sqlite 3.18.0'
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.17.0 to adapt to many kinds of systems.
1466+
\`configure' configures sqlite 3.18.0 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.17.0:";;
1531+
short | recursive ) echo "Configuration of sqlite 3.18.0:";;
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.17.0
1655+
sqlite configure 3.18.0
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.17.0, which was
2074+
It was created by sqlite $as_me 3.18.0, which was
20752075
generated by GNU Autoconf 2.69. Invocation command line was
20762076
20772077
$ $0 $@
@@ -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.17.0, which was
12154+
This file was extended by sqlite $as_me 3.18.0, 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.17.0
12220+
sqlite config.status 3.18.0
1222112221
configured by $0, generated by GNU Autoconf 2.69,
1222212222
with options \\"\$ac_cs_config\\"
1222312223

sqlite/ext/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Loadable Extensions
2+
3+
Various [loadable extensions](https://www.sqlite.org/loadext.html) for
4+
SQLite are found in subfolders.
5+
6+
Most subfolders are dedicated to a single loadable extension (for
7+
example FTS5, or RTREE). But the misc/ subfolder contains a collection
8+
of smaller single-file extensions.

sqlite/ext/README.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

sqlite/ext/fts3/fts3.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ int sqlite3Fts3PutVarint(char *p, sqlite_int64 v){
349349
** Return the number of bytes read, or 0 on error.
350350
** The value is stored in *v.
351351
*/
352-
int sqlite3Fts3GetVarint(const char *p, sqlite_int64 *v){
353-
const char *pStart = p;
352+
int sqlite3Fts3GetVarint(const char *pBuf, sqlite_int64 *v){
353+
const unsigned char *p = (const unsigned char*)pBuf;
354+
const unsigned char *pStart = p;
354355
u32 a;
355356
u64 b;
356357
int shift;
@@ -1397,7 +1398,9 @@ static int fts3InitVtab(
13971398
char *z;
13981399
int n = 0;
13991400
z = (char *)sqlite3Fts3NextToken(aCol[iCol], &n);
1400-
memcpy(zCsr, z, n);
1401+
if( n>0 ){
1402+
memcpy(zCsr, z, n);
1403+
}
14011404
zCsr[n] = '\0';
14021405
sqlite3Fts3Dequote(zCsr);
14031406
p->azColumn[iCol] = zCsr;
@@ -3408,8 +3411,10 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){
34083411
const u32 nMinMerge = 64; /* Minimum amount of incr-merge work to do */
34093412

34103413
Fts3Table *p = (Fts3Table*)pVtab;
3411-
int rc = sqlite3Fts3PendingTermsFlush(p);
3414+
int rc;
3415+
i64 iLastRowid = sqlite3_last_insert_rowid(p->db);
34123416

3417+
rc = sqlite3Fts3PendingTermsFlush(p);
34133418
if( rc==SQLITE_OK
34143419
&& p->nLeafAdd>(nMinMerge/16)
34153420
&& p->nAutoincrmerge && p->nAutoincrmerge!=0xff
@@ -3424,6 +3429,7 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){
34243429
if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, p->nAutoincrmerge);
34253430
}
34263431
sqlite3Fts3SegmentsClose(p);
3432+
sqlite3_set_last_insert_rowid(p->db, iLastRowid);
34273433
return rc;
34283434
}
34293435

0 commit comments

Comments
 (0)