sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / test / external_reader.test
| 1 | # 2021 April 2 |
| 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 | # |
| 12 | |
| 13 | set testdir [file dirname $argv0] |
| 14 | source $testdir/tester.tcl |
| 15 | source $testdir/lock_common.tcl |
| 16 | set testprefix external_reader |
| 17 | |
| 18 | ifcapable !wal { |
| 19 | finish_test |
| 20 | return |
| 21 | } |
| 22 | if {$::tcl_platform(os) eq "Windows NT"} { |
| 23 | finish_test |
| 24 | return |
| 25 | } |
| 26 | |
| 27 | do_multiclient_test tn { |
| 28 | |
| 29 | set bExternal 1 |
| 30 | if {[info commands db3]!=""} { set bExternal 0 } |
| 31 | |
| 32 | do_test 1.$tn.0 { |
| 33 | sql1 { |
| 34 | PRAGMA journal_mode = wal; |
| 35 | CREATE TABLE t1(a, b); |
| 36 | INSERT INTO t1 VALUES(1, 2); |
| 37 | } |
| 38 | } {wal} |
| 39 | |
| 40 | do_test 1.$tn.1 { |
| 41 | sql2 { SELECT * FROM t1 } |
| 42 | } {1 2} |
| 43 | |
| 44 | do_test 1.$tn.2 { |
| 45 | code1 { |
| 46 | file_control_external_reader db |
| 47 | } |
| 48 | } {0} |
| 49 | |
| 50 | do_test 1.$tn.3 { |
| 51 | sql2 { |
| 52 | BEGIN; |
| 53 | SELECT * FROM t1; |
| 54 | } |
| 55 | } {1 2} |
| 56 | |
| 57 | do_test 1.$tn.4 { |
| 58 | code1 { |
| 59 | file_control_external_reader db |
| 60 | } |
| 61 | } $bExternal |
| 62 | |
| 63 | do_test 1.$tn.5 { |
| 64 | sql2 { COMMIT } |
| 65 | } {} |
| 66 | |
| 67 | do_test 1.$tn.6 { |
| 68 | code1 { file_control_external_reader db } |
| 69 | } 0 |
| 70 | |
| 71 | } |
| 72 | |
| 73 | |
| 74 | finish_test |