10f42f71dSdan# 2022 Jan 01 20f42f71dSdan# 30f42f71dSdan# The author disclaims copyright to this source code. In place of 40f42f71dSdan# a legal notice, here is a blessing: 50f42f71dSdan# 60f42f71dSdan# May you do good and not evil. 70f42f71dSdan# May you find forgiveness for yourself and forgive others. 80f42f71dSdan# May you share freely, never taking more than you give. 90f42f71dSdan# 100f42f71dSdan#*********************************************************************** 110f42f71dSdan# Tests focused on the in-memory journal. 120f42f71dSdan# 13*cf2ad7aeSdan# TESTRUNNER: slow 140f42f71dSdan 150f42f71dSdanset testdir [file dirname $argv0] 160f42f71dSdansource $testdir/tester.tcl 170f42f71dSdansource $testdir/malloc_common.tcl 180f42f71dSdanset testprefix memjournal2 190f42f71dSdan 200f42f71dSdando_execsql_test 1.0 { 210f42f71dSdan PRAGMA journal_mode = memory; 220f42f71dSdan CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE); 230f42f71dSdan} {memory} 240f42f71dSdan 250f42f71dSdanset nRow [expr 2000] 260f42f71dSdan 270f42f71dSdando_execsql_test 1.1 { 280f42f71dSdan BEGIN; 290f42f71dSdan WITH s(i) AS ( 300f42f71dSdan SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<$nRow 310f42f71dSdan ) 320f42f71dSdan INSERT INTO t1 SELECT NULL, randomblob(700) FROM s; 330f42f71dSdan} 340f42f71dSdan 350f42f71dSdanfor {set jj 200} {$jj <= 300} {incr jj} { 360f42f71dSdan do_execsql_test 1.2.$jj.1 { 370f42f71dSdan SAVEPOINT one; 380f42f71dSdan UPDATE t1 SET b=randomblob(700) WHERE a<=$jj; 390f42f71dSdan } 400f42f71dSdan do_execsql_test 1.2.$jj.2 { 410f42f71dSdan SAVEPOINT two; 420f42f71dSdan UPDATE t1 SET b=randomblob(700) WHERE a==1; 430f42f71dSdan ROLLBACK TO two; 440f42f71dSdan RELEASE two; 450f42f71dSdan } 460f42f71dSdan do_execsql_test 1.2.$jj.3 { 470f42f71dSdan SAVEPOINT two; 480f42f71dSdan UPDATE t1 SET b=randomblob(700) WHERE a==1; 490f42f71dSdan ROLLBACK TO two; 500f42f71dSdan RELEASE two; 510f42f71dSdan } 520f42f71dSdan 530f42f71dSdan do_execsql_test 1.2.$jj.4 { 540f42f71dSdan PRAGMA integrity_check; 550f42f71dSdan ROLLBACK TO one; 560f42f71dSdan RELEASE one; 570f42f71dSdan } {ok} 580f42f71dSdan} 590f42f71dSdan 600f42f71dSdan 610f42f71dSdanfinish_test 620f42f71dSdan 630f42f71dSdan 64