mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Fix the pager so that correct rollbacks occur when synchronous is turned off.
This check-in also included unrelated documentation updates. (CVS 866) FossilOrigin-Name: 3ef0ad8a4f2696a58aff9d812f90038c2c63f3fc
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
#
|
||||
# This file implements tests for the PRAGMA command.
|
||||
#
|
||||
# $Id: pragma.test,v 1.3 2003/01/18 20:11:07 drh Exp $
|
||||
# $Id: pragma.test,v 1.4 2003/02/15 23:09:17 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -116,21 +116,68 @@ do_test pragma-1.10 {
|
||||
PRAGMA default_synchronous;
|
||||
}
|
||||
} {123 123 0 0}
|
||||
|
||||
do_test pragma-1.11 {
|
||||
execsql {
|
||||
PRAGMA synchronous=NORMAL;
|
||||
PRAGMA cache_size;
|
||||
PRAGMA default_cache_size;
|
||||
PRAGMA synchronous;
|
||||
PRAGMA default_synchronous;
|
||||
}
|
||||
} {123 123 1 0}
|
||||
do_test pragma-1.12 {
|
||||
execsql {
|
||||
PRAGMA synchronous=FULL;
|
||||
PRAGMA cache_size;
|
||||
PRAGMA default_cache_size;
|
||||
PRAGMA synchronous;
|
||||
PRAGMA default_synchronous;
|
||||
}
|
||||
} {123 123 2 0}
|
||||
do_test pragma-1.13 {
|
||||
db close
|
||||
set ::DB [sqlite db test.db]
|
||||
execsql {
|
||||
PRAGMA cache_size;
|
||||
PRAGMA default_cache_size;
|
||||
PRAGMA synchronous;
|
||||
PRAGMA default_synchronous;
|
||||
}
|
||||
} {123 123 0 0}
|
||||
do_test pragma-1.14 {
|
||||
execsql {
|
||||
PRAGMA default_synchronous=FULL;
|
||||
PRAGMA cache_size;
|
||||
PRAGMA default_cache_size;
|
||||
PRAGMA synchronous;
|
||||
PRAGMA default_synchronous;
|
||||
}
|
||||
} {123 123 2 2}
|
||||
do_test pragma-1.15 {
|
||||
db close
|
||||
set ::DB [sqlite db test.db]
|
||||
execsql {
|
||||
PRAGMA cache_size;
|
||||
PRAGMA default_cache_size;
|
||||
PRAGMA synchronous;
|
||||
PRAGMA default_synchronous;
|
||||
}
|
||||
} {123 123 2 2}
|
||||
|
||||
do_test pragma-2.1 {
|
||||
execsql {
|
||||
PRAGMA show_datatypes=on;
|
||||
PRAGMA empty_result_callbacks=off;
|
||||
}
|
||||
sqlite_datatypes $::DB {SELECT * FROM sqlite_master}
|
||||
} {}
|
||||
do_test pragma-1.12 {
|
||||
do_test pragma-2.2 {
|
||||
execsql {
|
||||
PRAGMA empty_result_callbacks=on;
|
||||
}
|
||||
sqlite_datatypes $::DB {SELECT * FROM sqlite_master}
|
||||
} {text text text integer text}
|
||||
do_test pragma-1.13 {
|
||||
do_test pragma-2.3 {
|
||||
execsql {
|
||||
CREATE TABLE t1(
|
||||
a INTEGER,
|
||||
@ -144,38 +191,38 @@ do_test pragma-1.13 {
|
||||
}
|
||||
sqlite_datatypes $::DB {SELECT * FROM t1}
|
||||
} {INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)}
|
||||
do_test pragma-1.14 {
|
||||
do_test pragma-2.4 {
|
||||
sqlite_datatypes $::DB {
|
||||
SELECT 1, 'hello', NULL
|
||||
}
|
||||
} {NUMERIC TEXT TEXT}
|
||||
do_test pragma-1.15 {
|
||||
do_test pragma-2.5 {
|
||||
sqlite_datatypes $::DB {
|
||||
SELECT 1+2 AS X, 'hello' || 5 AS Y, NULL AS Z
|
||||
}
|
||||
} {NUMERIC TEXT TEXT}
|
||||
do_test pragma-1.16 {
|
||||
do_test pragma-2.6 {
|
||||
execsql {
|
||||
CREATE VIEW v1 AS SELECT a+b, b||c, * FROM t1;
|
||||
}
|
||||
sqlite_datatypes $::DB {SELECT * FROM v1}
|
||||
} {NUMERIC TEXT INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)}
|
||||
do_test pragma-1.17 {
|
||||
do_test pragma-2.7 {
|
||||
sqlite_datatypes $::DB {
|
||||
SELECT d,e FROM t1 UNION SELECT a,c FROM t1
|
||||
}
|
||||
} {INTEGER WHATEVER}
|
||||
do_test pragma-1.18 {
|
||||
do_test pragma-2.8 {
|
||||
sqlite_datatypes $::DB {
|
||||
SELECT d,e FROM t1 EXCEPT SELECT c,e FROM t1
|
||||
}
|
||||
} {WHATEVER BLOB}
|
||||
do_test pragma-1.19 {
|
||||
do_test pragma-2.9 {
|
||||
sqlite_datatypes $::DB {
|
||||
SELECT d,e FROM t1 INTERSECT SELECT c,e FROM t1
|
||||
}
|
||||
} {WHATEVER BLOB}
|
||||
do_test pragma-1.20 {
|
||||
do_test pragma-2.10 {
|
||||
sqlite_datatypes $::DB {
|
||||
SELECT d,e FROM t1 INTERSECT SELECT c,e FROM v1
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is database locks.
|
||||
#
|
||||
# $Id: trans.test,v 1.17 2003/02/11 14:55:42 drh Exp $
|
||||
# $Id: trans.test,v 1.18 2003/02/15 23:09:17 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -811,7 +811,11 @@ integrity_check trans-8.3
|
||||
#
|
||||
do_test trans-9.1 {
|
||||
execsql {
|
||||
PRAGMA cache_size=10;
|
||||
PRAGMA default_cache_size=10;
|
||||
}
|
||||
db close
|
||||
sqlite db test.db
|
||||
execsql {
|
||||
BEGIN;
|
||||
CREATE TABLE t3(x TEXT);
|
||||
INSERT INTO t3 VALUES(randstr(10,400));
|
||||
@ -858,6 +862,11 @@ for {set i 2} {$i<=$limit} {incr i} {
|
||||
set ::sig [signature]
|
||||
set cnt [lindex $::sig 0]
|
||||
set ::journal_format [expr {($i%3)+1}]
|
||||
if {$i%2==0} {
|
||||
execsql {PRAGMA synchronous=FULL}
|
||||
} else {
|
||||
execsql {PRAGMA synchronous=NORMAL}
|
||||
}
|
||||
do_test trans-9.$i.1-$cnt {
|
||||
execsql {
|
||||
BEGIN;
|
||||
|
@ -480,6 +480,7 @@ do_test trigger2-6.1h {
|
||||
SELECT * from tbl;
|
||||
}
|
||||
} {}
|
||||
execsql {DELETE FROM tbl}
|
||||
|
||||
|
||||
# Handling of ON CONFLICT by UPDATE statements inside triggers
|
||||
@ -517,15 +518,18 @@ do_test trigger2-6.2e {
|
||||
SELECT * from tbl;
|
||||
}
|
||||
} {4 2 10 6 3 4}
|
||||
do_test trigger2-6.2f {
|
||||
do_test trigger2-6.2f.1 {
|
||||
execsql {
|
||||
UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
|
||||
SELECT * from tbl;
|
||||
}
|
||||
} {1 3 10}
|
||||
execsql {
|
||||
INSERT INTO tbl VALUES (2, 3, 4);
|
||||
}
|
||||
do_test trigger2-6.2f.2 {
|
||||
execsql {
|
||||
INSERT INTO tbl VALUES (2, 3, 4);
|
||||
SELECT * FROM tbl;
|
||||
}
|
||||
} {1 3 10 2 3 4}
|
||||
do_test trigger2-6.2g {
|
||||
catchsql {
|
||||
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the UPDATE statement.
|
||||
#
|
||||
# $Id: update.test,v 1.11 2003/01/29 18:46:54 drh Exp $
|
||||
# $Id: update.test,v 1.12 2003/02/15 23:09:17 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -217,6 +217,7 @@ do_test update-5.6.5 {
|
||||
|
||||
# Repeat the previous sequence of tests with a different index.
|
||||
#
|
||||
execsql {PRAGMA synchronous=FULL}
|
||||
do_test update-6.0 {
|
||||
execsql {DROP INDEX idx1}
|
||||
execsql {CREATE INDEX idx1 ON test1(f2)}
|
||||
|
Reference in New Issue
Block a user