]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The new Btree code runs, but it does not yet work. (CVS 240)
authordrh <drh@noemail.net>
Thu, 13 Sep 2001 15:21:31 +0000 (15:21 +0000)
committerdrh <drh@noemail.net>
Thu, 13 Sep 2001 15:21:31 +0000 (15:21 +0000)
FossilOrigin-Name: 991ce8115052da9395d4bf8ff29f417e3c36dc7f

VERSION
manifest
manifest.uuid
src/TODO
src/main.c
src/vdbe.c

diff --git a/VERSION b/VERSION
index 15245f3a2ae37d72e885531cd9d56afd7013fa20..9084fa2f716a7117829f3f32a5f4cef400e02903 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.32
+1.1.0
index 986a8fb9b6f555ccb55d4103ce4a28c7e4ee6e8f..adacd193bf0e277a0b861906df9d030e49a77215 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,9 +1,9 @@
-C The\sBTree\schanges\sare\snow\sintegrated\sand\sthe\swhole\sthing\scompiles\sand\nlinks.\sI\shave\snot\syet\stried\sto\srun\sit,\sthough.\s(CVS\s239)
-D 2001-09-13T14:46:10
+C The\snew\sBtree\scode\sruns,\sbut\sit\sdoes\snot\syet\swork.\s(CVS\s240)
+D 2001-09-13T15:21:32
 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
 F Makefile.in 7ecb2370b5cb34d390af1fcb3118ea6d84a253ca
 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
-F VERSION 00453ed53ff28fe8e701e1609e81f1b9df12adab
+F VERSION 05e17b646a817240c206186f94f8f4c70974d5dc
 F configure d2051345f49f7e48604423da26e086a745c86a47 x
 F configure.in e7465c88bbfb76882f97769c2dd90dbba8eca5db
 F doc/lemon.html 3ddeef6e5dee69a2bb6f5d8e4975b58f2fd8e11c
@@ -12,7 +12,7 @@ F notes/notes1.txt b7c0812b704a022e88c621146ae50955c923d464
 F notes/notes2.txt 7e3fafd5e25906c1fe1e95f13b089aa398ca403e
 F notes/notes2b.txt 1c17a5b7f6b44a75cd3eb98ed2c24db1eefb06c3
 F notes/notes3.txt 71e47be517e3d2578b3b9343a45b772d43b7ba16
-F src/TODO 38a68a489e56e9fd4a96263e0ff9404a47368ad4
+F src/TODO f0ea267ab55c4d15127c1ac1667edbf781147438
 F src/btree.c 9f22b51681bcc0026ea300134e4e2f1f40fc0800
 F src/btree.h 2427961c702dd0755ec70f529cf3db32707d689b
 F src/build.c 58020177a1b96455284899774442833a81c5ae9c
@@ -27,7 +27,7 @@ F src/ex/pg.h 23a4ac807b0546ec2bb6239ec8bd3e06926572cd
 F src/ex/sizes.tcl f54bad4a2ac567624be59131a6ee42d71b41a3d7
 F src/expr.c 83b6a7ed4cf502249f192b698517e9a9b8f05303
 F src/insert.c 1072c0dd7782c17af735df37f447630d4d577ba1
-F src/main.c b7a2da8375ca61d4464610368608e7fd0566b950
+F src/main.c c5f8931674ac1fa8e8c6e0062d3c5700e204f3b7
 F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c
 F src/pager.c 05a2177c99a835c3efec1e4187556e2e29311d4a
 F src/pager.h 238aa88bafe33911bf9b0b365f35afd0a261cd46
@@ -47,7 +47,7 @@ F src/test3.c 147b42ec368a10e9f267e7466d30c46e76d7f278
 F src/tokenize.c 0118b57702cb6550769316e8443b06760b067acf
 F src/update.c ea8f2c0712cd4cd19314a26ef4766866013facda
 F src/util.c c77668fef860cfd2e4e682ef4f3ed8f9e68c551b
-F src/vdbe.c f502b592d1cc94f68e9e4b3fa130361cb3038b0c
+F src/vdbe.c d5f0a2de6427cd4843c13e093b0039e5fac05e0f
 F src/vdbe.h 6ee941ecd78b7b224607517fd060d6547910dc10
 F src/where.c b9f6d2c029983e9db9521474c876f9a039e7fb6c
 F test/all.test 21d55a97e39e7ec5776751dc9dd8b1b51ef4a048
@@ -108,7 +108,7 @@ F www/opcode.tcl cb3a1abf8b7b9be9f3a228d097d6bf8b742c2b6f
 F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f
 F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2
 F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad
-P 6ecc8b20d4f402f45f03d46d8d4fa40dea666e97
-R 9f3dc1f51d7a55174d7eb7f5f17c9756
+P a0a1e701abc52a164d9b09a5426eb12af1fe6a4c
+R 472be17e965b4d5d7fba15c027cd1366
 U drh
-Z 89f03479b34b99fd737e2528660926bd
+Z d550eba50f66b2bb3dd421288cbb8ffd
index dce16238365df1f4673be7638961bafbf5c0a9ca..2fdf8e47341028fbd939c08565e9f775a6713dd5 100644 (file)
@@ -1 +1 @@
-a0a1e701abc52a164d9b09a5426eb12af1fe6a4c
\ No newline at end of file
+991ce8115052da9395d4bf8ff29f417e3c36dc7f
\ No newline at end of file
index 31610a26780216bc035a48d835ec84387f1c8f70..fcfd5921800673780910d0e47934fdc3da4201c2 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -1,35 +1,7 @@
-  *  Finish fleshing out the db.c file.
-      - sqliteDbReadOvfl
-      - sqliteDbSpreadLoad
-      - sqliteDbSplit
-      - sqliteDbNextIndexLevel
-      - fix sqliteDbCursorNext to work right after sqliteDbCursorDelete
-  *  Compile db.c with -Wall and get no errors.
-  *  Make a pass over pg.c and db.c looking for errors.
-      - correct handling of I/O errors, malloc failures, etc.
-      - page leaks  (not calling sqlitePgUnref)
-  *  Write a test interface for db.c.
-  *  Compile and link against the db test interface.
-  *  Generate tests for the db interface.
-  *  Add read/write locks to pg.c
-  *  Add an sqliteDbReorganize() function.
-  *  Integrate db into vdbe.
-  *  Modify code generation to take advantage of the new db interface.
-      - Able to delete without disturbing scan order
-      - Now keeps a count of number of table entries
-         + Special processing for count(*)
-         + Better selection of indices on a select
-      - Transactions
-  *  Modify sqlite_master to store the table number.
-  *  Add a cache in DbCursor to speed up the sqliteDbReadOvfl() routine.
-  *  Add cache information to speed up sqliteDbCursorMoveTo().
-
-Longer term:
   *  Document all the changes and release Sqlite 2.0.
-  *  Techniques for optimizing querys by grouping data with similar
-     indices.
-  *  "OPTIMIZE select" statement to automatically create and/or tune
-     indices.
+  *  Implement CLUSTER command like in PostgreSQL.
+  *  "OPTIMIZE select" statement to automatically create indices and/or
+     invoke a CLUSTER command.
   *  "CREATE INDEX FOR select" to automatically generate needed indices.
-  *  "VACUUM table USING index".
+  *  Implement a PRAGMA command
   *  Parse and use constraints.
index 8345b2a399776ef8c8a3b05cfaf9846686a05348..2301915f4356e4c19258bcd024388e481802faa9 100644 (file)
@@ -26,7 +26,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.31 2001/09/13 14:46:10 drh Exp $
+** $Id: main.c,v 1.32 2001/09/13 15:21:32 drh Exp $
 */
 #include "sqliteInt.h"
 #if defined(HAVE_USLEEP) && HAVE_USLEEP
@@ -182,6 +182,7 @@ static int sqliteInit(sqlite *db, char **pzErrMsg){
     pTab = sqliteFindTable(db, MASTER_NAME);
     if( pTab ){
       pTab->readOnly = 1;
+      pTab->tnum = 2;
     }
     db->flags |= SQLITE_Initialized;
     sqliteCommitInternalChanges(db);
index 01b5e06f36776d3470c5a6e846a31b8baab4bb2a..ba47f1b36f3f38455287091f23070ba7cd169aff 100644 (file)
@@ -41,7 +41,7 @@
 ** But other routines are also provided to help in building up
 ** a program instruction by instruction.
 **
-** $Id: vdbe.c,v 1.61 2001/09/13 14:46:11 drh Exp $
+** $Id: vdbe.c,v 1.62 2001/09/13 15:21:32 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -2598,6 +2598,66 @@ case OP_Destroy: {
   break;
 }
 
+/* Opcode: CreateTable * * *
+**
+** Allocate a new table in the main database file.  Push the page number
+** for the root page of the new table onto the stack.
+**
+** The root page number is also written to a memory location which has
+** be set up by the parser.  The difference between CreateTable and
+** CreateIndex is that each writes its root page number into a different
+** memory location.  This writing of the page number into a memory location
+** is used by the SQL parser to record the page number in its internal
+** data structures.
+*/
+case OP_CreateTable: {
+  int i = ++p->tos;
+  int pgno;
+  VERIFY( if( NeedStack(p, p->tos) ) goto no_mem; )
+  if( p->pTableRoot==0 ){
+    rc = SQLITE_INTERNAL;
+    goto abort_due_to_error;
+  }
+  rc = sqliteBtreeCreateTable(pBt, &pgno);
+  if( rc==SQLITE_OK ){
+    aStack[i].i = pgno;
+    aStack[i].flags = STK_Int;
+    *p->pTableRoot = pgno;
+    p->pTableRoot = 0;
+  }
+  break;
+}
+
+/* Opcode: CreateIndex * * *
+**
+** Allocate a new Index in the main database file.  Push the page number
+** for the root page of the new table onto the stack.
+**
+** The root page number is also written to a memory location which has
+** be set up by the parser.  The difference between CreateTable and
+** CreateIndex is that each writes its root page number into a different
+** memory location.  This writing of the page number into a memory location
+** is used by the SQL parser to record the page number in its internal
+** data structures.
+*/
+case OP_CreateIndex: {
+  int i = ++p->tos;
+  int pgno;
+  VERIFY( if( NeedStack(p, p->tos) ) goto no_mem; )
+  if( p->pIndexRoot==0 ){
+    rc = SQLITE_INTERNAL;
+    goto abort_due_to_error;
+  }
+  rc = sqliteBtreeCreateTable(pBt, &pgno);
+  if( rc==SQLITE_OK ){
+    aStack[i].i = pgno;
+    aStack[i].flags = STK_Int;
+    *p->pIndexRoot = pgno;
+    p->pIndexRoot = 0;
+  }
+  break;
+}
+
 /* Opcode: Reorganize P1 * *
 **
 ** Compress, optimize, and tidy up table or index whose root page in the
@@ -3623,6 +3683,10 @@ default: {
 
 cleanup:
   Cleanup(p);
+  if( p->pTableRoot || p->pIndexRoot ){
+    rc = SQLITE_INTERNAL;
+    sqliteSetString(pzErrMsg, "table or index root page not set", 0);
+  }
   if( rc!=SQLITE_OK && (db->flags & SQLITE_InTrans)!=0 ){
     sqliteBtreeRollback(pBt);
     sqliteRollbackInternalChanges(db);