Skip to content

Commit 2b30a9f

Browse files
committed
Snapshot of upstream SQLite 3.51.3
1 parent 7b0662c commit 2b30a9f

File tree

274 files changed

+11464
-26556
lines changed

Some content is hidden

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

274 files changed

+11464
-26556
lines changed

Makefile.msc

Lines changed: 127 additions & 76 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<h1 align="center">SQLite Source Repository</h1>
22

33
This repository contains the complete source code for the
4-
[SQLite database engine](https://sqlite.org/) going back
5-
to 2000-05-29. The tree includes many tests and some
6-
documentation, though additional tests and most documentation
4+
[SQLite database engine](https://sqlite.org/), including
5+
many tests. Additional tests and most documentation
76
are managed separately.
87

98
See the [on-line documentation](https://sqlite.org/) for more information
@@ -100,32 +99,31 @@ script found at the root of the source tree. Then run "make".
10099

101100
For example:
102101

103-
apt install gcc make tcl-dev ;# Install the necessary build tools
102+
apt install gcc make tcl-dev ;# Make sure you have all the necessary build tools
104103
tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
105-
mkdir bld ;# Build happens in a sibling directory
104+
mkdir bld ;# Build will occur in a sibling directory
106105
cd bld ;# Change to the build directory
107106
../sqlite/configure ;# Run the configure script
108-
make sqlite3 ;# The "sqlite3" command-line tool
109-
make sqlite3.c ;# The "amalgamation" source file
110-
make sqldiff ;# The "sqldiff" command-line tool
111-
#### Targets below require tcl-dev ####
112-
make tclextension-install ;# Install the SQLite TCL extension
107+
make sqlite3 ;# Builds the "sqlite3" command-line tool
108+
make sqlite3.c ;# Build the "amalgamation" source file
109+
make sqldiff ;# Builds the "sqldiff" command-line tool
110+
# Makefile targets below this point require tcl-dev
111+
make tclextension-install ;# Build and install the SQLite TCL extension
113112
make devtest ;# Run development tests
114113
make releasetest ;# Run full release tests
115114
make sqlite3_analyzer ;# Builds the "sqlite3_analyzer" tool
116115

117116
See the makefile for additional targets. For debugging builds, the
118117
core developers typically run "configure" with options like this:
119118

120-
../sqlite/configure --all --debug CFLAGS='-O0 -g'
119+
../sqlite/configure --enable-all --enable-debug CFLAGS='-O0 -g'
121120

122121
For release builds, the core developers usually do:
123122

124-
../sqlite/configure --all
123+
../sqlite/configure --enable-all
125124

126-
Core deliverables (sqlite3.c, sqlite3) can be built without a TCL, but
127-
many makefile targets require a "tclsh" TCL interpreter version 8.6
128-
or later. The "tclextension-install" target and the test targets that follow
125+
Almost all makefile targets require a "tclsh" TCL interpreter version 8.6 or
126+
later. The "tclextension-install" target and the test targets that follow
129127
all require TCL development libraries too. ("apt install tcl-dev"). It is
130128
helpful, but is not required, to install the SQLite TCL extension (the
131129
"tclextension-install" target) prior to running tests. The "releasetest"
@@ -135,20 +133,20 @@ On "make" command-lines, one can add "OPTIONS=..." to specify additional
135133
compile-time options over and above those set by ./configure. For example,
136134
to compile with the SQLITE_OMIT_DEPRECATED compile-time option, one could say:
137135

138-
./configure --all
136+
./configure --enable-all
139137
make OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3
140138

141-
The configure script uses [autosetup](https://msteveb.github.io/autosetup/).
142-
If the configure script does not work out for you, there is a generic
143-
makefile named "Makefile.linux-gcc" in the top directory of the source tree
144-
that you can copy and edit to suit your needs. Comments on the generic
145-
makefile show what changes are needed.
139+
The configure script uses autoconf 2.61 and libtool. If the configure
140+
script does not work out for you, there is a generic makefile named
141+
"Makefile.linux-gcc" in the top directory of the source tree that you
142+
can copy and edit to suit your needs. Comments on the generic makefile
143+
show what changes are needed.
146144

147145
## Compiling for Windows Using MSVC
148146

149147
On Windows, everything can be compiled with MSVC.
150-
You will also need a working installation of TCL if you want to run tests,
151-
though TCL is not required if you just want to build SQLite itself.
148+
You will also need a working installation of TCL if you want to run tests.
149+
TCL is not required if you just want to build SQLite itself.
152150
See the [compile-for-windows.md](doc/compile-for-windows.md) document for
153151
additional information about how to install MSVC and TCL and configure your
154152
build environment.
@@ -158,33 +156,32 @@ TCL library, using a command like this:
158156

159157
set TCLDIR=c:\Tcl
160158

161-
SQLite itself does not contain any TCL code, but it does use TCL to run
162-
tests. You may need to install TCL development libraries in order to
163-
successfully complete some makefile targets. It is helpful, but is not
164-
required, to install the SQLite TCL extension (the "tclextension-install"
165-
target) prior to running tests.
166-
167-
The source tree contains a "make.bat" file that allows the same "make"
168-
commands of Unix to work on Windows. In the following, you can substitute
169-
"nmake /f Makefile.msc" in place of "make", if you prefer to avoid this BAT
170-
file:
171-
172-
make sqlite3.exe
173-
make sqlite3.c
174-
make sqldiff.exe
175-
#### Targets below require TCL development libraries ####
176-
make tclextension-install
177-
make devtest
178-
make releasetest
179-
make sqlite3_analyzer.exe
159+
SQLite uses "tclsh.exe" as part of the build process, and so that
160+
program will need to be somewhere on your %PATH%. SQLite itself
161+
does not contain any TCL code, but it does use TCL to run tests.
162+
You may need to install TCL development
163+
libraries in order to successfully complete some makefile targets.
164+
It is helpful, but is not required, to install the SQLite TCL extension
165+
(the "tclextension-install" target) prior to running tests.
166+
167+
Build using Makefile.msc. Example:
168+
169+
nmake /f Makefile.msc sqlite3.exe
170+
nmake /f Makefile.msc sqlite3.c
171+
nmake /f Makefile.msc sqldiff.exe
172+
# Makefile targets below this point require TCL development libraries
173+
nmake /f Makefile.msc tclextension-install
174+
nmake /f Makefile.msc devtest
175+
nmake /f Makefile.msc releasetest
176+
nmake /f Makefile.msc sqlite3_analyzer.exe
180177

181178
There are many other makefile targets. See comments in Makefile.msc for
182179
details.
183180

184181
As with the unix Makefile, the OPTIONS=... argument can be passed on the nmake
185182
command-line to enable new compile-time options. For example:
186183

187-
make OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3.exe
184+
nmake /f Makefile.msc OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3.exe
188185

189186
## Source Tree Map
190187

@@ -197,7 +194,8 @@ command-line to enable new compile-time options. For example:
197194
* **test/** - This directory and its subdirectories contains code used
198195
for testing. Files that end in "`.test`" are TCL scripts that run
199196
tests using an augmented TCL interpreter named "testfixture". Use
200-
a command like "`make testfixture`" to build that
197+
a command like "`make testfixture`" (unix) or
198+
"`nmake /f Makefile.msc testfixture.exe`" (windows) to build that
201199
augmented TCL interpreter, then run individual tests using commands like
202200
"`testfixture test/main.test`". This test/ subdirectory also contains
203201
additional C code modules and scripts for other kinds of testing.
@@ -379,11 +377,10 @@ implementation. It will not be the easiest library in the world to hack.
379377
(and some other test programs too) is built and run when you type
380378
"make test".
381379

382-
* **VERSION**, **manifest**, **manifest.tags**, and **manifest.uuid** -
383-
These files define the current SQLite version number. The "VERSION" file
384-
is human generated, but the "manifest", "manifest.tags", and
385-
"manifest.uuid" files are automatically generated by the
386-
[Fossil version control system](https://fossil-scm.org/).
380+
* **VERSION**, **manifest**, and **manifest.uuid** - These files define
381+
the current SQLite version number. The "VERSION" file is human generated,
382+
but the "manifest" and "manifest.uuid" files are automatically generated
383+
by the [Fossil version control system](https://fossil-scm.org/).
387384

388385
There are many other source files. Each has a succinct header comment that
389386
describes its purpose and role within the larger system.
@@ -409,6 +406,10 @@ makefile:
409406

410407
> make verify-source
411408
409+
Or on windows:
410+
411+
> nmake /f Makefile.msc verify-source
412+
412413
Using the makefile to verify source integrity is good for detecting
413414
accidental changes to the source tree, but malicious changes could be
414415
hidden by also modifying the makefiles.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.52.0
1+
3.51.3

autoconf/Makefile.in

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ sqlite_cfg.h: $(AS_AUTO_DEF)
117117
# CFLAGS for sqlite3$(T.exe)
118118
#
119119
SHELL_OPT ?= @OPT_SHELL@
120+
SHELL_OPT += -DSQLITE_DQS=0
121+
SHELL_OPT += -DSQLITE_ENABLE_FTS4
122+
#SHELL_OPT += -DSQLITE_ENABLE_FTS5
123+
SHELL_OPT += -DSQLITE_ENABLE_RTREE
124+
SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
125+
SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
126+
SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
127+
SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
128+
SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
129+
SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
130+
SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
131+
SHELL_OPT += -DSQLITE_ENABLE_PERCENTILE
132+
SHELL_OPT += -DSQLITE_STRICT_SUBTYPE=1
120133

121134
#
122135
# Library-level feature flags
@@ -282,7 +295,7 @@ DIST_FILES := \
282295
README.txt VERSION \
283296
auto.def autosetup configure tea \
284297
sqlite3.h sqlite3.c shell.c sqlite3ext.h \
285-
Makefile.in Makefile.msc Makefile.fallback make.bat \
298+
Makefile.in Makefile.msc Makefile.fallback \
286299
sqlite3.rc sqlite3rc.h Replace.cs \
287300
sqlite3.pc.in sqlite3.1
288301

autoconf/Makefile.msc

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
101101
!ENDIF
102102
!ENDIF
103103

104+
# Set this non-0 to use the library paths and other options necessary for
105+
# Windows Phone 8.1.
106+
#
107+
!IFNDEF USE_WP81_OPTS
108+
USE_WP81_OPTS = 0
109+
!ENDIF
110+
104111
# Set this non-0 to split the SQLite amalgamation file into chunks to
105112
# be used for debugging with Visual Studio.
106113
#
@@ -149,6 +156,14 @@ USE_NATIVE_LIBPATHS = 0
149156
USE_RC = 1
150157
!ENDIF
151158

159+
# Set this non-0 to compile binaries suitable for the WinRT environment.
160+
# This setting does not apply to any binaries that require Tcl to operate
161+
# properly (i.e. the text fixture, etc).
162+
#
163+
!IFNDEF FOR_WINRT
164+
FOR_WINRT = 0
165+
!ENDIF
166+
152167
# Set this non-0 to compile binaries suitable for the UWP environment.
153168
# This setting does not apply to any binaries that require Tcl to operate
154169
# properly (i.e. the text fixture, etc).
@@ -548,14 +563,10 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
548563
!IF "$(PLATFORM)"=="x86"
549564
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
550565
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
551-
552-
553566
!ELSE
554567
!IFNDEF PLATFORM
555568
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
556569
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
557-
558-
559570
!ELSE
560571
CORE_CCONV_OPTS =
561572
SHELL_CCONV_OPTS =
@@ -656,6 +667,18 @@ SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
656667
TCC = $(TCC) -FAcs
657668
!ENDIF
658669

670+
# When compiling the library for use in the WinRT environment,
671+
# the following compile-time options must be used as well to
672+
# disable use of Win32 APIs that are not available and to enable
673+
# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
674+
#
675+
!IF $(FOR_WINRT)!=0
676+
TCC = $(TCC) -DSQLITE_OS_WINRT=1
677+
RCC = $(RCC) -DSQLITE_OS_WINRT=1
678+
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
679+
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
680+
!ENDIF
681+
659682
# C compiler options for the Windows 10 platform (needs MSVC 2015).
660683
#
661684
!IF $(FOR_WIN10)!=0
@@ -668,7 +691,7 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
668691
# USE_CRT_DLL option is set to force dynamically linking to the
669692
# MSVC runtime library.
670693
#
671-
!IF $(USE_CRT_DLL)!=0
694+
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
672695
!IF $(DEBUG)>1
673696
TCC = $(TCC) -MDd
674697
BCC = $(BCC) -MDd
@@ -691,6 +714,16 @@ ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi
691714
!ENDIF
692715

693716

717+
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
718+
# Omitting the define will cause extra debugging code to be inserted and
719+
# includes extra comments when "EXPLAIN stmt" is used.
720+
#
721+
!IF $(DEBUG)==0
722+
TCC = $(TCC) -DNDEBUG
723+
BCC = $(BCC) -DNDEBUG
724+
RCC = $(RCC) -DNDEBUG
725+
!ENDIF
726+
694727
!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
695728
TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
696729
RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
@@ -880,6 +913,56 @@ LTLINKOPTS = /NOLOGO
880913
LTLIBOPTS = /NOLOGO
881914
!ENDIF
882915

916+
# When compiling for use in the WinRT environment, the following
917+
# linker option must be used to mark the executable as runnable
918+
# only in the context of an application container.
919+
#
920+
!IF $(FOR_WINRT)!=0
921+
LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
922+
!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
923+
!IFNDEF STORELIBPATH
924+
!IF "$(PLATFORM)"=="x86"
925+
STORELIBPATH = $(CRTLIBPATH)\store
926+
!ELSEIF "$(PLATFORM)"=="x64"
927+
STORELIBPATH = $(CRTLIBPATH)\store\amd64
928+
!ELSEIF "$(PLATFORM)"=="ARM"
929+
STORELIBPATH = $(CRTLIBPATH)\store\arm
930+
!ELSE
931+
STORELIBPATH = $(CRTLIBPATH)\store
932+
!ENDIF
933+
!ENDIF
934+
STORELIBPATH = $(STORELIBPATH:\\=\)
935+
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
936+
!ENDIF
937+
!ENDIF
938+
939+
# When compiling for Windows Phone 8.1, an extra library path is
940+
# required.
941+
#
942+
!IF $(USE_WP81_OPTS)!=0
943+
!IFNDEF WP81LIBPATH
944+
!IF "$(PLATFORM)"=="x86"
945+
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
946+
!ELSEIF "$(PLATFORM)"=="ARM"
947+
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
948+
!ELSE
949+
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
950+
!ENDIF
951+
!ENDIF
952+
!ENDIF
953+
954+
# When compiling for Windows Phone 8.1, some extra linker options
955+
# are also required.
956+
#
957+
!IF $(USE_WP81_OPTS)!=0
958+
!IFDEF WP81LIBPATH
959+
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
960+
!ENDIF
961+
LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
962+
LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
963+
LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
964+
!ENDIF
965+
883966
# When compiling for UWP or the Windows 10 platform, some extra linker
884967
# options are also required.
885968
#
@@ -903,9 +986,9 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
903986
# If either debugging or symbols are enabled, enable PDBs.
904987
#
905988
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
906-
LDFLAGS = /NODEFAULTLIB:msvcrt /DEBUG $(LDOPTS)
989+
LDFLAGS = /DEBUG $(LDOPTS)
907990
!ELSE
908-
LDFLAGS = /NODEFAULTLIB:msvcrt $(LDOPTS)
991+
LDFLAGS = $(LDOPTS)
909992
!ENDIF
910993

911994

@@ -941,7 +1024,6 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
9411024
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_PERCENTILE=1
9421025
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1
9431026
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1
944-
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
9451027
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1
9461028
!ENDIF
9471029

@@ -990,8 +1072,6 @@ $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLIT
9901072
/link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
9911073

9921074

993-
tclsqlite-ex.c:
994-
9951075
# Rule to build the amalgamation
9961076
#
9971077
sqlite3.lo: $(SQLITE3C)

0 commit comments

Comments
 (0)