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
56and 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
1315SQLite sources are managed using the
1416[ Fossil] ( https://www.fossil-scm.org/ ) , a distributed version control system
1517that was specifically designed to support SQLite development.
1618If 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.
104108SQLite does not require [ Tcl] ( http://www.tcl.tk/ ) to run, but a Tcl installation
105109is required by the makefiles (including those for MSVC). SQLite contains
106110a 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
116119which is the main program for the "sqlite3.exe"
117120[ command-line shell] ( https://sqlite.org/cli.html ) and
118121the "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
121124extension and only later escaped to the wild as an independent library.)
122125
@@ -163,14 +166,14 @@ template for generating its parser.
163166
164167Lemon also generates the ** parse.h** header file, at the same time it
165168generates 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
169172The ** opcodes.h** header file contains macros that define the numbers
170173corresponding to opcodes in the "VDBE" virtual machine. The opcodes.h
171174file 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
174177the ** opcodes.c** source file, which contains a reverse mapping from
175178opcode-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
207210debuggers (most notably MSVC) are unable to deal with files longer than 64K
208211lines. To work around this, a separate Tcl script, tool/split-sqlite3c.tcl,
209212can 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,
212215all of the source code is contained within a single translation unit so
213216that the compiler can do extra cross-procedure optimization, but no
214217individual 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+
275294There are many other source files. Each has a succinct header comment that
276295describes its purpose and role within the larger system.
277296
0 commit comments