087794b136
READONLY". FossilOrigin-Name: 5a043aa8dd0751e644c495a59deea5fe05da905f49c664d978fe477f9240bc37
63 lines
1.2 KiB
Plaintext
63 lines
1.2 KiB
Plaintext
# 2017 July 09
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
# This file implements regression tests for SQLite library.
|
|
#
|
|
# The focus of this script is testing the server mode of SQLite.
|
|
# Specifically, that "BEGIN READONLY" starts a read-only MVCC
|
|
# transaction.
|
|
#
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
source $testdir/lock_common.tcl
|
|
set testprefix server3
|
|
|
|
sqlite3 db2 test.db
|
|
|
|
do_execsql_test 1.0 {
|
|
CREATE TABLE t1(x);
|
|
INSERT INTO t1 VALUES(1);
|
|
CREATE TABLE t2(x);
|
|
INSERT INTO t2 VALUES(1);
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES(2);
|
|
INSERT INTO t2 VALUES(2);
|
|
}
|
|
|
|
do_execsql_test -db db2 1.1 {
|
|
BEGIN READONLY;
|
|
SELECT * FROM t1;
|
|
} {1}
|
|
|
|
do_execsql_test 1.2 {
|
|
COMMIT;
|
|
INSERT INTO t1 VALUES(3);
|
|
SELECT * FROM t1;
|
|
} {1 2 3}
|
|
|
|
do_execsql_test 1.2a {
|
|
INSERT INTO t2 VALUES(3);
|
|
} {}
|
|
|
|
do_execsql_test -db db2 1.3 {
|
|
SELECT * FROM t2;
|
|
} {1}
|
|
|
|
do_execsql_test -db db2 1.4 {
|
|
ROLLBACK;
|
|
SELECT * FROM t1;
|
|
} {1 2 3}
|
|
|
|
|
|
finish_test
|
|
|