diff --git a/manifest b/manifest index 612313c31f..82010ff992 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C RowIDs\sare\snow\salways\sexpressed\sin\snative\sbyte\sorder.\s(CVS\s263) -D 2001-09-23T20:17:55 +C Tests\sfor\sinserting\slots\sof\sdata\s(~64K)\sinto\sa\ssingle\srow\sof\sa\stable.\s(CVS\s264) +D 2001-09-24T03:12:40 F Makefile.in 18eea9a3486939fced70aa95b691be766c2c995d F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958 F VERSION 6942aa44940d2972bd72f671a631060106e77f7e @@ -10,7 +10,7 @@ F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6 F src/btree.c da9b60a0b94daac0b7a231f42cb79961bf06531d F src/btree.h 5e5531869e53623aad5b32c22249c5743039251e -F src/build.c 17ba9b8594c0d491c0c4b105f63da5764620a8ce +F src/build.c 6a27cbfabc956e89cf62358d368524429c1aec9c F src/delete.c 81002d889aae874decf507627207c5d1b3599dc2 F src/expr.c 343a515a4abaf60e9e26c7412aa8c43fd3eae97d F src/hash.c bf36fb4cba114015123b0050f137d2c4553778a1 @@ -32,16 +32,17 @@ F src/sqlite.h.in dbe7a1b1e1ab9bfce1a6983cfa6f53c5c2499305 F src/sqliteInt.h 6bcdcfbc2b2ec7bb6ec96b3a31f4a0c74ee14c4f F src/table.c abd0adbe0fee39d995287b3bcccd908d174dfcac F src/tclsqlite.c 04a35d04f06046acc3944121dc6c36717f7f36d5 -F src/test1.c 3892caa5372789a6d17329dd595724e1f06cb6de +F src/test1.c e4b31f62ea71963cbae44338acf477a04fc8fc49 F src/test2.c 0168b39225b768cfdadd534406f9dec58c27879e F src/test3.c 4a0d7b882fdae731dbb759f512ad867122452f96 F src/tokenize.c 2ab07b85fde38d8fa2b4e73417b93e94f9cf8f5f F src/update.c 8de22957017e17c5e751ba71c4ea76c60f93aa2f F src/util.c 9c888445c1fd7896dab38fa62efc532f2364010a -F src/vdbe.c c5cd3a5340871a44236aba41d4265a23b5353859 +F src/vdbe.c 13907958b90401d495132a17840979d58be45554 F src/vdbe.h dc1d441494ba560a1ff464e1c56beb8ca03844fc F src/where.c cce952b6a2459ac2296e3432876a4252d2fe3b87 F test/all.test a2320eb40b462f25bd3e33115b1cabf3791450dd +F test/bigrow.test a35f2de9948b24e427fb292c35947795efe182d0 F test/btree.test 47952c7a0c22660566264c68c0664592b7da85ce F test/btree2.test 20ce47ab804f15b6563736528bdd38aabe5193dc F test/copy.test 768e6f1701a07d08090e1ca7f7dcce0a7a72b43e @@ -72,7 +73,7 @@ F test/table.test 52fdca1632580fb638c7b7dd14f4d37ecc09f994 F test/tableapi.test 162840153191a91a7dce6395f2334f9aef713b37 F test/tclsqlite.test a57bb478d7e9f0b2c927f92e161f391e2896631a F test/tester.tcl 957cd92fe8645b829da175d94b7ddb7ea68dac39 -F test/trans.test 010dfe3cc7dea8bfd3b389dcadc6789f35d6df36 +F test/trans.test 855337b8a178c73c433fcf8ee88e4b2f5efff0d9 F test/update.test b320ea22899e80b32b4d21c54591eb7a6ba4d6bd F test/vacuum.test 8acf8669f3b627e54149b25165b034aa06c2432e F test/where.test 43d5ac94da3f3722375307f948884dc79b326a91 @@ -97,7 +98,7 @@ F www/opcode.tcl 60222aeb57a7855b2582c374b8753cb5bb53c4ab F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f F www/tclsqlite.tcl 13d50723f583888fc80ae1a38247c0ab415066fa F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad -P bd7d6a64afa03cc64f6537f828d6c94975bf5f02 -R b2b493528f723aceed9a16e2be55169a +P bb4313a94bc079d072078f353e54f3804971060d +R 69829e6305936fff1b9496182feb41ef U drh -Z 2820f142fe995c5556d69539be23c55f +Z 400cf1b054cf4870465ea4bfa97da0d6 diff --git a/manifest.uuid b/manifest.uuid index 82b4fea2fd..32e04ac7b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bb4313a94bc079d072078f353e54f3804971060d \ No newline at end of file +a462c85083d23aa34bd3d0c61d01062fc5ae8230 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 2a7ee3168d..6cd307228a 100644 --- a/src/build.c +++ b/src/build.c @@ -25,7 +25,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.40 2001/09/23 19:46:52 drh Exp $ +** $Id: build.c,v 1.41 2001/09/24 03:12:40 drh Exp $ */ #include "sqliteInt.h" #include @@ -136,7 +136,8 @@ void sqliteExprDelete(Expr *p){ ** of that table. Return NULL if not found. */ Table *sqliteFindTable(sqlite *db, char *zName){ - return sqliteHashFind(&db->tblHash, zName, strlen(zName)+1); + Table *p = sqliteHashFind(&db->tblHash, zName, strlen(zName)+1); + return (p==0 || p->isDelete) ? 0 : p; } /* @@ -145,7 +146,8 @@ Table *sqliteFindTable(sqlite *db, char *zName){ ** of that index. Return NULL if not found. */ Index *sqliteFindIndex(sqlite *db, char *zName){ - return sqliteHashFind(&db->idxHash, zName, strlen(zName)+1); + Index *p = sqliteHashFind(&db->idxHash, zName, strlen(zName)+1); + return (p==0 || p->isDelete) ? 0 : p; } /* diff --git a/src/test1.c b/src/test1.c index 09f1b8a791..3a5bf772fb 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.3 2001/09/16 00:13:27 drh Exp $ +** $Id: test1.c,v 1.4 2001/09/24 03:12:40 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -258,7 +258,7 @@ static int sqlite_mprintf_double( /* ** Usage: sqlite_malloc_fail N ** -** Rig sqliteMalloc() to fail on the N-th call. Turn of this mechanism +** Rig sqliteMalloc() to fail on the N-th call. Turn off this mechanism ** and reset the sqlite_malloc_failed variable is N==0. */ #ifdef MEMORY_DEBUG diff --git a/src/vdbe.c b/src/vdbe.c index e0312e7815..6c9d6a0338 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -30,7 +30,7 @@ ** But other routines are also provided to help in building up ** a program instruction by instruction. ** -** $Id: vdbe.c,v 1.76 2001/09/23 20:17:55 drh Exp $ +** $Id: vdbe.c,v 1.77 2001/09/24 03:12:40 drh Exp $ */ #include "sqliteInt.h" #include @@ -2301,10 +2301,6 @@ case OP_NewRecno: { ** to double the speed of the COPY operation. */ int res, rx, cnt, x; - union { - char zBuf[sizeof(int)]; - int i; - } ux; cnt = 0; v = db->nextRowid; do{ diff --git a/test/bigrow.test b/test/bigrow.test new file mode 100644 index 0000000000..b4c61f8ae3 --- /dev/null +++ b/test/bigrow.test @@ -0,0 +1,105 @@ +# 2001 September 23 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this file is stressing the library by putting large amounts +# of data in a single row of a table. +# +# $Id: bigrow.test,v 1.1 2001/09/24 03:12:40 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Make a big string that we can use for test data +# +do_test bigrow-1.0 { + set ::bigstr {} + for {set i 1} {$i<=9999} {incr i} { + set sep [string index "abcdefghijklmnopqrstuvwxyz" [expr {$i%26}]] + append ::bigstr "$sep [format %04d $i] " + } + string length $::bigstr +} {69993} + +# Make a table into which we can insert some but records. +# +do_test bigrow-1.1 { + execsql { + CREATE TABLE t1(a text, b text, c text); + SELECT name FROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name + } +} {t1} + +do_test bigrow-1.2 { + set ::big1 [string range $::bigstr 0 65519] + set sql "INSERT INTO t1 VALUES('abc'," + append sql "'$::big1', 'xyz');" + execsql $sql + execsql {SELECT a, c FROM t1} +} {abc xyz} +do_test bigrow-1.3 { + execsql {SELECT b FROM t1} +} [list $::big1] +do_test bigrow-1.4 { + set sql "INSERT INTO t1 VALUES('abc'," + append sql "'[string range $::bigstr 0 65520]', 'xyz');" + set r [catch {execsql $sql} msg] + lappend r $msg +} {1 {too much data for one table row}} + +do_test bigrow-1.5 { + execsql { + UPDATE t1 SET a=b, b=a; + SELECT b,c FROM t1 + } +} {abc xyz} +do_test bigrow-1.6 { + execsql { + SELECT * FROM t1 + } +} [list $::big1 abc xyz] +do_test bigrow-1.7 { + execsql { + INSERT INTO t1 VALUES('1','2','3'); + INSERT INTO t1 VALUES('A','B','C'); + SELECT b FROM t1 WHERE a=='1'; + } +} {2} +do_test bigrow-1.8 { + execsql "SELECT b FROM t1 WHERE a=='$::big1'" +} {abc} +do_test bigrow-1.9 { + execsql "SELECT b FROM t1 WHERE a!='$::big1' ORDER BY a" +} {B 2} + +# Try doing some indexing on big columns +# +do_test bigrow-2.1 { + execsql { + CREATE INDEX i1 ON t1(a) + } + execsql "SELECT b FROM t1 WHERE a=='$::big1'" +} {abc} +do_test bigrow-2.2 { + execsql { + UPDATE t1 SET a=b, b=a + } + execsql "SELECT b FROM t1 WHERE a=='abc'" +} [list $::big1] +do_test bigrow-2.3 { + execsql { + UPDATE t1 SET a=b, b=a + } + execsql "SELECT b FROM t1 WHERE a=='$::big1'" +} {abc} + +finish_test diff --git a/test/trans.test b/test/trans.test index 8c2c6f81e2..1c33e6dcd0 100644 --- a/test/trans.test +++ b/test/trans.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is database locks. # -# $Id: trans.test,v 1.6 2001/09/23 02:35:53 drh Exp $ +# $Id: trans.test,v 1.7 2001/09/24 03:12:41 drh Exp $ set testdir [file dirname $argv0] @@ -273,4 +273,137 @@ do_test trans-5.7 { lappend v $msg } {1 {no such table: one}} +# Test commits and rollbacks of table CREATE TABLEs, CREATE INDEXs +# DROP TABLEs and DROP INDEXs +# +do_test trans-5.8 { + execsql { + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name + } +} {} +do_test trans-5.9 { + execsql { + BEGIN TRANSACTION; + CREATE TABLE t1(a int, b int, c int); + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {t1} +do_test trans-5.10 { + execsql { + CREATE INDEX i1 ON t1(a); + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i1 t1} +do_test trans-5.11 { + execsql { + COMMIT; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i1 t1} +do_test trans-5.12 { + execsql { + BEGIN TRANSACTION; + CREATE TABLE t2(a int, b int, c int); + CREATE INDEX i2a ON t2(a); + CREATE INDEX i2b ON t2(b); + DROP TABLE t1; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i2a i2b t2} +do_test trans-5.13 { + execsql { + ROLLBACK; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i1 t1} +do_test trans-5.14 { + execsql { + BEGIN TRANSACTION; + DROP INDEX i1; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {t1} +do_test trans-5.15 { + execsql { + ROLLBACK; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i1 t1} +do_test trans-5.16 { + execsql { + BEGIN TRANSACTION; + DROP INDEX i1; + CREATE TABLE t2(x int, y int, z int); + CREATE INDEX i2x ON t2(x); + CREATE INDEX i2y ON t2(y); + INSERT INTO t2 VALUES(1,2,3); + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i2x i2y t1 t2} +do_test trans-5.17 { + execsql { + COMMIT; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i2x i2y t1 t2} +do_test trans-5.18 { + execsql { + SELECT * FROM t2; + } +} {1 2 3} +do_test trans-5.19 { + execsql { + SELECT x FROM t2 WHERE y=2; + } +} {1} +do_test trans-5.20 { + execsql { + BEGIN TRANSACTION; + DROP TABLE t1; + DROP TABLE t2; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {} +do_test trans-5.21 { + set r [catch {execsql { + SELECT * FROM t2 + }} msg] + lappend r $msg +} {1 {no such table: t2}} +do_test trans-5.22 { + execsql { + ROLLBACK; + SELECT name fROM sqlite_master + WHERE type='table' OR type='index' + ORDER BY name; + } +} {i2x i2y t1 t2} +do_test trans-5.23 { + execsql { + SELECT * FROM t2; + } +} {1 2 3} + finish_test