OLD | NEW |
1 # 2007 March 24 | 1 # 2007 March 24 |
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 # This file implements regression tests for SQLite library. The focus | 11 # This file implements regression tests for SQLite library. The focus |
12 # of these tests is exclusive access mode (i.e. the thing activated by | 12 # of these tests is exclusive access mode (i.e. the thing activated by |
13 # "PRAGMA locking_mode = EXCLUSIVE"). | 13 # "PRAGMA locking_mode = EXCLUSIVE"). |
14 # | 14 # |
15 # $Id: exclusive.test,v 1.15 2009/06/26 12:30:40 danielk1977 Exp $ | 15 # $Id: exclusive.test,v 1.15 2009/06/26 12:30:40 danielk1977 Exp $ |
16 | 16 |
17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
19 | 19 |
20 ifcapable {!pager_pragmas} { | 20 ifcapable {!pager_pragmas} { |
21 finish_test | 21 finish_test |
22 return | 22 return |
23 } | 23 } |
24 | 24 |
25 file delete -force test2.db-journal | 25 forcedelete test2.db-journal |
26 file delete -force test2.db | 26 forcedelete test2.db |
27 file delete -force test3.db-journal | 27 forcedelete test3.db-journal |
28 file delete -force test3.db | 28 forcedelete test3.db |
29 file delete -force test4.db-journal | 29 forcedelete test4.db-journal |
30 file delete -force test4.db | 30 forcedelete test4.db |
31 | 31 |
32 #---------------------------------------------------------------------- | 32 #---------------------------------------------------------------------- |
33 # Test cases exclusive-1.X test the PRAGMA logic. | 33 # Test cases exclusive-1.X test the PRAGMA logic. |
34 # | 34 # |
35 do_test exclusive-1.0 { | 35 do_test exclusive-1.0 { |
36 execsql { | 36 execsql { |
37 pragma locking_mode; | 37 pragma locking_mode; |
38 pragma main.locking_mode; | 38 pragma main.locking_mode; |
39 pragma temp.locking_mode; | 39 pragma temp.locking_mode; |
40 } | 40 } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 do_execsql_test exclusive-6.1 { | 474 do_execsql_test exclusive-6.1 { |
475 CREATE TABLE t4(a, b); | 475 CREATE TABLE t4(a, b); |
476 INSERT INTO t4 VALUES('Eden', 1955); | 476 INSERT INTO t4 VALUES('Eden', 1955); |
477 BEGIN; | 477 BEGIN; |
478 INSERT INTO t4 VALUES('Macmillan', 1957); | 478 INSERT INTO t4 VALUES('Macmillan', 1957); |
479 INSERT INTO t4 VALUES('Douglas-Home', 1963); | 479 INSERT INTO t4 VALUES('Douglas-Home', 1963); |
480 INSERT INTO t4 VALUES('Wilson', 1964); | 480 INSERT INTO t4 VALUES('Wilson', 1964); |
481 } | 481 } |
482 do_test exclusive-6.2 { | 482 do_test exclusive-6.2 { |
483 forcedelete test2.db test2.db-journal | 483 forcedelete test2.db test2.db-journal |
484 file copy test.db test2.db | 484 copy_file test.db test2.db |
485 file copy test.db-journal test2.db-journal | 485 copy_file test.db-journal test2.db-journal |
486 sqlite3 db test2.db | 486 sqlite3 db test2.db |
487 } {} | 487 } {} |
488 | 488 |
489 do_execsql_test exclusive-6.3 { | 489 do_execsql_test exclusive-6.3 { |
490 PRAGMA locking_mode = EXCLUSIVE; | 490 PRAGMA locking_mode = EXCLUSIVE; |
491 SELECT * FROM t4; | 491 SELECT * FROM t4; |
492 } {exclusive Eden 1955} | 492 } {exclusive Eden 1955} |
493 | 493 |
494 do_test exclusive-6.4 { | 494 do_test exclusive-6.4 { |
495 db close | 495 db close |
496 forcedelete test.db test.db-journal | 496 forcedelete test.db test.db-journal |
497 set fd [open test.db-journal w] | 497 set fd [open test.db-journal w] |
498 puts $fd x | 498 puts $fd x |
499 close $fd | 499 close $fd |
500 sqlite3 db test.db | 500 sqlite3 db test.db |
501 } {} | 501 } {} |
502 | 502 |
503 do_execsql_test exclusive-6.5 { | 503 do_execsql_test exclusive-6.5 { |
504 PRAGMA locking_mode = EXCLUSIVE; | 504 PRAGMA locking_mode = EXCLUSIVE; |
505 SELECT * FROM sqlite_master; | 505 SELECT * FROM sqlite_master; |
506 } {exclusive} | 506 } {exclusive} |
507 | 507 |
508 finish_test | 508 finish_test |
509 | |
OLD | NEW |