| # 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 server4 |
| |
| source $testdir/server_common.tcl |
| return_if_no_server |
| |
| server_reset_db |
| server_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 |
| |