| OLD | NEW |
| 1 # 2012 February 28 | 1 # 2012 February 28 |
| 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 | 11 # This file implements regression tests for SQLite library. The |
| 12 # focus of this file is testing the operation of the library in | 12 # focus of this file is testing the operation of the library in |
| 13 # "PRAGMA journal_mode=WAL" mode. | 13 # "PRAGMA journal_mode=WAL" mode. |
| 14 # | 14 # |
| 15 # Specifically, it tests the case where a connection opens an empty | 15 # Specifically, it tests the case where a connection opens an empty |
| 16 # file. Then, another connection opens the same file and initializes | 16 # file. Then, another connection opens the same file and initializes |
| 17 # the connection as a WAL database. Following this, the first connection | 17 # the connection as a WAL database. Following this, the first connection |
| 18 # executes a "PRAGMA page_size = XXX" command to set its expected page | 18 # executes a "PRAGMA page_size = XXX" command to set its expected page |
| 19 # size, and then queries the database. | 19 # size, and then queries the database. |
| 20 # | 20 # |
| 21 # This is an unusual case, as normally SQLite is able to glean the page | 21 # This is an unusual case, as normally SQLite is able to glean the page |
| 22 # size from the database file as soon as it is opened (even before the | 22 # size from the database file as soon as it is opened (even before the |
| 23 # first read transaction is executed), and the "PRAGMA page_size = XXX" | 23 # first read transaction is executed), and the "PRAGMA page_size = XXX" |
| 24 # is a no-op. | 24 # is a no-op. |
| 25 # | 25 # |
| 26 set testdir [file dirname $argv0] | 26 set testdir [file dirname $argv0] |
| 27 source $testdir/tester.tcl | 27 source $testdir/tester.tcl |
| 28 set ::testprefix wal8 | 28 set ::testprefix wal8 |
| 29 ifcapable !wal {finish_test ; return } | 29 ifcapable !wal {finish_test ; return } |
| 30 do_not_use_codec |
| 30 | 31 |
| 31 db close | 32 db close |
| 32 forcedelete test.db test.db-wal | 33 forcedelete test.db test.db-wal |
| 33 | 34 |
| 34 sqlite3 db test.db | 35 sqlite3 db test.db |
| 35 sqlite3 db2 test.db | 36 sqlite3 db2 test.db |
| 36 | 37 |
| 37 do_test 1.0 { | 38 do_test 1.0 { |
| 38 execsql { | 39 execsql { |
| 39 PRAGMA journal_mode = wal; | 40 PRAGMA journal_mode = wal; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 INSERT INTO t1 VALUES(1, 2); | 82 INSERT INTO t1 VALUES(1, 2); |
| 82 } db2 | 83 } db2 |
| 83 } {wal} | 84 } {wal} |
| 84 | 85 |
| 85 do_execsql_test 3.1 { | 86 do_execsql_test 3.1 { |
| 86 PRAGMA page_size = 4096; | 87 PRAGMA page_size = 4096; |
| 87 SELECT name FROM sqlite_master; | 88 SELECT name FROM sqlite_master; |
| 88 } {t1} | 89 } {t1} |
| 89 | 90 |
| 90 finish_test | 91 finish_test |
| OLD | NEW |