Allow sqlite3_snapshot_open() to be called to change the snapshot after a

read transaction is already open on database.

FossilOrigin-Name: 051ac0152048ef52723196c26ca5f2629dafb782aec1c66fc30531bf54335043
This commit is contained in:
dan
2018-08-06 17:12:36 +00:00
parent f018fd5284
commit fa3d4c19a9
11 changed files with 343 additions and 36 deletions
+18 -3
View File
@@ -217,9 +217,19 @@ foreach {tn tcl} {
SELECT * FROM t2;
}
} {a b c d e f}
do_test $tn.3.2.2 {
list [catch {snapshot_open db main $snapshot } msg] $msg
# Update - it is no longer an error to have a read-transaction open,
# provided there are no active SELECT statements.
do_test $tn.3.2.2a {
db eval "SELECT * FROM t2" {
set res [list [catch {snapshot_open db main $snapshot } msg] $msg]
break
}
set res
} {1 SQLITE_ERROR}
do_test $tn.3.2.2b {
snapshot_open db main $snapshot
} {}
do_test $tn.3.2.3 {
execsql {
@@ -231,12 +241,17 @@ foreach {tn tcl} {
} {1 SQLITE_ERROR}
do_execsql_test $tn.3.2.4 COMMIT
do_test $tn.3.3.1 {
do_test $tn.3.3.1a {
execsql { PRAGMA journal_mode = DELETE }
execsql { BEGIN }
list [catch {snapshot_open db main $snapshot } msg] $msg
} {1 SQLITE_ERROR}
do_test $tn.3.3.1b {
execsql { COMMIT ; BEGIN ; SELECT * FROM t2 }
list [catch {snapshot_open db main $snapshot } msg] $msg
} {1 SQLITE_ERROR}
do_test $tn.$tn.3.3.2 {
snapshot_free $snapshot
execsql COMMIT