Begin updating the architecture description to better describe how things
are currently put together. (CVS 1247) FossilOrigin-Name: 062ecc1368d6bb6d15da31e8d6f5953e8f5628b9
This commit is contained in:
parent
230680276c
commit
fef9765507
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Add\smore\stests\sof\sthe\ssqlite_interrupt()\slogic\s-\slooking\sfor\sa\sreported\nmemory\sleak.\s\s(Didn't\sfind\sit.)\s(CVS\s1246)
|
||||
D 2004-02-18T01:31:54
|
||||
C Begin\supdating\sthe\sarchitecture\sdescription\sto\sbetter\sdescribe\show\sthings\nare\scurrently\sput\stogether.\s(CVS\s1247)
|
||||
D 2004-02-18T16:56:32
|
||||
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -161,7 +161,9 @@ F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
|
||||
F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
|
||||
F www/arch.tcl 44b589fc01d6829d43447ab40588b00aec5b9734
|
||||
F www/arch.tcl 1e5289d63fc45564c67e205bc503db74718436ca
|
||||
F www/arch2.fig 613b5ac63511109064c2f93c5754ee662219937d
|
||||
F www/arch2.gif 49c6bb36160f03ca2b89eaa5bfb1f560c7d68ee7
|
||||
F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0
|
||||
F www/c_interface.tcl 17d8bd9e7b4fbdca47c30c8b9bcb728c351d55c0
|
||||
F www/changes.tcl ca9871eb52fa669e40f2052ab45154dfe0b72985
|
||||
@ -184,7 +186,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 50e67948f89380f2f4b536add0b8179e6db960a5
|
||||
R 0fd46cdcb719452c286af1cf356d38ce
|
||||
P e4c8b1c3aa9d288f518c6394187354e6fa18978e
|
||||
R 9c0d8e2f5a853263270cb382693ec393
|
||||
U drh
|
||||
Z 8eb9cfa9eaeb9d935dda443dd1d5d0a4
|
||||
Z 385597eeec31fcd3b70006a6664f87b7
|
||||
|
@ -1 +1 @@
|
||||
e4c8b1c3aa9d288f518c6394187354e6fa18978e
|
||||
062ecc1368d6bb6d15da31e8d6f5953e8f5628b9
|
46
www/arch.tcl
46
www/arch.tcl
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Run this Tcl script to generate the sqlite.html file.
|
||||
#
|
||||
set rcsid {$Id: arch.tcl,v 1.9 2003/03/19 03:14:03 drh Exp $}
|
||||
set rcsid {$Id: arch.tcl,v 1.10 2004/02/18 16:56:32 drh Exp $}
|
||||
|
||||
puts {<html>
|
||||
<head>
|
||||
@ -20,7 +20,7 @@ puts {
|
||||
|
||||
<table align="right" border="1" cellpadding="15" cellspacing="1">
|
||||
<tr><th>Block Diagram Of SQLite</th></tr>
|
||||
<tr><td><img src="arch.png"></td></tr>
|
||||
<tr><td><img src="arch2.gif"></td></tr>
|
||||
</table>
|
||||
<p>This document describes the architecture of the SQLite library.
|
||||
The information here is useful to those who want to understand or
|
||||
@ -33,11 +33,30 @@ and how they interrelate is shown at the right. The text that
|
||||
follows will provide a quick overview of each of these components.
|
||||
</p>
|
||||
|
||||
<h2>History</h2>
|
||||
|
||||
<p>
|
||||
There are two main C interfaces to the SQLite library:
|
||||
<b>sqlite_exec()</b> and <b>sqlite_compile()</b>. Prior to
|
||||
version 2.8.0 (2003-Feb-16) only sqlite_exec() was supported.
|
||||
For version 2.8.0, the sqlite_exec and sqlite_compile methods
|
||||
existed as peers. Beginning with version 2.8.13, the sqlite_compile
|
||||
method is the primary interface, and sqlite_exec is implemented
|
||||
using sqlite_compile. Externally, there are API extensions but
|
||||
not changes that break backwards compatibility. But internally,
|
||||
the plumbing is very different. The diagram at the right shows
|
||||
the structure of SQLite for version 2.8.13 and following.
|
||||
</p>
|
||||
|
||||
<h2>Interface</h2>
|
||||
|
||||
<p>Most of the public interface to the SQLite library is implemented by
|
||||
four functions found in the <b>main.c</b> source file. The
|
||||
<p>Much of the public interface to the SQLite library is implemented by
|
||||
functions found in the <b>main.c</b> source file though some routines are
|
||||
scattered about in other files where they can have access to data
|
||||
structures with file scope. The
|
||||
<b>sqlite_get_table()</b> routine is implemented in <b>table.c</b>.
|
||||
<b>sqlite_step()</b> is found in <b>vdbe.c</b>.
|
||||
<b>sqlite_mprintf()</b> is found in <b>printf.c</b>.
|
||||
The Tcl interface is implemented by <b>tclsqlite.c</b>. More
|
||||
information on the C interface to SQLite is
|
||||
<a href="c_interface.html">available separately</a>.<p>
|
||||
@ -48,6 +67,10 @@ Those symbols that are intended for external use (in other words,
|
||||
those symbols which form the API for SQLite) begin
|
||||
with <b>sqlite_</b>.</p>
|
||||
|
||||
<h2>SQL Command Process</h2>
|
||||
|
||||
<p>
|
||||
|
||||
<h2>Tokenizer</h2>
|
||||
|
||||
<p>When a string containing SQL statements is to be executed, the
|
||||
@ -117,7 +140,20 @@ source file <b>vdbe.c</b>. The virtual machine also has
|
||||
its own header file <b>vdbe.h</b> that defines an interface
|
||||
between the virtual machine and the rest of the SQLite library.</p>
|
||||
|
||||
<h2>B-tree Driver</h2>
|
||||
<h2>Backend</h2>
|
||||
|
||||
<p>The backend is an abstraction layer that presents a uniform interface
|
||||
to the virtual machine for either the B-Tree drivers for disk-based
|
||||
databases or the Red/Black Tree driver for in-memory databases.
|
||||
The <b>btree.h</b> source file contains the details.</p>
|
||||
|
||||
<h2>Red/Black Tree</h2>
|
||||
|
||||
<p>In-memory databases are stored in a red/black tree implementation
|
||||
contain in the <b>btree_rb.c</b> source file.
|
||||
</p>
|
||||
|
||||
<h2>B-Tree</h2>
|
||||
|
||||
<p>An SQLite database is maintained on disk using a B-tree implementation
|
||||
found in the <b>btree.c</b> source file. A separate B-tree is used for
|
||||
|
136
www/arch2.fig
Normal file
136
www/arch2.fig
Normal file
@ -0,0 +1,136 @@
|
||||
#FIG 3.2
|
||||
Landscape
|
||||
Center
|
||||
Inches
|
||||
Letter
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
0 32 #000000
|
||||
0 33 #868686
|
||||
0 34 #dfefd7
|
||||
0 35 #d7efef
|
||||
0 36 #efdbef
|
||||
0 37 #efdbd7
|
||||
0 38 #e7efcf
|
||||
0 39 #9e9e9e
|
||||
6 4950 4275 6525 4800
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
5025 4350 6525 4350 6525 4800 5025 4800 5025 4350
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
4950 4275 6450 4275 6450 4725 4950 4725 4950 4275
|
||||
4 1 0 50 0 2 12 0.0000 4 135 1335 5700 4575 Red/Black Tree\001
|
||||
-6
|
||||
6 5400 5475 6825 6000
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
5400 5475 6750 5475 6750 5925 5400 5925 5400 5475
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
5475 5550 6825 5550 6825 6000 5475 6000 5475 5550
|
||||
4 1 0 50 0 2 12 0.0000 4 135 630 6000 5775 Utilities\001
|
||||
-6
|
||||
6 5400 6300 6825 6825
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
5400 6300 6750 6300 6750 6750 5400 6750 5400 6300
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
5475 6375 6825 6375 6825 6825 5475 6825 5475 6375
|
||||
4 1 0 50 0 2 12 0.0000 4 135 855 6000 6600 Test Code\001
|
||||
-6
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
5475 2625 6825 2625 6825 3525 5475 3525 5475 2625
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
5400 2550 6750 2550 6750 3450 5400 3450 5400 2550
|
||||
2 3 0 1 0 35 55 0 20 0.000 0 0 -1 0 0 9
|
||||
2850 3675 4875 3675 4875 3975 6750 3975 6750 5025 4875 5025
|
||||
4875 6975 2850 6975 2850 3675
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 6300 4575 6300 4575 6750 3225 6750 3225 6300
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 6375 4650 6375 4650 6825 3300 6825 3300 6375
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 5475 4575 5475 4575 5925 3225 5925 3225 5475
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 5550 4650 5550 4650 6000 3300 6000 3300 5550
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 4725 4575 4725 4575 5175 3225 5175 3225 4725
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 4800 4650 4800 4650 5250 3300 5250 3300 4800
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 3900 4575 3900 4575 4350 3225 4350 3225 3900
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 3975 4650 3975 4650 4425 3300 4425 3300 3975
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
5400 1800 6750 1800 6750 2250 5400 2250 5400 1800
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
5475 1875 6825 1875 6825 2325 5475 2325 5475 1875
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
5400 1050 6750 1050 6750 1500 5400 1500 5400 1050
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
5475 1125 6825 1125 6825 1575 5475 1575 5475 1125
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 1050 4575 1050 4575 1500 3225 1500 3225 1050
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 1125 4650 1125 4650 1575 3300 1575 3300 1125
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 1800 4575 1800 4575 2250 3225 2250 3225 1800
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 1875 4650 1875 4650 2325 3300 2325 3300 1875
|
||||
2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5
|
||||
3225 2550 4575 2550 4575 3000 3225 3000 3225 2550
|
||||
2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5
|
||||
3300 2625 4650 2625 4650 3075 3300 3075 3300 2625
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
3900 1500 3900 1800
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
3900 2250 3900 2550
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
3900 3000 3900 3900
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
4575 1950 5400 1350
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
5400 2925 4650 2175
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
3900 4350 3900 4725
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
4575 4200 4950 4500
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
3900 5175 3900 5475
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
3900 5925 3900 6300
|
||||
2 2 0 1 0 37 55 0 20 0.000 0 0 -1 0 0 5
|
||||
5175 750 7200 750 7200 3750 5175 3750 5175 750
|
||||
2 2 0 1 0 34 55 0 20 0.000 0 0 -1 0 0 5
|
||||
2850 750 4875 750 4875 3375 2850 3375 2850 750
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
6075 1500 6075 1800
|
||||
2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 60.00 120.00
|
||||
6075 2250 6075 2550
|
||||
2 2 0 1 0 38 55 0 20 0.000 0 0 -1 0 0 5
|
||||
5175 5250 7200 5250 7200 6975 5175 6975 5175 5250
|
||||
4 1 0 50 0 2 12 0.0000 4 135 855 6075 1350 Tokenizer\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 570 6075 2100 Parser\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 420 6075 2925 Code\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 855 6075 3150 Generator\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 720 3900 4200 Backend\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 1050 3900 6600 OS Interface\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 615 3900 5025 B-Tree\001
|
||||
4 1 0 50 0 2 12 0.0000 4 180 495 3900 5775 Pager\001
|
||||
4 1 0 50 0 1 12 1.5708 4 180 1020 7125 2250 SQL Compiler\001
|
||||
4 1 0 50 0 1 12 1.5708 4 135 885 7125 6150 Accessories\001
|
||||
4 1 0 50 0 1 12 1.5708 4 135 645 3075 5250 Backend\001
|
||||
4 1 0 50 0 1 12 1.5708 4 135 345 3075 2025 Core\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 1290 3900 2850 Virtual Machine\001
|
||||
4 1 0 50 0 2 12 0.0000 4 165 1185 3900 1995 SQL Command\001
|
||||
4 1 0 50 0 2 12 0.0000 4 135 855 3900 2183 Processor\001
|
||||
4 1 0 50 0 2 14 0.0000 4 150 870 3900 1350 Interface\001
|
BIN
www/arch2.gif
Normal file
BIN
www/arch2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
Loading…
Reference in New Issue
Block a user