# 2015 July 26 # # 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. # #*********************************************************************** # # Tests for transactions started with BEGIN CONCURRENT. The tests in this # file focus on testing that deferred page allocation works properly. # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/lock_common.tcl set ::testprefix concurrent3 if {$AUTOVACUUM} { finish_test ; return } ifcapable !concurrent { finish_test return } db close sqlite3_shutdown test_sqlite3_log xLog proc xLog {error_code msg} { # puts "$error_code: $msg" # Enable the previous for debugging } reset_db proc create_schema {} { db eval { PRAGMA journal_mode = wal; CREATE TABLE t1(x, y); CREATE TABLE t2(x, y); CREATE TABLE t3(x, y); CREATE TABLE t4(x, y); CREATE INDEX i1 ON t1(y, x); CREATE INDEX i2 ON t2(y, x); CREATE INDEX i3 ON t3(y, x); CREATE INDEX i4 ON t4(y, x); } } proc do_sql_op {iTbl iOp} { set db "db$iTbl" switch $iOp { "i" { set sql " WITH cnt(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM cnt WHERE i<10) INSERT INTO t$iTbl SELECT randomblob(800), randomblob(800) FROM cnt; " } "d" { set sql " DELETE FROM t$iTbl WHERE rowid IN ( SELECT rowid FROM t$iTbl ORDER BY 1 ASC LIMIT 10 ) " } "D" { set sql " DELETE FROM t$iTbl WHERE rowid IN ( SELECT rowid FROM t$iTbl o WHERE ( SELECT count(*) FROM t$iTbl i WHERE i.rowid