blob: 3d02794ec348211c5d596c06a2363861efca6a18 [file] [log] [blame]
drhacf4ac92003-12-17 23:57:34 +00001# 2003 December 17
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# This file implements regression tests for SQLite library.
12#
13# This file implements tests for miscellanous features that were
14# left out of other test files.
15#
16# $Id: misc3.test,v 1.1 2003/12/17 23:57:36 drh Exp $
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21# Ticket #529. Make sure an ABORT does not damage the in-memory cache
22# that will be used by subsequent statements in the same transaction.
23#
24do_test misc3-1.1 {
25 execsql {
26 CREATE TABLE t1(a UNIQUE,b);
27 INSERT INTO t1
28 VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
29 UPDATE t1 SET b=b||b;
30 UPDATE t1 SET b=b||b;
31 UPDATE t1 SET b=b||b;
32 UPDATE t1 SET b=b||b;
33 UPDATE t1 SET b=b||b;
34 INSERT INTO t1 VALUES(2,'x');
35 UPDATE t1 SET b=substr(b,1,500);
36 BEGIN;
37 }
38 catchsql {UPDATE t1 SET a=CASE a WHEN 2 THEN 1 ELSE a END, b='y';}
39 execsql {
40 CREATE TABLE t2(x,y);
41 COMMIT;
42 PRAGMA integrity_check;
43 }
44} ok
45do_test misc3-1.2 {
46 execsql {
47 DROP TABLE t1;
48 DROP TABLE t2;
49 VACUUM;
50 CREATE TABLE t1(a UNIQUE,b);
51 INSERT INTO t1
52 VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
53 INSERT INTO t1 SELECT a+1, b||b FROM t1;
54 INSERT INTO t1 SELECT a+2, b||b FROM t1;
55 INSERT INTO t1 SELECT a+4, b FROM t1;
56 INSERT INTO t1 SELECT a+8, b FROM t1;
57 INSERT INTO t1 SELECT a+16, b FROM t1;
58 INSERT INTO t1 SELECT a+32, b FROM t1;
59 INSERT INTO t1 SELECT a+64, b FROM t1;
60
61 BEGIN;
62 }
63 catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';}
64 execsql {
65 INSERT INTO t1 VALUES(200,'hello out there');
66 COMMIT;
67 PRAGMA integrity_check;
68 }
69} ok
70
71finish_test