OLD | NEW |
1 # 2009 December 8 | 1 # 2009 December 8 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
12 # | 12 # |
13 # Verify that we can create zero-length tables. | 13 # Verify that we can create zero-length tables. |
14 # | 14 # |
15 | 15 |
16 set testdir [file dirname $argv0] | 16 set testdir [file dirname $argv0] |
17 source $testdir/tester.tcl | 17 source $testdir/tester.tcl |
18 | 18 |
19 do_test tkt-78e04-1.0 { | 19 do_test tkt-78e04-1.0 { |
20 execsql { | 20 execsql { |
21 CREATE TABLE ""("" UNIQUE); | 21 CREATE TABLE ""("" UNIQUE, x CHAR(100)); |
22 CREATE TABLE t2(x); | 22 CREATE TABLE t2(x); |
23 INSERT INTO "" VALUES(1); | 23 INSERT INTO ""("") VALUES(1); |
24 INSERT INTO t2 VALUES(2); | 24 INSERT INTO t2 VALUES(2); |
25 SELECT * FROM "", t2; | 25 SELECT * FROM "", t2; |
26 } | 26 } |
27 } {1 2} | 27 } {1 {} 2} |
28 do_test tkt-78e04-1.1 { | 28 do_test tkt-78e04-1.1 { |
29 catchsql { | 29 catchsql { |
30 INSERT INTO "" VALUES(1); | 30 INSERT INTO ""("") VALUES(1); |
31 } | 31 } |
32 } {1 {column is not unique}} | 32 } {1 {UNIQUE constraint failed: .}} |
33 do_test tkt-78e04-1.2 { | 33 do_test tkt-78e04-1.2 { |
34 execsql { | 34 execsql { |
35 PRAGMA table_info(""); | 35 PRAGMA table_info(""); |
36 } | 36 } |
37 } {0 {} {} 0 {} 0} | 37 } {0 {} {} 0 {} 0 1 x CHAR(100) 0 {} 0} |
38 do_test tkt-78e04-1.3 { | 38 do_test tkt-78e04-1.3 { |
39 execsql { | 39 execsql { |
40 CREATE INDEX i1 ON ""("" COLLATE nocase); | 40 CREATE INDEX i1 ON ""("" COLLATE nocase); |
41 } | 41 } |
42 } {} | 42 } {} |
43 do_test tkt-78e04-1.4 { | 43 do_test tkt-78e04-1.4 { |
44 execsql { | 44 execsql { |
45 EXPLAIN QUERY PLAN SELECT * FROM "" WHERE "" LIKE 'abc%'; | 45 EXPLAIN QUERY PLAN SELECT "" FROM "" WHERE "" LIKE 'abc%'; |
46 } | 46 } |
47 } {0 0 0 {SCAN TABLE (~500000 rows)}} | 47 } {0 0 0 {SCAN TABLE USING COVERING INDEX i1}} |
48 do_test tkt-78e04-1.5 { | 48 do_test tkt-78e04-1.5 { |
49 execsql { | 49 execsql { |
50 DROP TABLE ""; | 50 DROP TABLE ""; |
51 SELECT name FROM sqlite_master; | 51 SELECT name FROM sqlite_master; |
52 } | 52 } |
53 } {t2} | 53 } {t2} |
54 | 54 |
55 do_test tkt-78e04-2.1 { | 55 do_test tkt-78e04-2.1 { |
56 execsql { | 56 execsql { |
57 CREATE INDEX "" ON t2(x); | 57 CREATE INDEX "" ON t2(x); |
58 EXPLAIN QUERY PLAN SELECT * FROM t2 WHERE x=5; | 58 EXPLAIN QUERY PLAN SELECT * FROM t2 WHERE x=5; |
59 } | 59 } |
60 } {0 0 0 {SEARCH TABLE t2 USING COVERING INDEX (x=?) (~10 rows)}} | 60 } {0 0 0 {SEARCH TABLE t2 USING COVERING INDEX (x=?)}} |
61 do_test tkt-78e04-2.2 { | 61 do_test tkt-78e04-2.2 { |
62 execsql { | 62 execsql { |
63 DROP INDEX ""; | 63 DROP INDEX ""; |
64 EXPLAIN QUERY PLAN SELECT * FROM t2 WHERE x=2; | 64 EXPLAIN QUERY PLAN SELECT * FROM t2 WHERE x=2; |
65 } | 65 } |
66 } {0 0 0 {SCAN TABLE t2 (~100000 rows)}} | 66 } {0 0 0 {SCAN TABLE t2}} |
67 | 67 |
68 finish_test | 68 finish_test |
OLD | NEW |