OLD | NEW |
1 # 2007 April 2 | 1 # 2007 April 2 |
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 #*********************************************************************** |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 for {set ::N 1} {$::go} {incr ::N} { | 105 for {set ::N 1} {$::go} {incr ::N} { |
106 set ::sqlite_io_error_hit 0 | 106 set ::sqlite_io_error_hit 0 |
107 set ::sqlite_io_error_persist $bPersist | 107 set ::sqlite_io_error_persist $bPersist |
108 set ::sqlite_io_error_pending $::N | 108 set ::sqlite_io_error_pending $::N |
109 | 109 |
110 foreach {::go res} [catchsql $sql] {} | 110 foreach {::go res} [catchsql $sql] {} |
111 check_db ioerr2-4.[expr {$bPersist+2}].$::N | 111 check_db ioerr2-4.[expr {$bPersist+2}].$::N |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
| 115 # When this test was written, an IO error within the UPDATE statement caused |
| 116 # a rollback, which tripped all read-cursors, causing the outer SELECT to |
| 117 # fail with "abort due to ROLLBACK". Now, the loop continues until the UPDATE |
| 118 # is run successfully. At this point the next IO error occurs within the |
| 119 # SELECT - throwing the "disk I/O error" that the test case now expects. |
| 120 # |
115 do_test ioerr2-5 { | 121 do_test ioerr2-5 { |
116 execsql { | 122 execsql { |
117 CREATE TABLE t2 AS SELECT * FROM t1; | 123 CREATE TABLE t2 AS SELECT * FROM t1; |
118 PRAGMA temp_store = memory; | 124 PRAGMA temp_store = memory; |
119 } | 125 } |
120 set ::sqlite_io_error_persist 0 | 126 set ::sqlite_io_error_persist 0 |
121 set ::go 1 | 127 set ::go 1 |
122 set rc [catch { | 128 set rc [catch { |
123 for {set ::N 2} {$::N<200} {incr ::N} { | 129 for {set ::N 2} {$::N<200} {incr ::N} { |
124 db eval {SELECT * FROM t1 WHERE rowid IN (1, 5, 10, 15, 20)} { | 130 db eval {SELECT * FROM t1 WHERE rowid IN (1, 5, 10, 15, 20)} { |
125 set ::sqlite_io_error_hit 0 | 131 set ::sqlite_io_error_hit 0 |
126 set ::sqlite_io_error_pending $::N | 132 set ::sqlite_io_error_pending $::N |
127 set sql {UPDATE t2 SET b = randstr(400,400)} | 133 set sql {UPDATE t2 SET b = randstr(400,400)} |
128 foreach {::go res} [catchsql $sql] {} | 134 foreach {::go res} [catchsql $sql] {} |
129 } | 135 } |
130 } | 136 } |
131 } msg] | 137 } msg] |
132 list $rc $msg | 138 list $rc $msg |
133 } {1 {callback requested query abort}} | 139 } {1 {disk I/O error}} ;# used to be "{1 {abort due to ROLLBACK}}" |
134 | 140 |
135 if {$::tcl_platform(platform) == "unix"} { | 141 if {$::tcl_platform(platform) == "unix"} { |
136 # Cause the call to xAccess used by [pragma temp_store_directory] to | 142 # Cause the call to xAccess used by [pragma temp_store_directory] to |
137 # determine if the specified directory is writable to fail. This causes | 143 # determine if the specified directory is writable to fail. This causes |
138 # SQLite to report "not a writable directory", which is probably the | 144 # SQLite to report "not a writable directory", which is probably the |
139 # right answer. | 145 # right answer. |
140 # | 146 # |
141 do_test ioerr2-6 { | 147 do_test ioerr2-6 { |
142 set ::sqlite_io_error_hit 0 | 148 set ::sqlite_io_error_hit 0 |
143 set ::sqlite_io_error_pending 1 | 149 set ::sqlite_io_error_pending 1 |
(...skipping 17 matching lines...) Expand all Loading... |
161 INSERT INTO de SELECT * FROM ab; | 167 INSERT INTO de SELECT * FROM ab; |
162 } -sqlbody { | 168 } -sqlbody { |
163 BEGIN; | 169 BEGIN; |
164 UPDATE ab SET b = randstr(200,200); | 170 UPDATE ab SET b = randstr(200,200); |
165 UPDATE de SET e = randstr(200,200) WHERE d = (SELECT max(d) FROM de); | 171 UPDATE de SET e = randstr(200,200) WHERE d = (SELECT max(d) FROM de); |
166 DELETE FROM ab; | 172 DELETE FROM ab; |
167 COMMIT; | 173 COMMIT; |
168 } | 174 } |
169 | 175 |
170 finish_test | 176 finish_test |
OLD | NEW |