diff --git a/Makefile.in b/Makefile.in
index 887254411e..ee213e5877 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -51,11 +51,41 @@ LIBOBJ = build.o dbbe.o delete.o expr.o insert.o \
main.o parse.o select.o tokenize.o update.o \
util.o vdbe.o where.o
+# All of the source code files.
+#
+SRC = \
+ $(TOP)/src/build.c \
+ $(TOP)/src/dbbe.c \
+ $(TOP)/src/dbbe.h \
+ $(TOP)/src/delete.c \
+ $(TOP)/src/expr.c \
+ $(TOP)/src/insert.c \
+ $(TOP)/src/main.c \
+ $(TOP)/src/parse.y \
+ $(TOP)/src/select.c \
+ $(TOP)/src/shell.c \
+ $(TOP)/src/sqlite.h \
+ $(TOP)/src/sqliteInt.h \
+ $(TOP)/src/tclsqlite.c \
+ $(TOP)/src/tokenize.c \
+ $(TOP)/src/update.c \
+ $(TOP)/src/util.c \
+ $(TOP)/src/vdbe.c \
+ $(TOP)/src/vdbe.h \
+ $(TOP)/src/where.c
+
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
all: libsqlite.a sqlite.h sqlite
+# Generate the file "last_change" which contains the date of change
+# of the most recently modified source code file
+#
+last_change: $(SRC)
+ cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
+ | awk '{print $$5,$$6}' >last_change
+
libsqlite.a: $(LIBOBJ)
$(AR) libsqlite.a $(LIBOBJ)
$(RANLIB) libsqlite.a
@@ -153,7 +183,7 @@ sqlite.tar.gz:
all.tar.gz:
pwd=`pwd`; cd $(TOP)/..; tar czf $$pwd/all.tar.gz sqlite
-index.html: $(TOP)/www/index.tcl sqlite.tar.gz all.tar.gz
+index.html: $(TOP)/www/index.tcl sqlite.tar.gz all.tar.gz last_change
tclsh $(TOP)/www/index.tcl >index.html
sqlite.html: $(TOP)/www/sqlite.tcl
diff --git a/README b/README
index 76943caf22..10ca4e9082 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
This directory contains source code to
- SQLite: An SQL Frontend To GDBM
+ SQLite: An SQL Database Built Upon GDBM
To compile the project, first create a directory in which to place
the build products. The build directory must be separate from the
diff --git a/manifest b/manifest
index 768afc75df..9f506c2833 100644
--- a/manifest
+++ b/manifest
@@ -1,27 +1,27 @@
-C :-)\s(CVS\s1696)
-D 2000-06-02T02:09:23
+C :-)\s(CVS\s37)
+D 2000-06-02T13:27:59
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
-F Makefile.in 7ac2fef265940d93a544cb454efa836451559a71
-F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
+F Makefile.in b0553e870e5daa6279af4dc09101322db16a49f1
+F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
F configure 00a5b5c82147a576fa6e82d7c1b0d55c321d6d2c x
F configure.in 6ccfd5fc80517f7cfe605a7fc7e0f62d962a233c
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
-F src/build.c f56c47f08c2f01fd640abb920c5da6b6614fbf3f
-F src/dbbe.c ce2d78a92a14c874443fda3069fde06d330807df
+F src/build.c 44a99167e5aebd04a65c607dc8556c13d9bccdb0
+F src/dbbe.c ae8b5d2cdb4fa7dd11313059984be9457fa77f63
F src/dbbe.h a8a46f71238e0f09f3ec08fd9d1c8c7f4cdc49bf
F src/delete.c e11433c14ed5cc8553cba14296b3baa3c23054bc
-F src/expr.c 91970700e3e39b2b725b028c166f588a5bb0c038
-F src/insert.c 5d713f4a05cef76a188207aa986776e02349ba70
-F src/main.c 9123ef6567b6a5255643040b0832b9d70ae2b4ed
+F src/expr.c fb0972a54cc0230b6d4ce02c80ae07d0e1876e01
+F src/insert.c 747aad76e48a811c6fd30336514df84104587c3f
+F src/main.c e0fb4de58091f7421793e9b93571cf2d64caf3c3
F src/parse.y 16322c46ec117082ef745715f7a4761f2491a0b2
F src/select.c ce21eb2db2c621c097f03c21ff8d18804fb9897d
-F src/shell.c 9a42923e9c8ec1654dd1ef1aa113eca26dcf30db
+F src/shell.c bd658f9208bc20ce565c3f687836155772ca939a
F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268
-F src/sqliteInt.h fe26be33f20aea88378301998b2f5c308005bf4c
+F src/sqliteInt.h 0b7a533a389ccead699ea149ff3f8d61831d0c0a
F src/tclsqlite.c 10c00c460246cfba375b768c90b22bfe3c774c8f
F src/tokenize.c 15c229fee77325334c6814652e429b0930eba6c1
F src/update.c 1f7284e00921352c3ae699fb60f2c2fbf8098212
-F src/util.c da47fe65efa6ff4c5e663cc7c832964bd599c0d2
+F src/util.c c22846f23b9311ca0e68f076686493bac7b20d5d
F src/vdbe.c a92f66fa70d1df99ff29795fe8f18e9ea51f8f4c
F src/vdbe.h ab574c91c6328c5795f68b84074fbcf860eae70e
F src/where.c bed9a8360cbfbf712bdc397c8e22216a5e5f9800
@@ -32,6 +32,7 @@ F test/expr.test f3fc925935533082911dfa5fde9b22e382b3132f
F test/index.test 8d4f26901a5582daa353fe3c8266cbf4a53af830
F test/insert.test 161bc67a4189738c559e3569323ceae31f4d49d6
F test/select1.test a0b00df77e85adff75c338e487718c5d31f69e3a
+F test/select2.test 33a53530dc011bcf970068f79674b2272fda5917
F test/table.test 85d6f410d127ec508c6640f02d7c40d218414e81
F test/tester.tcl 44690d463c1dc83a4c76ccde07cc146a988600f6
F test/update.test 69459302ea75cafac1479e60b0e36efb88123c0e
@@ -41,11 +42,11 @@ F tool/lempar.c a1eec94d6eacc12332368660ec65f3b248853833
F tool/opNames.awk 2bd9071a138e4e2be13dc98fe066398a61219e1e
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
-F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5
-F www/changes.tcl 37f4906f0b03f2160d2b2e4ed3cedb0b91d253cb
-F www/index.tcl 001f8c8c4edbe20e25c508005a12f2f265f84c9c
-F www/sqlite.tcl 2a0056dd6d78839636176b770d9f37d12e66660e
-P d3c31defbaf25f470d0977c39325890ab8bad054
-R 1972cc5d0dec5079acb55afe886914ee
+F www/c_interface.tcl 8867d76ddd416d2fbd41e4cb3de8efa9cef105a5
+F www/changes.tcl 7d6ed774362dea0c9687d4efbafd939c1c48fd81
+F www/index.tcl 95bab9c95813c2222265532e4e0340a8c1d4e354
+F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd
+P 80d925b82b176df7f73a1747a6ed711ac3d9a0d3
+R e8a51bd00aae9034f42802ab343d2bb5
U drh
-Z b89a6085ec647850e84316905c71acda
+Z aaac793e5f9c2c3602d5040dcac36c63
diff --git a/manifest.uuid b/manifest.uuid
index 3c1a1f58b2..9aea99ffb5 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-80d925b82b176df7f73a1747a6ed711ac3d9a0d3
\ No newline at end of file
+2b55f9b790e2914bbd2fd27ef23bbab79fa76937
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index d5e98435ce..0c7904d348 100644
--- a/src/build.c
+++ b/src/build.c
@@ -22,9 +22,18 @@
**
*************************************************************************
** This file contains C code routines that are called by the parser
-** when syntax rules are reduced.
+** when syntax rules are reduced. The routines in this file handle
+** the following kinds of rules:
**
-** $Id: build.c,v 1.12 2000/06/02 01:17:37 drh Exp $
+** CREATE TABLE
+** DROP TABLE
+** CREATE INDEX
+** DROP INDEX
+** creating expressions and ID lists
+** COPY
+** VACUUM
+**
+** $Id: build.c,v 1.13 2000/06/02 13:27:59 drh Exp $
*/
#include "sqliteInt.h"
@@ -529,15 +538,15 @@ void sqliteCreateIndex(
*/
if( pParse->initFlag==0 ){
static VdbeOp addTable[] = {
- { OP_Open, 0, 1, MASTER_NAME},
- { OP_New, 0, 0, 0},
+ { OP_Open, 2, 1, MASTER_NAME},
+ { OP_New, 2, 0, 0},
{ OP_String, 0, 0, "index"},
{ OP_String, 0, 0, 0}, /* 3 */
{ OP_String, 0, 0, 0}, /* 4 */
{ OP_String, 0, 0, 0}, /* 5 */
{ OP_MakeRecord, 4, 0, 0},
- { OP_Put, 0, 0, 0},
- { OP_Close, 0, 0, 0},
+ { OP_Put, 2, 0, 0},
+ { OP_Close, 2, 0, 0},
};
int n;
Vdbe *v = pParse->pVdbe;
@@ -548,6 +557,8 @@ void sqliteCreateIndex(
v = pParse->pVdbe = sqliteVdbeCreate(pParse->db->pBe);
}
if( v==0 ) goto exit_create_index;
+ sqliteVdbeAddOp(v, OP_Open, 0, 0, pTab->zName, 0);
+ sqliteVdbeAddOp(v, OP_Open, 1, 1, pIndex->zName, 0);
if( pStart && pEnd ){
int base;
n = (int)pEnd->z - (int)pStart->z + 1;
@@ -556,8 +567,6 @@ void sqliteCreateIndex(
sqliteVdbeChangeP3(v, base+4, pTab->zName, 0);
sqliteVdbeChangeP3(v, base+5, pStart->z, n);
}
- sqliteVdbeAddOp(v, OP_Open, 0, 0, pTab->zName, 0);
- sqliteVdbeAddOp(v, OP_Open, 1, 1, pIndex->zName, 0);
lbl1 = sqliteVdbeMakeLabel(v);
lbl2 = sqliteVdbeMakeLabel(v);
sqliteVdbeAddOp(v, OP_Next, 0, lbl2, 0, lbl1);
@@ -569,8 +578,8 @@ void sqliteCreateIndex(
sqliteVdbeAddOp(v, OP_PutIdx, 1, 0, 0, 0);
sqliteVdbeAddOp(v, OP_Goto, 0, lbl1, 0, 0);
sqliteVdbeAddOp(v, OP_Noop, 0, 0, 0, lbl2);
- sqliteVdbeAddOp(v, OP_Close, 0, 0, 0, 0);
sqliteVdbeAddOp(v, OP_Close, 1, 0, 0, 0);
+ sqliteVdbeAddOp(v, OP_Close, 0, 0, 0, 0);
}
/* Reclaim memory on an EXPLAIN call.
diff --git a/src/dbbe.c b/src/dbbe.c
index ec3cb33a42..ece4f4ff67 100644
--- a/src/dbbe.c
+++ b/src/dbbe.c
@@ -30,7 +30,7 @@
** relatively simple to convert to a different database such
** as NDBM, SDBM, or BerkeleyDB.
**
-** $Id: dbbe.c,v 1.10 2000/06/02 02:09:23 drh Exp $
+** $Id: dbbe.c,v 1.11 2000/06/02 13:27:59 drh Exp $
*/
#include "sqliteInt.h"
#include
The interface to the SQLite library consists of 4 functions -and one opaque data structure.
+The interface to the SQLite library consists of 4 functions, +one opaque data structure, and some constants used as return +values from sqlite_exec():
typedef struct sqlite sqlite; @@ -41,6 +42,15 @@ int sqlite_exec( ); int sqlite_complete(const char *sql); + +#define SQLITE_OK 0 /* Successful result */ +#define SQLITE_INTERNAL 1 /* An internal logic error in SQLite */ +#define SQLITE_ERROR 2 /* SQL error or missing database */ +#define SQLITE_PERM 3 /* Access permission denied */ +#define SQLITE_ABORT 4 /* Callback routine requested an abort */ +#define SQLITE_BUSY 5 /* One or more database files are locked */ +#define SQLITE_NOMEM 6 /* A malloc() failed */ +#define SQLITE_READONLY 7 /* Attempt to write a readonly database */
All of the above definitions are included in the "sqlite.h" @@ -48,7 +58,7 @@ header file that comes in the source tree.
Use the sqlite_open function to open an existing SQLite +
Use the sqlite_open() function to open an existing SQLite database or to create a new SQLite database. The first argument is the database name. The second argument is a constant 0666 to open the database for reading and writing and 0444 to open the @@ -73,7 +83,8 @@ an empty directory and the second parameter set to 0666.
The return value of the sqlite_open() function is a pointer to an opaque sqlite structure. This pointer will be the first argument to all subsequent SQLite function calls that -deal with the same database.
+deal with the same database. NULL is returned if the open fails +for any reason.A pointer to the sqlite structure obtained from a prior call to sqlite_open().
A null-terminated string containing the text of the SQL statements - and/or queries to be processed.
A null-terminated string containing the text of one or more + SQL statements and/or queries to be processed.
A pointer to a callback function which is invoked once for each row in the result of a query. This argument may be NULL, in which case no callbacks will ever be invoked.
A pointer to anything that is forward to become the first argument +
A pointer that is forwarded to become the first argument to the callback function.
A pointer to a string pointer into which error messages are written. +
A pointer to an error string. Error messages are written to space + obtained from malloc() and the error string is made to point to + the malloced space. The calling function is responsible for freeing + this space when it has finished with it. This argument may be NULL, in which case error messages are not reported back to the calling function.
The callback function should normally return 0. If the callback -function returns non-zero, the query is immediately aborted and the -return value of the callback is returned from sqlite_exec(). +function returns non-zero, the query is immediately aborted and +sqlite_exec() will return SQLITE_ABORT.
The last interface routine to SQLite is a convenience function used to test whether or not a string forms a complete SQL statement. -If the sqlite_complete function returns true when its input +If the sqlite_complete() function returns true when its input is a string, then the argument forms a complete SQL statement. There are no guarantees that the syntax of that statement is correct, -but we at least know the statement is complete. If sqlite_complete +but we at least know the statement is complete. If sqlite_complete() returns false, then more text is required to complete the SQL statement.
For the purpose of the sqlite_complete() function, an SQL statement is complete if it ends in a semicolon.
+The sqlite command-line utility uses the sqlite_complete() +function to know when it needs to call sqlite_exec(). After each +line of input is received, sqlite calls sqlite_complete() +on all input in its buffer. If sqlite_complete() returns true, +then sqlite_exec() is called and the input buffer is reset. If +sqlite_complete() returns false, then the prompt is changed to +the continuation prompt and another line of text is read and added to +the input buffer.
+For examples of how the SQLite C/C++ interface can be used, -refer to the source code for the "sqlite" program in the +refer to the source code for the sqlite program in the file src/shell.c of the source tree. -(Additional information about sqlite is available at -sqlite.html.) +Additional information about sqlite is available at +sqlite.html. See also the sources to the Tcl interface for SQLite in the source file src/tclsqlite.c.
} diff --git a/www/changes.tcl b/www/changes.tcl index 5c0ab2ed89..4d48e4f230 100644 --- a/www/changes.tcl +++ b/www/changes.tcl @@ -17,6 +17,21 @@ proc chng {date desc} { puts "}
-puts "Last modified [lrange $rcsid 3 4] GMT"
+puts "This page was last modified on [lrange $rcsid 3 4] GMT
"
+puts "The SQLite source code was last modifed on [exec cat last_change] GMT"
puts {
+mailing list to offer feedback. } puts {-The SQLite code base is rapidly becoming usable. Most of the commonly -used features of SQL (at least the features of SQL that this author -commonly uses) are now supported. There are currently no known -errors in the code. (There are known omissions but that is another -matter.) +
News
++Though still relatively new, +the SQLite code base appears to be working well and has therefore +been upgraded to "beta" status. +There are currently no known errors in the code. One very large database (1M+ records in 50+ separate tables) has been converted from PostgreSQL and gives every appearance of working -correctly. We are rapidly approaching a "beta" release, I think...
+correctly.Your constructive comments are still very important to us. Please visit the -mailing list to offer your feedback.
-
SQLite is a C library that implements an SQL frontend to GDBM. -SQLite is intended for use in standalone programs that need -to use an SQL database but which do not have access to a full-blown -SQL RDBMS.
+SQLite is an SQL database built atop the +GDBM library. +The SQLite distribution includes both a interactive command-line +access program (sqlite) and a C library (libsqlite.a) +that can be linked +with a C/C++ program to provide SQL database access without having +to rely on an external RDBMS.
The C interface to SQLite is very simple, consisting of only -four functions and a single opaque data structure. +four functions, a single opaque data structure, and a handful of +constants that define error return codes. See c_interface.html for details. A Tcl interface to SQLite is also available and is included in the source tree. Documentation on the Tcl interface is pending. Interfaces for perl and python may be supplied in future releases.
-There is a standalone C program named "sqlite" that can be used +
The standalone program sqlite can be used to interactively create, update and/or query an SQLite database. The sources to the sqlite program are part of the source tree and can be used as an example of how to interact with the SQLite C @@ -53,7 +58,8 @@ see sqlite.html.
A history of changes to SQLite is found here.
-SQLite does not try to implement every feature of SQL. +
SQLite is intended to be small and light-weight. +It does not try to implement every feature of SQL. A few of the many SQL features that SQLite does not (currently) implement are as follows:
@@ -97,6 +103,19 @@ puts "This is a [file size sqlite.tar.gz] byte download. The tarball was last modified at [clock format [file mtime sqlite.tar.gz]]" puts { +To build sqlite, just unwrap the tarball, create a separate +build directory, run configure from the build directory and then +type "make". For example:
+ +++$ tar xzf sqlite.tar.gz ;# Unpacks into directory named "sqlite" +$ mkdir bld ;# Create a separate build directory +$ cd bld +$ ../sqlite/configure +$ make ;# Builds "sqlite" and "libsqlite.a" +$ make test ;# Optional: run regression tests +
You can also download a larger tarball that contains everything in the source tarball plus all of the sources for the text that appears on this website, and other miscellaneous files. The @@ -117,8 +136,11 @@ puts {
Here is a
+ Here is a good
tutorial on SQL. PostgreSQL is a
+ full-blown SQL RDBMS that is also open source.
For example, to create a new SQLite database named "ex1" @@ -56,11 +56,8 @@ sql> (((create table tbl1(one varchar(10), two smallint);))) sql> (((insert into tbl1 values('hello!',10);))) sql> (((insert into tbl1 values('goodbye', 20);))) sql> (((select * from tbl1;))) -one = hello! -two = 10 - -one = goodbye -two = 20 +hello!|10 +goodbye|20 sql> } @@ -73,7 +70,7 @@ from the computer are shown in black with a constant-width font.)
End-Of-File character (usually a Control-D) or the interrupt character (usually a Control-C). -Make sure you type a semicolon at the end of each SQL command. +
Make sure you type a semicolon at the end of each SQL command! The sqlite looks for a semicolon to know when your SQL command is complete. If you omit the semicolon, sqlite will give you a continuation prompt and wait for you to enter more text to be @@ -122,10 +119,10 @@ sql> puts {
But you cannot execute DROP TABLE, UPDATE, INSERT or DELETE against -the sqlite_master table. At least not directly. The sqlite_master +the sqlite_master table. The sqlite_master table is updated automatically as you create or drop tables and -indices from the database, but you can not modify sqlite_master -directly. +indices from the database. You can not make manual changes +to the sqlite_master table.
@@ -187,8 +184,9 @@ sql> } puts { -
Line mode used to be the default mode setting. But recently the -default mode was changed to "list".
+Line mode used to be the default mode setting. But after some +experience using the utility, it was decided that "list" mode made +a better default and so now the default mode is "list".
} puts { @@ -221,7 +219,7 @@ sql> } puts { -The ".width" command in the example above set the width of the first +
The ".width" command in the example above sets the width of the first column to 12 and the width of the second column to 6. All other column widths were unaltered. You can gives as many arguments to ".width" as necessary to specify the widths of as many columns as are in your @@ -246,7 +244,7 @@ list mode, each record of a query result is written on one line of output and each field within that record is separated by a specific separator string. The default separator is a pipe symbol ("|"). List mode is especially useful when you are going to send the output -of a query to another program (such as AWK) for additional process.
} +of a query to another program (such as AWK) for additional processing.} Code { sql> (((.mode list))) @@ -368,8 +366,8 @@ SELECT sql FROM sqlite_master ORDER BY tbl_name, type DESC, name -Of, if you give an argument to ".schema" because you only -one the schema for a single table, the query looks like this:
+Or, if you give an argument to ".schema" because you only +want the schema for a single table, the query looks like this:
SELECT sql FROM sqlite_master @@ -385,7 +383,7 @@ to ".schema", of course.The ".explain" dot command can be used to set the output mode to "column" and to set the column widths to values that are reasonable for looking at the output of an EXPLAIN command. The EXPLAIN command -is an SQLite-specific command that is useful for debugging. If any +is an SQLite-specific SQL extension that is useful for debugging. If any regular SQL is prefaced by EXPLAIN, then the SQL command is parsed and analyzed but is not executed. Instead, the sequence of virtual machine instructions that would have been used to execute the SQL command are @@ -397,7 +395,7 @@ sql> (((explain delete from tbl1 where two<20;))) addr opcode p1 p2 p3 ---- ------------ ----- ----- ------------------------------------- 0 ListOpen 0 0 -1 Open 0 0 tbl1 +1 Open 0 1 tbl1 2 Next 0 9 3 Field 0 1 4 Integer 20 0