Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/savepoint7.test

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2012 March 31
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #***********************************************************************
11 #
12 # Focus on the interaction between RELEASE and ROLLBACK TO with
13 # pending query aborts. See ticket [27ca74af3c083f787a1c44b11fbb7c53bdbbcf1e].
14 #
15
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18
19 # The RELEASE of an inner savepoint should not effect pending queries.
20 #
21 do_test savepoint7-1.1 {
22 db eval {
23 CREATE TABLE t1(a,b,c);
24 CREATE TABLE t2(x,y,z);
25 INSERT INTO t1 VALUES(1,2,3);
26 INSERT INTO t1 VALUES(4,5,6);
27 INSERT INTO t1 VALUES(7,8,9);
28 SAVEPOINT x1;
29 }
30 db eval {SELECT * FROM t1} {
31 db eval {
32 SAVEPOINT x2;
33 CREATE TABLE IF NOT EXISTS t3(xyz);
34 INSERT INTO t2 VALUES($a,$b,$c);
35 RELEASE x2;
36 }
37 }
38 db eval {SELECT * FROM t2; RELEASE x1}
39 } {1 2 3 4 5 6 7 8 9}
40
41 do_test savepoint7-1.2 {
42 db eval {DELETE FROM t2;}
43 db eval {SELECT * FROM t1} {
44 db eval {
45 SAVEPOINT x2;
46 INSERT INTO t2 VALUES($a,$b,$c);
47 RELEASE x2;
48 }
49 }
50 db eval {SELECT * FROM t2;}
51 } {1 2 3 4 5 6 7 8 9}
52
53 do_test savepoint7-1.3 {
54 db eval {DELETE FROM t2; BEGIN;}
55 db eval {SELECT * FROM t1} {
56 db eval {
57 SAVEPOINT x2;
58 INSERT INTO t2 VALUES($a,$b,$c);
59 RELEASE x2;
60 }
61 }
62 db eval {SELECT * FROM t2; ROLLBACK;}
63 } {1 2 3 4 5 6 7 8 9}
64
65 # However, a ROLLBACK of an inner savepoint will abort all queries, including
66 # queries in outer contexts.
67 #
68 do_test savepoint7-2.1 {
69 db eval {DELETE FROM t2; SAVEPOINT x1; CREATE TABLE t4(abc);}
70 set rc [catch {
71 db eval {SELECT * FROM t1} {
72 db eval {
73 SAVEPOINT x2;
74 INSERT INTO t2 VALUES($a,$b,$c);
75 ROLLBACK TO x2;
76 }
77 }
78 } msg]
79 db eval {RELEASE x1}
80 list $rc $msg [db eval {SELECT * FROM t2}]
81 } {1 {abort due to ROLLBACK} {}}
82
83 do_test savepoint7-2.2 {
84 db eval {DELETE FROM t2;}
85 set rc [catch {
86 db eval {SELECT * FROM t1} {
87 db eval {
88 SAVEPOINT x2;
89 CREATE TABLE t5(pqr);
90 INSERT INTO t2 VALUES($a,$b,$c);
91 ROLLBACK TO x2;
92 }
93 }
94 } msg]
95 list $rc $msg [db eval {SELECT * FROM t2}]
96 } {1 {abort due to ROLLBACK} {}}
97
98 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/savepoint6.test ('k') | third_party/sqlite/sqlite-src-3080704/test/schema.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698