1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Make sure the pagers in-memory cache states in sync with the disk file.

Ticket #529. (CVS 1133)

FossilOrigin-Name: da00efb13fe8ccf1c27e4e1193df6b53de9463f4
This commit is contained in:
drh
2003-12-17 23:57:34 +00:00
parent 4be295be07
commit acf4ac96e3
5 changed files with 91 additions and 23 deletions

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.10 2003/12/10 01:31:21 drh Exp $
# $Id: misc2.test,v 1.11 2003/12/17 23:57:36 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -231,3 +231,5 @@ do_test misc2-9.3 {
SELECT count(*) FROM x;
}
} [expr 5*5*5*5]
finish_test

71
test/misc3.test Normal file
View File

@ -0,0 +1,71 @@
# 2003 December 17
#
# 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.
#
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc3.test,v 1.1 2003/12/17 23:57:36 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Ticket #529. Make sure an ABORT does not damage the in-memory cache
# that will be used by subsequent statements in the same transaction.
#
do_test misc3-1.1 {
execsql {
CREATE TABLE t1(a UNIQUE,b);
INSERT INTO t1
VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
INSERT INTO t1 VALUES(2,'x');
UPDATE t1 SET b=substr(b,1,500);
BEGIN;
}
catchsql {UPDATE t1 SET a=CASE a WHEN 2 THEN 1 ELSE a END, b='y';}
execsql {
CREATE TABLE t2(x,y);
COMMIT;
PRAGMA integrity_check;
}
} ok
do_test misc3-1.2 {
execsql {
DROP TABLE t1;
DROP TABLE t2;
VACUUM;
CREATE TABLE t1(a UNIQUE,b);
INSERT INTO t1
VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
INSERT INTO t1 SELECT a+1, b||b FROM t1;
INSERT INTO t1 SELECT a+2, b||b FROM t1;
INSERT INTO t1 SELECT a+4, b FROM t1;
INSERT INTO t1 SELECT a+8, b FROM t1;
INSERT INTO t1 SELECT a+16, b FROM t1;
INSERT INTO t1 SELECT a+32, b FROM t1;
INSERT INTO t1 SELECT a+64, b FROM t1;
BEGIN;
}
catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';}
execsql {
INSERT INTO t1 VALUES(200,'hello out there');
COMMIT;
PRAGMA integrity_check;
}
} ok
finish_test