-C Begin\sadding\sBTree\scode\s(CVS\s213)
-D 2001-04-17T20:09:11
+C :-)\s(CVS\s1719)
+D 2001-04-17T20:09:44
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in ac01d6145714b0d1c9e99382caf03cf30d6f4c8d
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
F configure.in 6940e3f88bf3d28a10c73b06ab99fd3a7e039a61
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
F doc/report1.txt 734cbae63b1310cc643fe5e9e3da1ab55a79b99e
+F notes/notes1.txt b7c0812b704a022e88c621146ae50955c923d464
+F notes/notes2.txt 30b1d05005731ff8b49e430921daf40e5d8c764c
+F notes/notes3.txt cd5e7bd2167d7ef89b1077abdfa68f0af6337744
F src/TODO 38a68a489e56e9fd4a96263e0ff9404a47368ad4
F src/btree.c 670b20349bd1d1448cc90f7b9487c2bf7a5c039c
F src/btree.h f21c240d0c95f93e2a128106d04a6c448ed0eb94
F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f
F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2
F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad
-P a7bfcbb4131ab17a58d5e843c418b2e1a3ab2abc
-R a9d053b754fd8fb60eea783a8c6d6da7
+P bdb1c425f577d455155982ee2cd8cb686bcaf0da
+R 71de057d1d30d3f00126006f203367a6
U drh
-Z b0f122553586c19814acf39c12755271
+Z ab8bc94b1c7db1acb4a5bcaf00ffbb81
--- /dev/null
+unlocked -> read
+
+ 1. If the journal file exists
+ A. Open the journal file for exclusive access
+ i) return SQLITE_BUSY
+ B. Get a write lock on the database
+ i) close the journal file
+ ii) return SQLITE_PROTOCOL_ERROR
+ C. playback the journal
+ D. close and delete the journal file
+ E. drop the write lock on the database
+ 2. Get a read lock on the database file.
+ A. return SQLITE_BUSY
+ 3. return SQLITE_OK
+
+read -> unlocked
+
+ 1. Drop the read lock on the database file
+ 2. Invalidate all pages in the cache
+ 3. return SQLITE_OK
+
+read -> write
+
+ 1. Create the journal file and open for exclusive access
+ A. return SQLITE_BUSY
+ 2. Drop the read lock on the database
+ 3. Get a write lock on the database
+ A. Get a read lock on the database
+ i) return SQLITE_PROTOCOL_ERROR
+ B. Delete the journal
+ C. return SQLITE_BUSY
+ 4. return SQLITE_OK
+
+write -> read (commit)
+
+ 1. Sync the journal
+ 2. Write all dirty pages
+ A. playback journal
+ B. Reload or invalidate all pages in cache
+ 3. Sync the database
+ 4. Drop the write lock on the database
+ 5. Get a read lock on the database
+ A. return SQLITE_PROTOCOL_ERROR
+ 6. Delete the journal
+ 7. return SQLITE_OK
+
+write -> read (rollback)
+
+ 1. Playback the journal
+ 2. Drop the write lock on the database
+ 3. Get a read lock on the database
+ A. return SQLITE_PROTOCOL_ERROR
+ 4. Delete the journal
+ 5. Reload or invalidate all pages in cache
+ 6. SQLITE_FULL
--- /dev/null
+The Proposed New SQLite 2.0 Interface design. (April 16, 2001)
+
+Primary access routines:
+
+ sqlite *sqlite_open(const char *zFilename, int mode);
+ int sqlite_compile(sqlite*, const char *zSql);
+ int sqlite_row(sqlite*, int *argc, const char ***argv);
+ int sqlite_finish(sqlite*);
+ int sqlite_close(sqlite*);
+
+Secondary access routines:
+
+ const char sqlite_version[];
+ const char sqlite_encoding[];
+ int sqlite_complete(const char *);
+ sqlite *sqlite_dup(sqlite*);
+ int sqlite_abort(sqlite*);
+ void sqlite_interrupt(sqlite*);
+ char *sqlite_errmsg(sqlite*);
+ const char **sqlite_columns(sqlite*);
+ int sqlite_argc(sqlite*);
+ const char **sqlite_argv(sqlite*);
+ char *sqlite_vmprintf(const char *zFormat, va_list);
+ int sqlite_table(sqlite*, int *nrow, int *ncolumn, const char ***argv);
+ void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
+
+Access routines that are implement derived from primary and sec
+
+ char *sqlite_mprintf(const char *zFormat, ...);
+ int sqlite_compile_vprintf(sqlite*, const char *zFormat, va_list);
+ int sqlite_compile_printf(sqlite*, const char *zFormat, ...);
+ int sqlite_busy_timeout(sqlite*, int ms);
+
+The C++ interface is obvious...
+
+Deprecated legacy interfaces:
+
+ int sqlite_exec(
+ sqlite*,
+ char *sql,
+ int (*)(void*,int,char**,char**),
+ void*,
+ char **errmsg
+ );
+ int sqlite_exec_printf(...);
+ int sqlite_exec_vprintf(...);
+ int sqlite_get_table(
+ sqlite*,
+ char *sql,
+ const char ***result,
+ int *nrow,
+ int *ncolumn,
+ char **errmsg
+ );
+ void sqlite_free_table(char**);
+ int sqlite_get_table_printf(...);
+ int sqlite_get_table_vprintf(...);
+
+TCL Interface
+
+ sqlite DB FILENAME ?MODE?
+ DB compile SQL
+ DB row VAR
+ DB argc
+ DB argv ?N?
+ DB table ?VAR?
+ DB columns ?N?
+ DB finish
+ DB abort
+ DB eval SQL ?VAR SCRIPT?
+ DB close
+ DB complete
+ DB timeout MS
+ DB busy SCRIPT
+ DB dup NEWDB
+
+Primary access pattern:
+
+ sqlite *db = sqlite_open("testdb", 0644);
+ sqlite_compile(db, "SELECT * FROM sqlite_master");
+ while( sqlite_row(db, &argc, &argv)==SQLITE_OK ){
+ /* Do something with the row data in argc, argv */
+ }
+ sqlite_finish(db);
+ sqlite_close(db);
+
+Alternative access pattern 1:
+
+ sqlite *db = sqlite_open("testdb", 0644);
+ sqlite_compile(db, "SELECT * FROM sqlite_master");
+ sqlite_table(db, &nrow, &ncolumn, &argv);
+ /* Do something with the matrix data in argv */
+ sqlite_finish(db);
+ sqlite_close(db);
+
+Issues:
+
+ * If one query is in progress and we do sqlite_compile(), does
+ that abort the current query or return an error code?
+
+ * What happens here:
+ sqlite_compile(db, "SELECT a FROM t1; SELECT b,c FROM t2;");
+ sqlite_table(db, &nrow, &ncolumn, &argv);
+ What value is returned for nrow and ncolumn? Or is this an error?
+ Or maybe only the first table is returned?