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

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

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/src/test/attach.test ('k') | third_party/sqlite/src/test/attachmalloc.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 # 200 July 1
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. The
12 # focus of this script is attaching many database files to a single
13 # connection.
14 #
15
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18
19 set testprefix attach4
20
21 ifcapable !attach {
22 finish_test
23 return
24 }
25
26 puts "Testing with SQLITE_MAX_ATTACHED=$SQLITE_MAX_ATTACHED"
27
28 set files {main test.db}
29 for {set ii 0} {$ii < $SQLITE_MAX_ATTACHED} {incr ii} {
30 lappend files aux$ii "test.db$ii"
31 }
32
33 do_test 1.1 {
34 sqlite3_limit db SQLITE_LIMIT_ATTACHED -1
35 } $SQLITE_MAX_ATTACHED
36
37 do_test 1.2.1 {
38 db close
39 foreach {name f} $files { forcedelete $f }
40 sqlite3 db test.db
41
42 foreach {name f} $files {
43 if {$name == "main"} continue
44 execsql "ATTACH '$f' AS $name"
45 }
46
47 db eval {PRAGMA database_list} {
48 lappend L $name [file tail $file]
49 }
50 set L
51 } $files
52
53 do_catchsql_test 1.2.2 {
54 ATTACH 'x.db' AS next;
55 } [list 1 "too many attached databases - max $SQLITE_MAX_ATTACHED"]
56
57 do_test 1.3 {
58 execsql BEGIN;
59 foreach {name f} $files {
60 execsql "CREATE TABLE $name.tbl(x)"
61 execsql "INSERT INTO $name.tbl VALUES('$f')"
62 }
63 execsql COMMIT;
64 } {}
65
66 do_test 1.4 {
67 set L [list]
68 foreach {name f} $files {
69 lappend L $name [execsql "SELECT x FROM $name.tbl"]
70 }
71 set L
72 } $files
73
74 set L [list]
75 set S ""
76 foreach {name f} $files {
77 if {[permutation] == "journaltest"} {
78 lappend L delete
79 } else {
80 lappend L wal
81 }
82 append S "
83 PRAGMA $name.journal_mode = WAL;
84 UPDATE $name.tbl SET x = '$name';
85 "
86 }
87 do_execsql_test 1.5 $S $L
88
89 do_test 1.6 {
90 set L [list]
91 foreach {name f} $files {
92 lappend L [execsql "SELECT x FROM $name.tbl"] $f
93 }
94 set L
95 } $files
96
97 do_test 1.7 {
98 execsql BEGIN;
99 foreach {name f} $files {
100 execsql "UPDATE $name.tbl SET x = '$f'"
101 }
102 execsql COMMIT;
103 } {}
104
105 do_test 1.8 {
106 set L [list]
107 foreach {name f} $files {
108 lappend L $name [execsql "SELECT x FROM $name.tbl"]
109 }
110 set L
111 } $files
112
113 db close
114 foreach {name f} $files { forcedelete $f }
115
116 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/attach.test ('k') | third_party/sqlite/src/test/attachmalloc.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698