interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / intck / intckbusy.test

49 lines · 1032 bytes Raw Blame History
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
13source [file join [file dirname [info script]] intck_common.tcl]
14set testprefix intckbusy
15return_if_no_intck
16
17
18
19do_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
27sqlite3 db2 test.db
28
29do_execsql_test -db db2 1.1 {
30 BEGIN EXCLUSIVE;
31 INSERT INTO t1 VALUES(4, 5, 6);
32}
33
34do_test 1.2 {
35 set ic [sqlite3_intck db main]
36 $ic step
37} {SQLITE_BUSY}
38do_test 1.3 {
39 $ic unlock
40} {SQLITE_BUSY}
41do_test 1.4 {
42 $ic error
43} {SQLITE_BUSY {database is locked}}
44do_test 1.4 {
45 $ic close
46} {}
47
48finish_test
49