]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
:-) (CVS 9)
authordrh <drh@noemail.net>
Mon, 29 May 2000 23:58:11 +0000 (23:58 +0000)
committerdrh <drh@noemail.net>
Mon, 29 May 2000 23:58:11 +0000 (23:58 +0000)
FossilOrigin-Name: 84333008b70a11006053938f95bb048f7ee4f655

manifest
manifest.uuid
test/index.test [moved from test/crtidx.test with 86% similarity]
test/table.test [moved from test/crttbl.test with 80% similarity]

index 630014bf30107fd7a3f3b01db713fa9e5ae2e8ff..9634d6c1dbee8ca4896703668392c7f3d8b6dbe3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C :-)\s(CVS\s8)
-D 2000-05-29T23:48:23
+C :-)\s(CVS\s9)
+D 2000-05-29T23:58:12
 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
 F Makefile.in 89921c1ee4de75275bfadfbac198396da31704d1
 F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
@@ -21,8 +21,8 @@ F src/vdbe.c 80132b6bb9a744d1990a1c16666d54baaff2dbc3
 F src/vdbe.h e721ad308f2e6ca805cebc4dd0a196ce4419d030
 F src/where.c 67ffea57920e16b33c580e9a9b9855b3ec9dea7b
 F test/all.test 66a8a5b8291a472157944edcdce51a320ebd1f35
-F test/crtidx.test 56de1628220deafe33037c40369229eb02c1907d
-F test/crttbl.test 45889cb39e3c3de9e10d79057f424a38ecebe93f
+F test/index.test 37cd05c590469d72c5a9299b510eb6bea00ada28
+F test/table.test 7eea7cd2a055b694fb1ba6b5de83ed7d78870b61
 F test/tester.tcl 0c260d6e56ba5ba69fbddef130638562e79bb2a3
 F tool/gdbmdump.c 529e67c78d920606ba196326ea55b57b75fcc82b
 F tool/lemon.c cff35578b3c4d1491021b6418016639ebe21b1a5
@@ -33,7 +33,7 @@ F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
 F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5
 F www/index.tcl 67b2bee04077377eacede2b11e21fe37ef7e10c6
 F www/sqlite.tcl 947e067bcc347dc767af4c1a6e5a8d47d8404aa3
-P fdf4b31a18fcbbcd358bf92c91fccbf94a79bc26
-R 8e7ef511fbf73d9fc2da9869644b9298
+P e34143c24f1b3eff0c9f1e22702f099674e0ef4e
+R 54f9c4e3d938cf3051ef76323625c2ee
 U drh
-Z 333679d5ad9690cc5b3b61743c281f2f
+Z 09e5fac9544134338a0bd303b6437e57
index 80e10482e85f4f2564ea17418e75ac42543c3d34..35a2502e5c9661f44d87a0bb5743e95aa339c4ce 100644 (file)
@@ -1 +1 @@
-e34143c24f1b3eff0c9f1e22702f099674e0ef4e
\ No newline at end of file
+84333008b70a11006053938f95bb048f7ee4f655
\ No newline at end of file
similarity index 86%
rename from test/crtidx.test
rename to test/index.test
index 1da3cf1fd6d070bd0998783f780f72b8d36f05ac..f53cc9d3f207fce862400e011a910f6fd9792a09 100644 (file)
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the CREATE INDEX statement.
 #
-# $Id: crtidx.test,v 1.1 2000/05/29 23:30:51 drh Exp $
+# $Id: index.test,v 1.1 2000/05/29 23:58:12 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
 # Create a basic index and verify it is added to sqlite_master
 #
-do_test crtidx-1.1 {
+do_test index-1.1 {
   execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)}
   execsql {CREATE INDEX index1 ON test1(f1)}
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {index1 test1}
-do_test crtidx-1.1b {
+do_test index-1.1b {
   execsql {SELECT name, sql, tbl_name, type FROM sqlite_master 
            WHERE name='index1'}
 } {index1 {CREATE INDEX index1 ON test1(f1)} test1 index}
-do_test crtidx-1.1c {
+do_test index-1.1c {
   db close
   sqlite db testdb
   execsql {SELECT name, sql, tbl_name, type FROM sqlite_master 
            WHERE name='index1'}
 } {index1 {CREATE INDEX index1 ON test1(f1)} test1 index}
-do_test crtidx-1.1d {
+do_test index-1.1d {
   db close
   sqlite db testdb
   execsql {SELECT name FROM sqlite_master ORDER BY name}
@@ -53,14 +53,14 @@ do_test crtidx-1.1d {
 
 # Verify that the index dies with the table
 #
-do_test crtidx-1.2 {
+do_test index-1.2 {
   execsql {DROP TABLE test1}
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {}
 
 # Try adding an index to a table that does not exist
 #
-do_test crtidx-2.1 {
+do_test index-2.1 {
   set v [catch {execsql {CREATE INDEX index1 ON test1(f1)}} msg]
   lappend v $msg
 } {1 {no such table: test1}}
@@ -68,7 +68,7 @@ do_test crtidx-2.1 {
 # Try adding an index on a field of a table where the table
 # exists but the field does not.
 #
-do_test crtidx-2.1 {
+do_test index-2.1 {
   execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)}
   set v [catch {execsql {CREATE INDEX index1 ON test1(f4)}} msg]
   lappend v $msg
@@ -76,7 +76,7 @@ do_test crtidx-2.1 {
 
 # Try an index with some fields that match and others that do now.
 #
-do_test crtidx-2.2 {
+do_test index-2.2 {
   set v [catch {execsql {CREATE INDEX index1 ON test1(f1, f2, f4, f3)}} msg]
   execsql {DROP TABLE test1}
   lappend v $msg
@@ -88,7 +88,7 @@ set r {}
 for {set i 1} {$i<100} {incr i} {
   lappend r index$i
 }
-do_test crtidx-3.1 {
+do_test index-3.1 {
   execsql {CREATE TABLE test1(f1 int, f2 int, f3 int, f4 int, f5 int)}
   for {set i 1} {$i<100} {incr i} {
     set sql "CREATE INDEX index$i ON test1(f[expr {($i%5)+1}])"
@@ -106,20 +106,20 @@ set r {}
 for {set i 1} {$i<100} {incr i} {
   lappend r testdb/index$i.tbl
 }
-do_test crtidx-3.2 {
+do_test index-3.2 {
   execsql {INSERT INTO test1 VALUES(1,2,3,4,5)}
   lsort -dictionary [glob testdb/index*.tbl]
 } $r
 
 # Verify that all the indices go away when we drop the table.
 #
-do_test crtidx-3.3 {
+do_test index-3.3 {
   execsql {DROP TABLE test1}
   execsql {SELECT name FROM sqlite_master 
            WHERE type='index' AND tbl_name='test1'
            ORDER BY name}
 } {}
-do_test crtidx-3.4 {
+do_test index-3.4 {
   lsort -dictionary [glob -nocomplain testdb/index*.tbl]
 } {}
 
@@ -127,7 +127,7 @@ do_test crtidx-3.4 {
 # an index on that table.  Verify that we can select values
 # from the table correctly using the index.
 #
-do_test crtidx-4.1 {
+do_test index-4.1 {
   execsql {CREATE TABLE test1(cnt int, power int)}
   for {set i 1} {$i<20} {incr i} {
     execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
@@ -136,49 +136,49 @@ do_test crtidx-4.1 {
   execsql {CREATE INDEX index2 ON test1(cnt)}
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {index1 index2 test1}
-do_test crtidx-4.2 {
+do_test index-4.2 {
   execsql {SELECT cnt FROM test1 WHERE power=4}
 } {2}
-do_test crtidx-4.3 {
+do_test index-4.3 {
   execsql {SELECT cnt FROM test1 WHERE power=1024}
 } {10}
-do_test crtidx-4.4 {
+do_test index-4.4 {
   execsql {SELECT power FROM test1 WHERE cnt=6}
 } {64}
-do_test crtidx-4.5 {
+do_test index-4.5 {
   execsql {DROP TABLE test1}
 } {}
 
 # Do not allow indices to be added to sqlite_master
 #
-do_test crtidx-5.1 {
+do_test index-5.1 {
   set v [catch {execsql {CREATE INDEX index1 ON sqlite_master(name)}} msg]
   lappend v $msg
 } {1 {table sqlite_master may not have new indices added}}
-do_test crtidx-5.2 {
+do_test index-5.2 {
   execsql {SELECT name FROM sqlite_master}
 } {}
 
 # Do not allow indices with duplicate names to be added
 #
-do_test crtidx-6.1 {
+do_test index-6.1 {
   execsql {CREATE TABLE test1(f1 int, f2 int)}
   execsql {CREATE TABLE test2(g1 real, g2 real)}
   execsql {CREATE INDEX index1 ON test1(f1)}
   set v [catch {execsql {CREATE INDEX index1 ON test2(g1)}} msg]
   lappend v $msg
 } {1 {index "index1" already exists}}
-do_test crtidx-6.1b {
+do_test index-6.1b {
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {index1 test1 test2}
-do_test crtidx-6.2 {
+do_test index-6.2 {
   set v [catch {execsql {CREATE INDEX test1 ON test2(g1)}} msg]
   lappend v $msg
 } {1 {there is already a table named "test1"}}
-do_test crtidx-6.2b {
+do_test index-6.2b {
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {index1 test1 test2}
-do_test crtidx-6.3 {
+do_test index-6.3 {
   execsql {DROP TABLE test1}
   execsql {DROP TABLE test2}
   execsql {SELECT name FROM sqlite_master ORDER BY name}
@@ -186,19 +186,32 @@ do_test crtidx-6.3 {
 
 # Create a primary key
 #
-do_test crtidx-7.1 {
+do_test index-7.1 {
   execsql {CREATE TABLE test1(f1 int, f2 int primary key)}
   for {set i 1} {$i<20} {incr i} {
     execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
   }
   lsort -dictionary [glob testdb/test1*.tbl]
 } {testdb/test1.tbl testdb/test1__primary_key.tbl}
-do_test crtidx-7.2 {
+do_test index-7.2 {
   execsql {SELECT f1 FROM test1 WHERE f2=65536}
 } {16}
-do_test crtidx-7.3 {
+do_test index-7.3 {
   set code [execsql {EXPLAIN SELECT f1 FROM test1 WHERE f2=65536}]
   expr {[lsearch $code test1__primary_key]>0}
 } {1}
+do_test index-7.4 {
+  execsql {DROP table test1}
+  execsql {SELECT name FROM sqlite_master}
+} {}
+
+# Make sure we cannot drop a non-existant table.
+#
+do_test index-8.1 {
+  set v [catch {execsql {DROP INDEX index1}} msg]
+  lappend v $msg
+} {1 {no such index: "index1"}}
+
+
 
 finish_test
similarity index 80%
rename from test/crttbl.test
rename to test/table.test
index 7c70056185efaed897243aa299eacd6821883f8f..24c6bb45af0d8aac7c0817be4ce65346599eeaa7 100644 (file)
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the CREATE TABLE statement.
 #
-# $Id: crttbl.test,v 1.2 2000/05/29 23:30:51 drh Exp $
+# $Id: table.test,v 1.1 2000/05/29 23:58:12 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
 # Create a basic table and verify it is added to sqlite_master
 #
-do_test crttbl-1.1 {
+do_test table-1.1 {
   execsql {
     CREATE TABLE test1 (
       one varchar(10),
@@ -47,21 +47,21 @@ do_test crttbl-1.1 {
 
 # Verify that both table files exists in the database directory
 #
-do_test crttbl-1.2 {
+do_test table-1.2 {
   execsql {INSERT INTO test1 VALUES('hi', 'y''all')}
   lsort [glob -nocomplain testdb/*.tbl]
 } {testdb/sqlite_master.tbl testdb/test1.tbl}
 
 # Verify the other fields of the sqlite_master file.
 #
-do_test crttbl-1.3 {
+do_test table-1.3 {
   execsql {SELECT name, tbl_name, type FROM sqlite_master}
 } {test1 test1 table}
 
 # Close and reopen the database.  Verify that everything is
 # still the same.
 #
-do_test crttbl-1.4 {
+do_test table-1.4 {
   db close
   sqlite db testdb
   execsql {SELECT name, tbl_name, type from sqlite_master}
@@ -69,21 +69,21 @@ do_test crttbl-1.4 {
 
 # Drop the database and make sure it disappears.
 #
-do_test crttbl-1.5 {
+do_test table-1.5 {
   execsql {DROP TABLE test1}
   execsql {SELECT * FROM sqlite_master}
 } {}
 
 # Verify that the file associated with the database is gone.
 #
-do_test crttbl-1.5 {
+do_test table-1.5 {
   lsort [glob -nocomplain testdb/*.tbl]
 } {testdb/sqlite_master.tbl}
 
 # Close and reopen the database.  Verify that the table is
 # still gone.
 #
-do_test crttbl-1.6 {
+do_test table-1.6 {
   db close
   sqlite db testdb
   execsql {SELECT name FROM sqlite_master}
@@ -92,47 +92,47 @@ do_test crttbl-1.6 {
 
 # Verify that we cannot make two tables with the same name
 #
-do_test crttbl-2.1 {
+do_test table-2.1 {
   execsql {CREATE TABLE test2(one text)}
   set v [catch {execsql {CREATE TABLE test2(two text)}} msg]
   lappend v $msg
 } {1 {table "test2" already exists}}
-do_test crttbl-2.1b {
+do_test table-2.1b {
   set v [catch {execsql {CREATE TABLE sqlite_master(two text)}} msg]
   lappend v $msg
 } {1 {table "sqlite_master" already exists}}
-do_test crttbl-2.1c {
+do_test table-2.1c {
   db close
   sqlite db testdb
   set v [catch {execsql {CREATE TABLE sqlite_master(two text)}} msg]
   lappend v $msg
 } {1 {table "sqlite_master" already exists}}
-do_test crttbl-2.1d {
+do_test table-2.1d {
   execsql {DROP TABLE test2; SELECT name FROM sqlite_master}
 } {}
 
 # Verify that we cannot make a table with the same name as an index
 #
-do_test crttbl-2.2 {
+do_test table-2.2 {
   execsql {CREATE TABLE test2(one text); CREATE INDEX test3 ON test2(one)}
   set v [catch {execsql {CREATE TABLE test3(two text)}} msg]
   lappend v $msg
 } {1 {there is already an index named "test3"}}
-do_test crttbl-2.2b {
+do_test table-2.2b {
   db close
   sqlite db testdb
   set v [catch {execsql {CREATE TABLE test3(two text)}} msg]
   lappend v $msg
 } {1 {there is already an index named "test3"}}
-do_test crttbl-2.2c {
+do_test table-2.2c {
   execsql {DROP INDEX test3}
   set v [catch {execsql {CREATE TABLE test3(two text)}} msg]
   lappend v $msg
 } {0 {}}
-do_test crttbl-2.2d {
+do_test table-2.2d {
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {test2 test3}
-do_test crttbl-2.2e {
+do_test table-2.2e {
   execsql {DROP TABLE test2; DROP TABLE test3}
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {}
@@ -162,29 +162,29 @@ set big_table \
   f19 text,
   f20 text
 )}
-do_test crttbl-3.1 {
+do_test table-3.1 {
   execsql $big_table
   execsql {SELECT sql FROM sqlite_master}
 } \{$big_table\}
-do_test crttbl-3.2 {
+do_test table-3.2 {
   set v [catch {execsql {CREATE TABLE BIG(xyz foo)}} msg]
   lappend v $msg
 } {1 {table "BIG" already exists}}
-do_test crttbl-3.3 {
+do_test table-3.3 {
   set v [catch {execsql {CREATE TABLE biG(xyz foo)}} msg]
   lappend v $msg
 } {1 {table "biG" already exists}}
-do_test crttbl-3.4 {
+do_test table-3.4 {
   set v [catch {execsql {CREATE TABLE bIg(xyz foo)}} msg]
   lappend v $msg
 } {1 {table "bIg" already exists}}
-do_test crttbl-3.5 {
+do_test table-3.5 {
   db close
   sqlite db testdb
   set v [catch {execsql {CREATE TABLE Big(xyz foo)}} msg]
   lappend v $msg
 } {1 {table "Big" already exists}}
-do_test crttbl-3.6 {
+do_test table-3.6 {
   execsql {DROP TABLE big}
   execsql {SELECT name FROM sqlite_master}
 } {}
@@ -195,7 +195,7 @@ set r {}
 for {set i 1} {$i<=100} {incr i} {
   lappend r test$i
 }
-do_test crttbl-4.1 {
+do_test table-4.1 {
   for {set i 1} {$i<=100} {incr i} {
     set sql "CREATE TABLE test$i ("
     for {set k 1} {$k<$i} {incr k} {
@@ -206,7 +206,7 @@ do_test crttbl-4.1 {
   }
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } $r
-do_test crttbl-4.1b {
+do_test table-4.1b {
   db close
   sqlite db testdb
   execsql {SELECT name FROM sqlite_master ORDER BY name}
@@ -218,7 +218,7 @@ set r {}
 for {set i 1} {$i<=100} {incr i 2} {
   lappend r test$i
 }
-do_test crttbl-4.2 {
+do_test table-4.2 {
   for {set i 2} {$i<=100} {incr i 2} {
     set sql "DROP TABLE TEST$i"
     execsql $sql
@@ -228,7 +228,7 @@ do_test crttbl-4.2 {
 
 # Drop the odd number tables
 #
-do_test crttbl-4.3 {
+do_test table-4.3 {
   for {set i 1} {$i<=100} {incr i 2} {
     set sql "DROP TABLE test$i"
     execsql $sql
@@ -236,4 +236,33 @@ do_test crttbl-4.3 {
   execsql {SELECT name FROM sqlite_master ORDER BY name}
 } {}
 
+# Try to drop a table that does not exist
+#
+do_test table-5.1 {
+  set v [catch {execsql {DROP TABLE test9}} msg]
+  lappend v $msg
+} {1 {no such table: test9}}
+
+# Try to drop sqlite_master
+#
+do_test table-5.2 {
+  set v [catch {execsql {DROP TABLE sqlite_master}} msg]
+  lappend v $msg
+} {1 {table "sqlite_master" may not be dropped}}
+
+# Make sure an EXPLAIN does not really create a new table
+#
+do_test table-5.3 {
+  execsql {EXPLAIN CREATE TABLE test1(f1 int)}
+  execsql {SELECT name FROM sqlite_master}
+} {}
+
+# Make sure an EXPLAIN does not really drop an existing table
+#
+do_test table-5.4 {
+  execsql {CREATE TABLE test1(f1 int)}
+  execsql {EXPLAIN DROP TABLE test1}
+  execsql {SELECT name FROM sqlite_master}
+} {test1}
+
 finish_test