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

Side by Side Diff: third_party/sqlite/test/tempdb.test

Issue 3108030: Move bundled copy of sqlite one level deeper to better separate it... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/test/tclsqlite.test ('k') | third_party/sqlite/test/temptable.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # 2008 April 14
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 # This file implements regression tests for SQLite library.
12 # The focus of this file is in making sure that rolling back
13 # a statement journal works correctly.
14 #
15 # $Id: tempdb.test,v 1.4 2009/06/05 17:09:12 drh Exp $
16
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
19
20 # Use a temporary database.
21 #
22 db close
23 sqlite3 db {}
24
25 # Force a statement journal rollback on a database file that
26 # has never been opened.
27 #
28 do_test tempdb-1.1 {
29 execsql {
30 BEGIN;
31 CREATE TABLE t1(x UNIQUE);
32 CREATE TABLE t2(y);
33 INSERT INTO t2 VALUES('hello');
34 INSERT INTO t2 VALUES(NULL);
35 }
36 # Because of the transaction, the temporary database file
37 # has not even been opened yet. The following statement
38 # will cause a statement journal rollback on this non-existant
39 # file.
40 catchsql {
41 INSERT INTO t1
42 SELECT CASE WHEN y IS NULL THEN test_error('oops', 11) ELSE y END
43 FROM t2;
44 }
45 } {1 oops}
46
47 # Verify that no writes occurred in t1.
48 #
49 do_test tempdb-1.2 {
50 execsql {
51 SELECT * FROM t1
52 }
53 } {}
54
55 do_test tempdb-2.1 {
56 # Set $::jrnl_in_memory if the journal file is expected to be in-memory.
57 # Similarly, set $::subj_in_memory if the sub-journal file is expected
58 # to be in memory. These variables are used to calculate the expected
59 # number of open files in the test cases below.
60 #
61 set jrnl_in_memory [expr {
62 [info exists ::permutations_test_prefix] &&
63 $::permutations_test_prefix eq "inmemory_journal"
64 }]
65 set subj_in_memory [expr {$jrnl_in_memory || $TEMP_STORE == 3}]
66
67 db close
68 sqlite3 db test.db
69 } {}
70 do_test tempdb-2.2 {
71 execsql {
72 CREATE TABLE t1 (a PRIMARY KEY, b, c);
73 CREATE TABLE t2 (a, b, c);
74 BEGIN;
75 INSERT INTO t1 VALUES(1, 2, 3);
76 INSERT INTO t1 VALUES(4, 5, 6);
77 INSERT INTO t2 SELECT * FROM t1;
78 }
79 catchsql { INSERT INTO t1 SELECT * FROM t2 }
80 set sqlite_open_file_count
81 } [expr 1 + (0==$jrnl_in_memory) + (0==$subj_in_memory)]
82 do_test tempdb-2.3 {
83 execsql {
84 PRAGMA temp_store = 'memory';
85 ROLLBACK;
86 BEGIN;
87 INSERT INTO t1 VALUES(1, 2, 3);
88 INSERT INTO t1 VALUES(4, 5, 6);
89 INSERT INTO t2 SELECT * FROM t1;
90 }
91 catchsql { INSERT INTO t1 SELECT * FROM t2 }
92 set sqlite_open_file_count
93 } [expr 1 + (0==$jrnl_in_memory)]
94
95 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/test/tclsqlite.test ('k') | third_party/sqlite/test/temptable.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698