xref: /sqlite-3.40.0/test/memjournal.test (revision c00727ab)
1# 2021 May 24
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# Tests focused on the in-memory journal.
12#
13
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16source $testdir/malloc_common.tcl
17set testprefix memjournal
18
19
20do_execsql_test 1.0 {
21  PRAGMA journal_mode = memory;
22  CREATE TABLE t1(a);
23} {memory}
24
25set nRow [expr 1]
26
27do_execsql_test 1.1 {
28  BEGIN;
29    INSERT INTO t1 VALUES( randomblob(500) );
30} {}
31
32do_test 1.2 {
33  for {set i 1} {$i <= 500} {incr i} {
34    execsql {
35      SAVEPOINT one;
36      UPDATE t1 SET a=randomblob(500);
37    }
38    execsql { SAVEPOINT abc }
39    execsql { UPDATE t1 SET a=randomblob(500) WHERE rowid<=$i AND 0 }
40    execsql { RELEASE abc }
41  }
42} {}
43
44do_execsql_test 1.3 {
45  COMMIT;
46}
47
48finish_test
49