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 / ext / intck / intckbusy.test
| 1 | # 2024 February 24 |
| 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 | source [file join [file dirname [info script]] intck_common.tcl] |
| 14 | set testprefix intckbusy |
| 15 | return_if_no_intck |
| 16 | |
| 17 | |
| 18 | |
| 19 | do_execsql_test 1.0 { |
| 20 | CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); |
| 21 | INSERT INTO t1 VALUES(1, 2, 3); |
| 22 | INSERT INTO t1 VALUES(2, 'two', 'three'); |
| 23 | INSERT INTO t1 VALUES(3, NULL, NULL); |
| 24 | CREATE INDEX i1 ON t1(b, c); |
| 25 | } |
| 26 | |
| 27 | sqlite3 db2 test.db |
| 28 | |
| 29 | do_execsql_test -db db2 1.1 { |
| 30 | BEGIN EXCLUSIVE; |
| 31 | INSERT INTO t1 VALUES(4, 5, 6); |
| 32 | } |
| 33 | |
| 34 | do_test 1.2 { |
| 35 | set ic [sqlite3_intck db main] |
| 36 | $ic step |
| 37 | } {SQLITE_BUSY} |
| 38 | do_test 1.3 { |
| 39 | $ic unlock |
| 40 | } {SQLITE_BUSY} |
| 41 | do_test 1.4 { |
| 42 | $ic error |
| 43 | } {SQLITE_BUSY {database is locked}} |
| 44 | do_test 1.4 { |
| 45 | $ic close |
| 46 | } {} |
| 47 | |
| 48 | finish_test |
| 49 |