3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # This test script checks malloc failures in LIMIT operations for
13 # UPDATE/DELETE statements.
15 # $Id: mallocJ.test,v 1.6 2009/01/09 02:49:32 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
19 source $testdir/malloc_common.tcl
21 ifcapable {update_delete_limit} {
23 do_malloc_test mallocJ-1 -sqlprep {
24 DROP TABLE IF EXISTS t1;
25 CREATE TABLE t1(x int, y int);
26 INSERT INTO t1 VALUES(1,1);
27 INSERT INTO t1 VALUES(1,2);
28 INSERT INTO t1 VALUES(1,2);
29 INSERT INTO t1 VALUES(2,1);
30 INSERT INTO t1 VALUES(2,2);
31 INSERT INTO t1 VALUES(2,3);
33 UPDATE t1 SET x=1 ORDER BY y LIMIT 2 OFFSET 2;
34 UPDATE t1 SET x=2 WHERE y=1 ORDER BY y LIMIT 2 OFFSET 2;
35 DELETE FROM t1 WHERE x=1 ORDER BY y LIMIT 2 OFFSET 2;
36 DELETE FROM t1 ORDER BY y LIMIT 2 OFFSET 2;
42 do_malloc_test mallocJ-2 -sqlprep {
44 INSERT INTO t1 VALUES(1,2);
47 SELECT a, b, 'abc' FROM t1
49 SELECT b, a, 'xyz' FROM t1
54 do_malloc_test mallocJ-3 -sqlbody {
59 do_malloc_test mallocJ-4 -sqlprep {
60 CREATE TABLE t1(a,b,c);
61 CREATE TABLE t2(x,y,z);
63 SELECT * FROM (SELECT a,b FROM t1 UNION ALL SELECT x, y FROM t2) ORDER BY 1
67 do_malloc_test mallocJ-5 -sqlprep {
68 CREATE TABLE t1(["a"]);