OLD | NEW |
1 # 2005 February 15 | 1 # 2005 February 15 |
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } {ok} | 175 } {ok} |
176 do_test vacuum2-4.7 { | 176 do_test vacuum2-4.7 { |
177 db close | 177 db close |
178 sqlite3 db test.db | 178 sqlite3 db test.db |
179 execsql { | 179 execsql { |
180 pragma auto_vacuum; | 180 pragma auto_vacuum; |
181 } | 181 } |
182 } {2} | 182 } {2} |
183 } | 183 } |
184 | 184 |
| 185 |
| 186 #------------------------------------------------------------------------- |
| 187 # The following block of tests verify the behaviour of the library when |
| 188 # a database is VACUUMed when there are one or more unfinalized SQL |
| 189 # statements reading the same database using the same db handle. |
| 190 # |
| 191 db close |
| 192 forcedelete test.db |
| 193 sqlite3 db test.db |
| 194 do_execsql_test vacuum2-5.1 { |
| 195 CREATE TABLE t1(a PRIMARY KEY, b UNIQUE); |
| 196 INSERT INTO t1 VALUES(1, randomblob(500)); |
| 197 INSERT INTO t1 SELECT a+1, randomblob(500) FROM t1; -- 2 |
| 198 INSERT INTO t1 SELECT a+2, randomblob(500) FROM t1; -- 4 |
| 199 INSERT INTO t1 SELECT a+4, randomblob(500) FROM t1; -- 8 |
| 200 INSERT INTO t1 SELECT a+8, randomblob(500) FROM t1; -- 16 |
| 201 } {} |
| 202 |
| 203 do_test vacuum2-5.2 { |
| 204 list [catch { |
| 205 db eval {SELECT a, b FROM t1} { if {$a == 8} { execsql VACUUM } } |
| 206 } msg] $msg |
| 207 } {1 {cannot VACUUM - SQL statements in progress}} |
| 208 |
| 209 do_test vacuum2-5.3 { |
| 210 list [catch { |
| 211 db eval {SELECT 1, 2, 3} { execsql VACUUM } |
| 212 } msg] $msg |
| 213 } {1 {cannot VACUUM - SQL statements in progress}} |
| 214 |
| 215 do_test vacuum2-5.4 { |
| 216 set res "" |
| 217 set res2 "" |
| 218 db eval {SELECT a, b FROM t1 WHERE a<=10} { |
| 219 if {$a==6} { set res [catchsql VACUUM] } |
| 220 lappend res2 $a |
| 221 } |
| 222 lappend res2 $res |
| 223 } {1 2 3 4 5 6 7 8 9 10 {1 {cannot VACUUM - SQL statements in progress}}} |
| 224 |
| 225 |
185 finish_test | 226 finish_test |
OLD | NEW |