Skip to content

Commit bf3fa86

Browse files
committed
Snapshot of upstream SQLite 3.25.0
1 parent 1f3bc22 commit bf3fa86

File tree

558 files changed

+76387
-20898
lines changed

Some content is hidden

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

558 files changed

+76387
-20898
lines changed

Makefile.in

Lines changed: 125 additions & 29 deletions
Large diffs are not rendered by default.

Makefile.msc

Lines changed: 293 additions & 62 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
<h1 align="center">SQLite Source Repository</h1>
22

3-
This repository contains the complete source code for the SQLite database
4-
engine. Some test scripts are also include. However, many other test scripts
3+
This repository contains the complete source code for the
4+
[SQLite database engine](https://sqlite.org/). Some test scripts
5+
are also included. However, many other test scripts
56
and most of the documentation are managed separately.
67

7-
If you are reading this on a Git mirror someplace, you are doing it wrong.
8-
The [official repository](https://www.sqlite.org/src/) is better. Go there
9-
now.
8+
SQLite [does not use Git](https://sqlite.org/whynotgit.html).
9+
If you are reading this on GitHub, then you are looking at an
10+
unofficial mirror. See <https://sqlite.org/src> for the official
11+
repository.
1012

1113
## Obtaining The Code
1214

1315
SQLite sources are managed using the
1416
[Fossil](https://www.fossil-scm.org/), a distributed version control system
1517
that was specifically designed to support SQLite development.
1618
If you do not want to use Fossil, you can download tarballs or ZIP
17-
archives as follows:
19+
archives or [SQLite archives](https://sqlite.org/cli.html#sqlar) as follows:
1820

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>.
21+
* Lastest trunk check-in as
22+
[Tarball](https://www.sqlite.org/src/tarball/sqlite.tar.gz),
23+
[ZIP-archive](https://www.sqlite.org/src/zip/sqlite.zip), or
24+
[SQLite-archive](https://www.sqlite.org/src/sqlar/sqlite.sqlar).
2225

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+
* Latest release as
27+
[Tarball](https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release),
28+
[ZIP-archive](https://www.sqlite.org/src/zip/sqlite.zip?r=release), or
29+
[SQLite-archive](https://www.sqlite.org/src/sqlar/sqlite.sqlar?r=release).
2630

2731
* For other check-ins, substitute an appropriate branch name or
2832
tag or hash prefix for "release" in the URLs of the previous
@@ -104,7 +108,6 @@ recommended.
104108
SQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation
105109
is required by the makefiles (including those for MSVC). SQLite contains
106110
a lot of generated code and Tcl is used to do much of that code generation.
107-
The makefiles also require AWK.
108111

109112
## Source Code Tour
110113

@@ -116,7 +119,7 @@ The **src/** also contains the "shell.c" file
116119
which is the main program for the "sqlite3.exe"
117120
[command-line shell](https://sqlite.org/cli.html) and
118121
the "tclsqlite.c" file which implements the
119-
[TCL bindings](https://sqlite.org/tclsqlite.html) for SQLite.
122+
[Tcl bindings](https://sqlite.org/tclsqlite.html) for SQLite.
120123
(Historical note: SQLite began as a Tcl
121124
extension and only later escaped to the wild as an independent library.)
122125

@@ -163,14 +166,14 @@ template for generating its parser.
163166

164167
Lemon also generates the **parse.h** header file, at the same time it
165168
generates parse.c. But the parse.h header file is
166-
modified further (to add additional symbols) using the ./addopcodes.awk
167-
AWK script.
169+
modified further (to add additional symbols) using the ./addopcodes.tcl
170+
Tcl script.
168171

169172
The **opcodes.h** header file contains macros that define the numbers
170173
corresponding to opcodes in the "VDBE" virtual machine. The opcodes.h
171174
file is generated by the scanning the src/vdbe.c source file. The
172-
AWK script at ./mkopcodeh.awk does this scan and generates opcodes.h.
173-
A second AWK script, ./mkopcodec.awk, then scans opcodes.h to generate
175+
Tcl script at ./mkopcodeh.tcl does this scan and generates opcodes.h.
176+
A second Tcl script, ./mkopcodec.tcl, then scans opcodes.h to generate
174177
the **opcodes.c** source file, which contains a reverse mapping from
175178
opcode-number to opcode-name that is used for EXPLAIN output.
176179

@@ -207,8 +210,8 @@ The amalgamation source file is more than 200K lines long. Some symbolic
207210
debuggers (most notably MSVC) are unable to deal with files longer than 64K
208211
lines. To work around this, a separate Tcl script, tool/split-sqlite3c.tcl,
209212
can be run on the amalgamation to break it up into a single small C file
210-
called **sqlite3-all.c** that does #include on about five other files
211-
named **sqlite3-1.c**, **sqlite3-2.c**, ..., **sqlite3-5.c**. In this way,
213+
called **sqlite3-all.c** that does #include on about seven other files
214+
named **sqlite3-1.c**, **sqlite3-2.c**, ..., **sqlite3-7.c**. In this way,
212215
all of the source code is contained within a single translation unit so
213216
that the compiler can do extra cross-procedure optimization, but no
214217
individual source file exceeds 32K lines in length.
@@ -237,7 +240,8 @@ Key files:
237240
trying to understand how the library works internally.
238241

239242
* **sqliteInt.h** - this header file defines many of the data objects
240-
used internally by SQLite.
243+
used internally by SQLite. In addition to "sqliteInt.h", some
244+
subsystems have their own header files.
241245

242246
* **parse.y** - This file describes the LALR(1) grammar that SQLite uses
243247
to parse SQL statements, and the actions that are taken at each step
@@ -249,29 +253,44 @@ Key files:
249253
which defines internal data objects. The rest of SQLite interacts
250254
with the VDBE through an interface defined by vdbe.h.
251255

252-
* **where.c** - This file analyzes the WHERE clause and generates
256+
* **where.c** - This file (together with its helper files named
257+
by "where*.c") analyzes the WHERE clause and generates
253258
virtual machine code to run queries efficiently. This file is
254259
sometimes called the "query optimizer". It has its own private
255260
header file, whereInt.h, that defines data objects used internally.
256261

257262
* **btree.c** - This file contains the implementation of the B-Tree
258-
storage engine used by SQLite.
263+
storage engine used by SQLite. The interface to the rest of the system
264+
is defined by "btree.h". The "btreeInt.h" header defines objects
265+
used internally by btree.c and not published to the rest of the system.
259266

260267
* **pager.c** - This file contains the "pager" implementation, the
261-
module that implements transactions.
268+
module that implements transactions. The "pager.h" header file
269+
defines the interface between pager.c and the rest of the system.
262270

263271
* **os_unix.c** and **os_win.c** - These two files implement the interface
264272
between SQLite and the underlying operating system using the run-time
265273
pluggable VFS interface.
266274

267-
* **shell.c** - This file is not part of the core SQLite library. This
275+
* **shell.c.in** - This file is not part of the core SQLite library. This
268276
is the file that, when linked against sqlite3.a, generates the
269-
"sqlite3.exe" command-line shell.
277+
"sqlite3.exe" command-line shell. The "shell.c.in" file is transformed
278+
into "shell.c" as part of the build process.
270279

271280
* **tclsqlite.c** - This file implements the Tcl bindings for SQLite. It
272281
is not part of the core SQLite library. But as most of the tests in this
273282
repository are written in Tcl, the Tcl language bindings are important.
274283

284+
* **test*.c** - Files in the src/ folder that begin with "test" go into
285+
building the "testfixture.exe" program. The testfixture.exe program is
286+
an enhanced Tcl shell. The testfixture.exe program runs scripts in the
287+
test/ folder to validate the core SQLite code. The testfixture program
288+
(and some other test programs too) is build and run when you type
289+
"make test".
290+
291+
* **ext/misc/json1.c** - This file implements the various JSON functions
292+
that are build into SQLite.
293+
275294
There are many other source files. Each has a succinct header comment that
276295
describes its purpose and role within the larger system.
277296

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.20.1
1+
3.25.0

autoconf/Makefile.am

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

2-
AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ @FTS5_FLAGS@ @JSON1_FLAGS@ @SESSION_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE
3-
2+
AM_CFLAGS = @BUILD_CFLAGS@
43
lib_LTLIBRARIES = libsqlite3.la
54
libsqlite3_la_SOURCES = sqlite3.c
65
libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8
@@ -10,11 +9,11 @@ sqlite3_SOURCES = shell.c sqlite3.h
109
EXTRA_sqlite3_SOURCES = sqlite3.c
1110
sqlite3_LDADD = @EXTRA_SHELL_OBJ@ @READLINE_LIBS@
1211
sqlite3_DEPENDENCIES = @EXTRA_SHELL_OBJ@
13-
sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS
12+
sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB $(SHELL_CFLAGS)
1413

1514
include_HEADERS = sqlite3.h sqlite3ext.h
1615

17-
EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt Replace.cs
16+
EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt Replace.cs Makefile.fallback
1817
pkgconfigdir = ${libdir}/pkgconfig
1918
pkgconfig_DATA = sqlite3.pc
2019

autoconf/Makefile.fallback

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/make
2+
#
3+
# If the configure script does not work, then this Makefile is available
4+
# as a backup. Manually configure the variables below.
5+
#
6+
# Note: This makefile works out-of-the-box on MacOS 10.2 (Jaguar)
7+
#
8+
CC = gcc
9+
CFLAGS = -O0 -I.
10+
LIBS = -lz
11+
COPTS += -D_BSD_SOURCE
12+
COPTS += -DSQLITE_ENABLE_LOCKING_STYLE=0
13+
COPTS += -DSQLITE_THREADSAFE=0
14+
COPTS += -DSQLITE_OMIT_LOAD_EXTENSION
15+
COPTS += -DSQLITE_WITHOUT_ZONEMALLOC
16+
COPTS += -DSQLITE_ENABLE_RTREE
17+
18+
sqlite3: shell.c sqlite3.c
19+
$(CC) $(CFLAGS) $(COPTS) -o sqlite3 shell.c sqlite3.c $(LIBS)

autoconf/Makefile.msc

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
277277
!IF $(MINIMAL_AMALGAMATION)==0
278278
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
279279
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
280+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1
281+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
282+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
283+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
284+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
285+
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_INTROSPECTION_PRAGMAS=1
280286
!ENDIF
281287
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
282288
!ENDIF
@@ -561,6 +567,7 @@ SHELL_CORE_DEP =
561567
!ENDIF
562568
!ENDIF
563569

570+
564571
# This is the core library that the shell executable should link with.
565572
#
566573
!IFNDEF SHELL_CORE_LIB
@@ -808,7 +815,7 @@ LTLINK = $(TCC) -Fe$@
808815
# If requested, link to the RPCRT4 library.
809816
#
810817
!IF $(USE_RPCRT4_LIB)!=0
811-
LTLINK = $(LTLINK) rpcrt4.lib
818+
LTLIBS = $(LTLIBS) rpcrt4.lib
812819
!ENDIF
813820

814821
# If a platform was set, force the linker to target that.
@@ -927,14 +934,24 @@ LIBRESOBJS =
927934
# when the shell is not being dynamically linked.
928935
#
929936
!IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
930-
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB
937+
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
938+
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
939+
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
931940
!ENDIF
932941

933942

934943
# This is the default Makefile target. The objects listed here
935944
# are what get build when you type just "make" with no arguments.
936945
#
937-
all: dll shell
946+
core: dll shell
947+
948+
# Targets that require the Tcl library.
949+
#
950+
tcl: $(ALL_TCL_TARGETS)
951+
952+
# This Makefile target builds all of the standard binaries.
953+
#
954+
all: core tcl
938955

939956
# Dynamic link library section.
940957
#
@@ -954,11 +971,11 @@ Replace.exe:
954971
sqlite3.def: Replace.exe $(LIBOBJ)
955972
echo EXPORTS > sqlite3.def
956973
dumpbin /all $(LIBOBJ) \
957-
| .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
974+
| .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
958975
| sort >> sqlite3.def
959976

960-
$(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
961-
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\shell.c $(SHELL_CORE_SRC) \
977+
$(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
978+
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \
962979
/link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
963980

964981

@@ -973,7 +990,7 @@ sqlite3.lo: $(SQLITE3C)
973990
!IF $(USE_RC)!=0
974991
_HASHCHAR=^#
975992
!IF ![echo !IFNDEF VERSION > rcver.vc] && \
976-
![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| find "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
993+
![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
977994
![echo !ENDIF >> rcver.vc]
978995
!INCLUDE rcver.vc
979996
!ENDIF

0 commit comments

Comments
 (0)