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

Side by Side Diff: third_party/sqlite/src/test/tkt2820.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. 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
1 # 2007 Dec 4 1 # 2007 Dec 4
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 # 11 #
12 # This file is to test that ticket #2820 has been fixed. 12 # This file is to test that ticket #2820 has been fixed.
13 # Ticket #2820 observes that a DROP TABLE statement that 13 # Ticket #2820 observes that a DROP TABLE statement that
14 # occurs while a query is in process will fail with a 14 # occurs while a query is in process will fail with a
15 # "database is locked" error, but the entry in the sqlite_master 15 # "database is locked" error, but the entry in the sqlite_master
16 # table will still be removed. This is incorrect. The 16 # table will still be removed. This is incorrect. The
17 # entry in the sqlite_master table should persist when 17 # entry in the sqlite_master table should persist when
18 # the DROP fails due to an error. 18 # the DROP fails due to an error.
19 # 19 #
20 # $Id: tkt2820.test,v 1.1 2007/12/04 16:54:53 drh Exp $ 20 # $Id: tkt2820.test,v 1.1 2007/12/04 16:54:53 drh Exp $
21 # 21 #
22 22
23 set testdir [file dirname $argv0] 23 set testdir [file dirname $argv0]
24 source $testdir/tester.tcl 24 source $testdir/tester.tcl
25 25
26 proc test_schema_change {testid init ddl res} { 26 proc test_schema_change {testid init ddl res} {
27 db close 27 db close
28 file delete -force test.db test.db-journal 28 forcedelete test.db test.db-journal
29 sqlite3 db test.db 29 sqlite3 db test.db
30 execsql $init 30 execsql $init
31 do_test tkt2820-$testid.1 { 31 do_test tkt2820-$testid.1 {
32 set STMT [sqlite3_prepare db {SELECT * FROM sqlite_master} -1 DUMMY] 32 set STMT [sqlite3_prepare db {SELECT * FROM sqlite_master} -1 DUMMY]
33 sqlite3_step $STMT 33 sqlite3_step $STMT
34 } {SQLITE_ROW} 34 } {SQLITE_ROW}
35 #if {$testid==3} {execsql {PRAGMA vdbe_trace=ON}} 35 #if {$testid==3} {execsql {PRAGMA vdbe_trace=ON}}
36 do_test tkt2820-$testid.2 "catchsql [list $ddl]" \ 36 do_test tkt2820-$testid.2 "catchsql [list $ddl]" \
37 {1 {database table is locked}} 37 {1 {database table is locked}}
38 do_test tkt2820-$testid.3 { 38 do_test tkt2820-$testid.3 {
(...skipping 24 matching lines...) Expand all
63 DROP INDEX i1 63 DROP INDEX i1
64 } {i1 t1} 64 } {i1 t1}
65 65
66 # We further observe that prior to the fix associated with ticket #2820, 66 # We further observe that prior to the fix associated with ticket #2820,
67 # no statement journal would be created on an SQL statement that was run 67 # no statement journal would be created on an SQL statement that was run
68 # while a second statement was active, as long as we are in autocommit 68 # while a second statement was active, as long as we are in autocommit
69 # mode. This is incorrect. 69 # mode. This is incorrect.
70 # 70 #
71 do_test tkt2820-4.1 { 71 do_test tkt2820-4.1 {
72 db close 72 db close
73 file delete -force test.db test.db-journal 73 forcedelete test.db test.db-journal
74 sqlite3 db test.db 74 sqlite3 db test.db
75 db eval { 75 db eval {
76 CREATE TABLE t1(a INTEGER PRIMARY KEY); 76 CREATE TABLE t1(a INTEGER PRIMARY KEY);
77 INSERT INTO t1 VALUES(1); 77 INSERT INTO t1 VALUES(1);
78 INSERT INTO t1 VALUES(2); 78 INSERT INTO t1 VALUES(2);
79 } 79 }
80 80
81 # The INSERT statement within the loop should fail on a 81 # The INSERT statement within the loop should fail on a
82 # constraint violation on the second inserted row. This 82 # constraint violation on the second inserted row. This
83 # should cause the entire INSERT to rollback using a statement 83 # should cause the entire INSERT to rollback using a statement
84 # journal. 84 # journal.
85 # 85 #
86 db eval {SELECT name FROM sqlite_master} { 86 db eval {SELECT name FROM sqlite_master} {
87 catch {db eval { 87 catch {db eval {
88 INSERT INTO t1 SELECT a+1 FROM t1 ORDER BY a DESC 88 INSERT INTO t1 SELECT a+1 FROM t1 ORDER BY a DESC
89 }} 89 }}
90 } 90 }
91 db eval {SELECT a FROM t1 ORDER BY a} 91 db eval {SELECT a FROM t1 ORDER BY a}
92 } {1 2} 92 } {1 2}
93 93
94 finish_test 94 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698