| 1 |
|
| 2 |
# 2013 August 29 |
| 3 |
# |
| 4 |
# The author disclaims copyright to this source code. In place of |
| 5 |
# a legal notice, here is a blessing: |
| 6 |
# |
| 7 |
# May you do good and not evil. |
| 8 |
# May you find forgiveness for yourself and forgive others. |
| 9 |
# May you share freely, never taking more than you give. |
| 10 |
# |
| 11 |
#*********************************************************************** |
| 12 |
# This file implements regression tests for SQLite library. |
| 13 |
# |
| 14 |
|
| 15 |
set testdir [file dirname $argv0] |
| 16 |
source $testdir/tester.tcl |
| 17 |
source $testdir/malloc_common.tcl |
| 18 |
set ::testprefix tkt-9f2eb3abac |
| 19 |
|
| 20 |
do_execsql_test 1.1 { |
| 21 |
CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,d,e)); |
| 22 |
SELECT * FROM t1 WHERE a=? AND b=? AND c=? AND d=? AND e=?; |
| 23 |
} {} |
| 24 |
|
| 25 |
do_execsql_test 1.2 { |
| 26 |
CREATE TABLE "a" ( |
| 27 |
"b" integer NOT NULL, |
| 28 |
"c" integer NOT NULL, |
| 29 |
PRIMARY KEY ("b", "c") |
| 30 |
); |
| 31 |
|
| 32 |
CREATE TABLE "d" ( |
| 33 |
"e" integer NOT NULL, |
| 34 |
"g" integer NOT NULL, |
| 35 |
"f" integer NOT NULL, |
| 36 |
"h" integer NOT NULL, |
| 37 |
"i" character(10) NOT NULL, |
| 38 |
"j" int, |
| 39 |
PRIMARY KEY ("e", "g", "f", "h") |
| 40 |
); |
| 41 |
|
| 42 |
CREATE TABLE "d_to_a" ( |
| 43 |
"f_e" integer NOT NULL, |
| 44 |
"f_g" integer NOT NULL, |
| 45 |
"f_f" integer NOT NULL, |
| 46 |
"f_h" integer NOT NULL, |
| 47 |
"t_b" integer NOT NULL, |
| 48 |
"t_c" integer NOT NULL, |
| 49 |
"r" character NOT NULL, |
| 50 |
"s" integer, |
| 51 |
PRIMARY KEY ("f_e", "f_g", "f_f", "f_h", "t_b", "t_c") |
| 52 |
); |
| 53 |
|
| 54 |
INSERT INTO d (g, e, h, f, j, i) VALUES ( 1, 1, 1, 1, 1, 1 ); |
| 55 |
INSERT INTO a (b, c) VALUES ( 1, 1 ); |
| 56 |
INSERT INTO d_to_a VALUES (1, 1, 1, 1, 1, 1, 1, 1); |
| 57 |
|
| 58 |
DELETE FROM d_to_a |
| 59 |
WHERE f_g = 1 AND f_e = 1 AND f_h = 1 AND f_f = 1 AND t_b = 1 AND t_c = 1; |
| 60 |
|
| 61 |
SELECT * FROM d_to_a; |
| 62 |
} {} |
| 63 |
|
| 64 |
faultsim_delete_and_reopen |
| 65 |
do_execsql_test 2.0 { CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,d,e)) } |
| 66 |
do_execsql_test 2.1 { CREATE TABLE t2(x) } |
| 67 |
faultsim_save_and_close |
| 68 |
|
| 69 |
do_faultsim_test 3 -faults oom* -prep { |
| 70 |
faultsim_restore_and_reopen |
| 71 |
execsql { SELECT 1 FROM sqlite_master } |
| 72 |
} -body { |
| 73 |
execsql { SELECT * FROM t1,t2 WHERE a=? AND b=? AND c=? AND d=? AND e=? } |
| 74 |
} -test { |
| 75 |
faultsim_test_result {0 {}} |
| 76 |
} |
| 77 |
|
| 78 |
finish_test |