1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add the SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE sqlite3_dbconfig() option - for

disabling SQLite's default checkpoint-on-close behaviour.

FossilOrigin-Name: 093d2fc2288b75c15ccf877bfa0e622d3918a562
This commit is contained in:
dan
2016-10-31 16:16:49 +00:00
parent dadafa881f
commit 298af02308
8 changed files with 89 additions and 13 deletions

55
test/nockpt.test Normal file
View File

@ -0,0 +1,55 @@
# 2016 October 31
#
# 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 file is testing the SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
# option.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
ifcapable !wal {finish_test ; return }
set testprefix nockpt
do_execsql_test 1.0 {
PRAGMA page_size = 1024;
PRAGMA journal_mode = wal;
CREATE TABLE c1(x, y, z);
INSERT INTO c1 VALUES(1, 2, 3);
} {wal}
do_test 1.1 { file exists test.db-wal } 1
do_test 1.2 { file size test.db-wal } [wal_file_size 3 1024]
do_test 1.3 { db close } {}
do_test 1.4 { file exists test.db-wal } 0
sqlite3 db test.db
do_execsql_test 1.5 {
INSERT INTO c1 VALUES(4, 5, 6);
INSERT INTO c1 VALUES(7, 8, 9);
}
do_test 1.6 { file exists test.db-wal } 1
do_test 1.7 { sqlite3_db_config db NO_CKPT_ON_CLOSE 1 } {1}
do_test 1.8 { file size test.db-wal } [wal_file_size 2 1024]
do_test 1.9 { db close } {}
do_test 1.10 { file exists test.db-wal } 1
do_test 1.11 { file size test.db-wal } [wal_file_size 2 1024]
sqlite3 db test.db
do_execsql_test 1.12 {
SELECT * FROM c1
} {1 2 3 4 5 6 7 8 9}
finish_test