blob: a6a4e773532f614392861d6502f18098ed00702e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma ident "%Z%%M% %I% %E% SMI"
set testdir [file dirname $argv0]
source $testdir/tester.tcl
db close
set DB [sqlite db test.db]
execsql {
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
INSERT INTO t1 VALUES(4);
}
do_test capi3-13.1 {
execsql {
CREATE TABLE t3(a unique on conflict rollback);
INSERT INTO t3 SELECT a FROM t1;
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
}
} {}
do_test capi3-13.2 {
set STMT [sqlite_compile $DB "SELECT a FROM t1" TAIL]
sqlite_step $STMT
sqlite_step $STMT
sqlite_step $STMT
sqlite_step $STMT
sqlite_step $STMT
} {SQLITE_ROW}
do_test capi3-13.3 {
# This causes a ROLLBACK, which deletes the table out from underneath the
# SELECT statement. Causes a crash.
catchsql {
INSERT INTO t3 SELECT a FROM t1;
}
} {1 {column a is not unique}}
do_test capi3-13.4 {
sqlite_step $STMT
sqlite_step $STMT
sqlite_step $STMT
sqlite_step $STMT
} {SQLITE_DONE}
do_test capi3-13.5 {
sqlite_finalize $STMT
} {SQLITE_OK}
finish_test
|