1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Documentation updates. (CVS 275)

FossilOrigin-Name: 4b4bfc6290f05c6672338690911f68fd8bb418c9
This commit is contained in:
drh
2001-09-28 23:11:24 +00:00
parent a5e2e92f59
commit b0bf726fe3
9 changed files with 127 additions and 101 deletions

View File

@ -1,5 +1,5 @@
C Remove\sreference\sto\sGDBM\sin\sthe\sdocumentation\sof\sthe\s"sqlite"\ncommand-line\sutility.\s(CVS\s274) C Documentation\supdates.\s(CVS\s275)
D 2001-09-28T18:14:17 D 2001-09-28T23:11:24
F Makefile.in 98d4627cb364537e4c3a29ee806171f3abf5211a F Makefile.in 98d4627cb364537e4c3a29ee806171f3abf5211a
F Makefile.template 7179523fdf3d6e7933ec843e2352dcfc9785c700 F Makefile.template 7179523fdf3d6e7933ec843e2352dcfc9785c700
F README 93d2977cc5c6595c448de16bdefc312b9d401533 F README 93d2977cc5c6595c448de16bdefc312b9d401533
@ -98,20 +98,20 @@ F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816 F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816
F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4 F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
F www/arch.tcl c1891efdc00cd76eec72bdbf8b446195902932a3 F www/arch.tcl 03b521d252575f93b9c52f7c8b0007011512fcfb
F www/c_interface.tcl 52ae81c89bf906b358e04857bd3f76b1a7f61c1b F www/c_interface.tcl 8e8d9e66e8467c5751116c3427296bde77f474a6
F www/changes.tcl 47619693c843174b57d41482fcd00e2e70d41fd0 F www/changes.tcl 47619693c843174b57d41482fcd00e2e70d41fd0
F www/crosscompile.tcl c99efacb3aefaa550c6e80d91b240f55eb9fd33e F www/crosscompile.tcl c99efacb3aefaa550c6e80d91b240f55eb9fd33e
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
F www/index.tcl 639a75165dc532a16ddb02055bc69541eecc3fa7 F www/index.tcl 998f61fe69be9f1b04e403c8efb75bca92710e83
F www/lang.tcl 33a74d727615ccbee8be7c8efd5876ce008c4b0e F www/lang.tcl 33a74d727615ccbee8be7c8efd5876ce008c4b0e
F www/mingw.tcl fc5f4ba9d336b6e8c97347cc6496d6162461ef60 F www/mingw.tcl fc5f4ba9d336b6e8c97347cc6496d6162461ef60
F www/opcode.tcl 60222aeb57a7855b2582c374b8753cb5bb53c4ab F www/opcode.tcl 4365ad9798872491dbd7d3071510ebe461785ac3
F www/speed.tcl 91b53f9403a62bb322dc1f85a81531309bcfb41c F www/speed.tcl ab7d6d3bc898472bd94320a5d3c63de928d4804b
F www/sqlite.tcl ea362207eee32cdd9dd594b1ec990bdb20101efe F www/sqlite.tcl 6a21242a272e9c0939a04419a51c3d50cae33e3e
F www/tclsqlite.tcl 13d50723f583888fc80ae1a38247c0ab415066fa F www/tclsqlite.tcl 13d50723f583888fc80ae1a38247c0ab415066fa
F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad F www/vdbe.tcl bb7d620995f0a987293e9d4fb6185a3b077e9b44
P 7e79e91b03e21058bbae2c0aab8f3e8ce09ae7f9 P 0ffab36d1fc29125fdcf0d732073f77012dfcad4
R 241095ce4074dd39044429d0144b987e R 50ffde789836ed27912ab4a11f3cd02b
U drh U drh
Z 5497d3942cad9d16c737ee62c27c8636 Z 7f4c737cc5ad90cbc1518651f459aab9

View File

@ -1 +1 @@
0ffab36d1fc29125fdcf0d732073f77012dfcad4 4b4bfc6290f05c6672338690911f68fd8bb418c9

View File

@ -1,7 +1,7 @@
# #
# Run this Tcl script to generate the sqlite.html file. # Run this Tcl script to generate the sqlite.html file.
# #
set rcsid {$Id: arch.tcl,v 1.5 2001/09/20 01:44:43 drh Exp $} set rcsid {$Id: arch.tcl,v 1.6 2001/09/28 23:11:24 drh Exp $}
puts {<html> puts {<html>
<head> <head>
@ -121,11 +121,11 @@ between the virtual machine and the rest of the SQLite library.</p>
<p>An SQLite database is maintained on disk using a B-tree implementation <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 found in the <b>btree.c</b> source file. A separate B-tree is used for
each table and index in the database but all B-trees are stored in the each table and index in the database. All B-trees are stored in the
same disk file. Each page of a B-tree is 1024 bytes in size. The data same disk file. Each page of a B-tree is 1024 bytes in size. The key
is stored with the key in an area called "payload". Up to 236 bytes of and data for an entry are stored together in an area called "payload".
payload can be stored with each B-tree entry. Any additional payload Up to 236 bytes of payload can be stored on the same page as the B-tree
is stored in a chain of overflow pages.</p> entry. Any additional payload is stored in a chain of overflow pages.</p>
<p>The interface to the B-tree subsystem is defined by the header file <p>The interface to the B-tree subsystem is defined by the header file
<b>btree.h</b>. <b>btree.h</b>.
@ -135,11 +135,11 @@ is stored in a chain of overflow pages.</p>
<p>The B-tree module requests information from the disk in 1024 byte <p>The B-tree module requests information from the disk in 1024 byte
chunks. The page cache is reponsible for reading, writing, and chunks. The page cache is reponsible for reading, writing, and
caching these chunks for the B-tree module. caching these chunks at the behest of the B-tree module.
The page cache also provides the rollback and atomic commit abstraction The page cache also provides the rollback and atomic commit abstraction
and takes care of reader/writer locking of the database file. The and takes care of reader/writer locking of the database file. The
B-tree driver requests particular pages from the page cache and notifies B-tree driver requests particular pages from the page cache and notifies
the page cache when it wants to modify pages and commit or rollback its the page cache when it wants to modify pages or commit or rollback
changes and the page cache handles all the messy details of making sure changes and the page cache handles all the messy details of making sure
the requests are handled quickly, safely, and efficiently.</p> the requests are handled quickly, safely, and efficiently.</p>

View File

@ -1,7 +1,7 @@
# #
# Run this Tcl script to generate the sqlite.html file. # Run this Tcl script to generate the sqlite.html file.
# #
set rcsid {$Id: c_interface.tcl,v 1.15 2001/09/20 01:44:43 drh Exp $} set rcsid {$Id: c_interface.tcl,v 1.16 2001/09/28 23:11:24 drh Exp $}
puts {<html> puts {<html>
<head> <head>
@ -41,22 +41,26 @@ int sqlite_exec(
char **errmsg char **errmsg
); );
#define SQLITE_OK 0 /* Successful result */ #define SQLITE_OK 0 /* Successful result */
#define SQLITE_ERROR 1 /* SQL error or missing database */ #define SQLITE_ERROR 1 /* SQL error or missing database */
#define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */ #define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */
#define SQLITE_PERM 3 /* Access permission denied */ #define SQLITE_PERM 3 /* Access permission denied */
#define SQLITE_ABORT 4 /* Callback routine requested an abort */ #define SQLITE_ABORT 4 /* Callback routine requested an abort */
#define SQLITE_BUSY 5 /* One or more database files are locked */ #define SQLITE_BUSY 5 /* The database file is locked */
#define SQLITE_NOMEM 6 /* A malloc() failed */ #define SQLITE_LOCKED 6 /* A table in the database is locked */
#define SQLITE_READONLY 7 /* Attempt to write a readonly database */ #define SQLITE_NOMEM 7 /* A malloc() failed */
#define SQLITE_INTERRUPT 8 /* Operation terminated by sqlite_interrupt() */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */
#define SQLITE_IOERR 9 /* Some kind of disk I/O error occurred */ #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite_interrupt() */
#define SQLITE_CORRUPT 10 /* The database disk image is malformed */ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
#define SQLITE_FULL 12 /* Insertion failed because database is full */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
#define SQLITE_CANTOPEN 13 /* Unable to open the database file */ #define SQLITE_NOTFOUND 12 /* (Internal Only) Table or record not found */
#define SQLITE_PROTOCOL 14 /* Database lock protocol error */ #define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_SCHEMA 16 /* The database schema changed */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_TOOBIG 17 /* Too much data for one row of a table */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
#define SQLITE_EMPTY 16 /* (Internal Only) Database table is empty */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* Too much data for one row of a table */
#define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */
</pre></blockquote> </pre></blockquote>
<p>Only the three core routines shown above are required to use <p>Only the three core routines shown above are required to use
@ -259,6 +263,15 @@ database at the same time, but only one thread can have the database
open for writing at the same time. Locking in SQLite is on the open for writing at the same time. Locking in SQLite is on the
entire database.</p> entire database.</p>
</p></dd> </p></dd>
<dt>SQLITE_LOCKED</dt>
<dd><p>This return code is similar to SQLITE_BUSY in that it indicates
that the database is locked. But the source of the lock is a recursive
call to <b>sqlite_exec()</b>. This return can only occur if you attempt
to invoke sqlite_exec() from within a callback routine of a query
from a prior invocation of sqlite_exec(). Recursive calls to
sqlite_exec() are allowed as long as no more they all read-only or do
not attempt to write the same table.
</p></dd>
<dt>SQLITE_NOMEM</dt> <dt>SQLITE_NOMEM</dt>
<dd><p>This value is returned if a call to <b>malloc()</b> fails. <dd><p>This value is returned if a call to <b>malloc()</b> fails.
</p></dd> </p></dd>
@ -309,6 +322,10 @@ command usually will clear the problem.
of a single table. If you attempt to store more than 64K in a single of a single table. If you attempt to store more than 64K in a single
row, this is the return code you get. row, this is the return code you get.
</p></dd> </p></dd>
<dt>SQLITE_CONSTRAINT</dt>
<dd><p>This constant is returned if the SQL statement would have violated
a database constraint.
</p></dd>
</dl> </dl>
</blockquote> </blockquote>

View File

@ -1,7 +1,7 @@
# #
# Run this TCL script to generate HTML for the index.html file. # Run this TCL script to generate HTML for the index.html file.
# #
set rcsid {$Id: index.tcl,v 1.42 2001/09/28 17:47:14 drh Exp $} set rcsid {$Id: index.tcl,v 1.43 2001/09/28 23:11:24 drh Exp $}
puts {<html> puts {<html>
<head><title>SQLite: An SQL Database Engine In A C Library</title></head> <head><title>SQLite: An SQL Database Engine In A C Library</title></head>
@ -41,7 +41,7 @@ puts {<h2>Features</h2>
<p><ul> <p><ul>
<li>Implements a large subset of SQL92.</li> <li>Implements a large subset of SQL92.</li>
<li>A complete SQL database (with multiple tables and indices) is <li>A complete database (with multiple tables and indices) is
stored in a single disk file.</li> stored in a single disk file.</li>
<li>Atomic commit and rollback protect data integrity.</li> <li>Atomic commit and rollback protect data integrity.</li>
<li>Small memory footprint: about 12000 lines of C code.</li> <li>Small memory footprint: about 12000 lines of C code.</li>
@ -50,8 +50,7 @@ puts {<h2>Features</h2>
<li>Very simple <li>Very simple
<a href="c_interface.html">C/C++ interface</a> requires the use of only <a href="c_interface.html">C/C++ interface</a> requires the use of only
three functions and one opaque structure.</li> three functions and one opaque structure.</li>
<li>A <a href="tclsqlite.html">TCL interface</a> <li><a href="tclsqlite.html">TCL bindings</a> included.</li>
to the library is included.</li>
<li>A TCL-based test suite provides near 100% code coverage.</li> <li>A TCL-based test suite provides near 100% code coverage.</li>
<li>Self-contained: no external dependencies.</li> <li>Self-contained: no external dependencies.</li>
<li>Built and tested under Linux and Win2K.</li> <li>Built and tested under Linux and Win2K.</li>
@ -60,21 +59,34 @@ three functions and one opaque structure.</li>
</p> </p>
} }
puts {<h2>Download</h2>
<p>
Precompiled binaries for Linux and Windows and the complete
source tree are available for <a href="download.html">download</a>.
</p>
}
puts {<h2>Current Status</h2> puts {<h2>Current Status</h2>
<p>A <a href="changes.html">change history</a> is available online. <p>A <a href="changes.html">change history</a> is available online.
The latest source code is
<a href="download.html">available for download</a>.
There are currently no <em>known</em> memory leaks or debilitating bugs There are currently no <em>known</em> memory leaks or debilitating bugs
in the library. <a href="http://gcc.gnu.org/onlinedocs/gcov_1.html">Gcov</a> in the library.
is used to verify test coverage.</p> </p>
<p>
The file format used changed beginning with version 2.0.0. Version 1.0.X
of SQLite used GDBM as its database backend. Version 2.0.0 and later
use a built-in implementation of B-trees. If you have older 1.0 databases
you will need to convert them before they can be read using a 2.0
release of SQLite. The following command will convert a legacy
database into the new 2.0 format:
</p>
<blockquote><pre>
echo .dump | sqlite1.0 old.db | sqlite2.0 new.db
</pre></blockquote>
<p>
The above command assumes that <b>sqlite1.0</b> is sqlite version 1.0
and <b>sqlite2.0</b> is sqlite version 2.0. The old database is stored
in a directory named <b>old.db</b> and the new database is created in
the file <b>new.db</b>.
</p>
<h2>Documentation</h2> <h2>Documentation</h2>
@ -85,7 +97,7 @@ is used to verify test coverage.</p>
command-line utility.</li> command-line utility.</li>
<li>The <a href="lang.html">SQL Language</a> subset understood by SQLite.</li> <li>The <a href="lang.html">SQL Language</a> subset understood by SQLite.</li>
<li>The <a href="c_interface.html">C/C++ Interface</a>.</li> <li>The <a href="c_interface.html">C/C++ Interface</a>.</li>
<li>The <a href="tclsqlite.html">Tcl Interface</a>.</li> <li>The <a href="tclsqlite.html">Tcl Binding</a> to SQLite.</li>
<li>The <a href="arch.html">Architecture of the SQLite Library</a> describes <li>The <a href="arch.html">Architecture of the SQLite Library</a> describes
how the library is put together.</li> how the library is put together.</li>
<li>A description of the <a href="opcode.html">virtual machine</a> that <li>A description of the <a href="opcode.html">virtual machine</a> that

View File

@ -1,7 +1,7 @@
# #
# Run this Tcl script to generate the sqlite.html file. # Run this Tcl script to generate the sqlite.html file.
# #
set rcsid {$Id: opcode.tcl,v 1.5 2001/09/20 01:44:44 drh Exp $} set rcsid {$Id: opcode.tcl,v 1.6 2001/09/28 23:11:24 drh Exp $}
puts {<html> puts {<html>
<head> <head>
@ -183,27 +183,26 @@ sqlite> (((explain delete from tbl1 where two<20;)))
addr opcode p1 p2 p3 addr opcode p1 p2 p3
---- ------------ ----- ----- ---------------------------------------- ---- ------------ ----- ----- ----------------------------------------
0 Transaction 0 0 0 Transaction 0 0
1 VerifyCookie 990 0 1 VerifyCookie 219 0
2 ListOpen 0 0 2 ListOpen 0 0
3 Open 0 31 tbl1 3 Open 0 3 tbl1
4 VerifyCookie 990 0 4 Rewind 0 0
5 Rewind 0 0 5 Next 0 12
6 Next 0 13 6 Column 0 1
7 Column 0 1 7 Integer 20 0
8 Integer 20 0 8 Ge 0 5
9 Ge 0 6 9 Recno 0 0
10 Recno 0 0 10 ListWrite 0 0
11 ListWrite 0 0 11 Goto 0 5
12 Goto 0 6 12 Close 0 0
13 Close 0 0 13 ListRewind 0 0
14 ListRewind 0 0 14 OpenWrite 0 3
15 Open 0 31 15 ListRead 0 19
16 ListRead 0 20 16 MoveTo 0 0
17 MoveTo 0 0 17 Delete 0 0
18 Delete 0 0 18 Goto 0 15
19 Goto 0 16 19 ListClose 0 0
20 ListClose 0 0 20 Commit 0 0
21 Commit 0 0
} }
puts { puts {

View File

@ -1,7 +1,7 @@
# #
# Run this Tcl script to generate the speed.html file. # Run this Tcl script to generate the speed.html file.
# #
set rcsid {$Id: speed.tcl,v 1.2 2001/09/25 02:04:29 drh Exp $ } set rcsid {$Id: speed.tcl,v 1.3 2001/09/28 23:11:24 drh Exp $ }
puts {<html> puts {<html>
<head> <head>
@ -29,7 +29,7 @@ conclusions drawn from these experiments:
SQLite 2.0 is significantly faster than both SQLite 1.0 and PostgreSQL SQLite 2.0 is significantly faster than both SQLite 1.0 and PostgreSQL
for most common operations. for most common operations.
SQLite 2.0 is over 4 times faster than PostgreSQL for simple SQLite 2.0 is over 4 times faster than PostgreSQL for simple
query operations about 7 times faster for <b>INSERT</b> statements query operations and about 7 times faster for <b>INSERT</b> statements
within a transaction. within a transaction.
</p></li> </p></li>
<li><p> <li><p>
@ -75,8 +75,7 @@ the NDEBUG macro makes SQLite 2.0 run nearly twice as fast.
<p> <p>
All tests are conducted on an otherwise quiescent machine. All tests are conducted on an otherwise quiescent machine.
A simple shell script generates and runs all the tests. A simple shell script was used to generate and run all the tests.
The shell script is named <a href="speedtest3.sh">speedtest3.sh</a>.
Each test reports three different times: Each test reports three different times:
</p> </p>

View File

@ -1,7 +1,7 @@
# #
# Run this Tcl script to generate the sqlite.html file. # Run this Tcl script to generate the sqlite.html file.
# #
set rcsid {$Id: sqlite.tcl,v 1.14 2001/09/28 18:14:17 drh Exp $} set rcsid {$Id: sqlite.tcl,v 1.15 2001/09/28 23:11:24 drh Exp $}
puts {<html> puts {<html>
<head> <head>
@ -28,8 +28,7 @@ the name the file that holds the SQLite database. If the file does
not exist, a new one is created automatically. not exist, a new one is created automatically.
The <b>sqlite</b> program will The <b>sqlite</b> program will
then prompt you to enter SQL. Type in SQL statements (terminated by a then prompt you to enter SQL. Type in SQL statements (terminated by a
semicolon), press "Enter" and the SQL will be executed. It's as semicolon), press "Enter" and the SQL will be executed.</p>
simple as that!</p>
<p>For example, to create a new SQLite database named "ex1" <p>For example, to create a new SQLite database named "ex1"
with a single table named "tbl1", you might do this:</p> with a single table named "tbl1", you might do this:</p>
@ -48,6 +47,7 @@ proc Code {body} {
Code { Code {
$ (((sqlite ex1))) $ (((sqlite ex1)))
SQLite version 2.0.0
Enter ".help" for instructions Enter ".help" for instructions
sqlite> (((create table tbl1(one varchar(10), two smallint);))) sqlite> (((create table tbl1(one varchar(10), two smallint);)))
sqlite> (((insert into tbl1 values('hello!',10);))) sqlite> (((insert into tbl1 values('hello!',10);)))
@ -60,7 +60,7 @@ sqlite>
puts { puts {
<p>(In the example above, and in all subsequent examples, the commands <p>(In the example above, and in all subsequent examples, the commands
you type are underlined shown with a green tint and the responses you type are underlined and shown with a green tint and the responses
from the computer are shown in black without underlining.)</p> from the computer are shown in black without underlining.)</p>
<p>You can terminate the sqlite program by typing your systems <p>You can terminate the sqlite program by typing your systems
@ -85,31 +85,26 @@ sqlite>
} }
puts { puts {
<p>If you exit sqlite and look at the contents of the directory "ex1"
you'll see that it now contains two files: <b>sqlite_master.tcl</b>
and <b>tbl1.tbl</b>. The <b>tbl1.tbl</b> file contains all the
data for table "tbl1" in your database. The file
<b>sqlite_master.tbl</b> is a special table found on all SQLite
databases that records information about all other tables and
indices. In general, an SQLite database will contain one "*.tbl"
file for each table and index in your database, plus the extra
"sqlite_master.tbl" file used to store the database schema.</p>
<h2>Aside: Querying the SQLITE_MASTER table</h2> <h2>Aside: Querying the SQLITE_MASTER table</h2>
<p>You can execute "SELECT" statements against the <p>The database schema in an SQLite database is stored in
a special table named "sqlite_master".
You can execute "SELECT" statements against the
special sqlite_master table just like any other table special sqlite_master table just like any other table
in an SQLite database. For example:</p> in an SQLite database. For example:</p>
} }
Code { Code {
$ (((sqlite ex1))) $ (((sqlite ex1)))
SQlite vresion 2.0.0
Enter ".help" for instructions Enter ".help" for instructions
sqlite> (((select * from sqlite_master;))) sqlite> (((select * from sqlite_master;)))
type = table type = table
name = tbl1 name = tbl1
tbl_name = tbl1 tbl_name = tbl1
sql = create table tbl1(one varchar(10), two smallint) rootpage = 3
sql = create table tbl1(one varchar(10), two smallint)
sqlite> sqlite>
} }

View File

@ -1,7 +1,7 @@
# #
# Run this Tcl script to generate the vdbe.html file. # Run this Tcl script to generate the vdbe.html file.
# #
set rcsid {$Id: vdbe.tcl,v 1.6 2000/11/28 20:46:41 drh Exp $} set rcsid {$Id: vdbe.tcl,v 1.7 2001/09/28 23:11:24 drh Exp $}
puts {<html> puts {<html>
<head> <head>
@ -15,11 +15,15 @@ puts "<p align=center>
(This page was last modified on [lrange $rcsid 3 4] GMT) (This page was last modified on [lrange $rcsid 3 4] GMT)
</p>" </p>"
# puts { puts {
# <blockquote><font color="red"><b>This document is <blockquote><font color="red"><b>
# currently under development. It is incomplete and contains This document describes the
# errors. Use it accordingly.</b></font></blockquote> virtual machine used in SQLite version 1.0. It has not been
# } updated to reflect important changes that have occurred for
version 2.0. Some of the information presented below is
obsolete and/or incorrect. Use it accordingly.
</b></font></blockquote>
}
puts { puts {
<p>If you want to know how the SQLite library works internally, <p>If you want to know how the SQLite library works internally,