1# 2008 August 01 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# 12# This test script checks malloc failures in WHERE clause analysis. 13# 14# $Id: mallocK.test,v 1.1 2009/01/07 20:58:57 drh Exp $ 15 16set testdir [file dirname $argv0] 17source $testdir/tester.tcl 18source $testdir/malloc_common.tcl 19 20 21set sql {SELECT * FROM t1, t2 WHERE (a=1 OR a=2)} 22for {set x 1} {$x<5} {incr x} { 23 append sql " AND b=y" 24 do_malloc_test mallocK-1.$x -sqlbody $sql -sqlprep { 25 CREATE TABLE t1(a,b); 26 CREATE TABLE t2(x,y); 27 } 28} 29 30set sql {SELECT * FROM t1 WHERE a LIKE 'abc%'} 31for {set x 1} {$x<5} {incr x} { 32 append sql " AND b!=$x" 33 do_malloc_test mallocK-2.$x -sqlbody $sql -sqlprep { 34 CREATE TABLE t1(a,b); 35 } 36} 37 38set sql {SELECT * FROM t1 WHERE a BETWEEN 5 AND 10} 39for {set x 1} {$x<5} {incr x} { 40 append sql " AND b!=$x" 41 do_malloc_test mallocK-3.$x -sqlbody $sql -sqlprep { 42 CREATE TABLE t1(a,b); 43 } 44} 45 46ifcapable vtab { 47 set sql {SELECT * FROM t2 WHERE a MATCH 'xyz'} 48 for {set x 1} {$x<5} {incr x} { 49 append sql " AND b!=$x" 50 do_malloc_test mallocK-4.$x -sqlbody $sql -tclprep { 51 register_echo_module [sqlite3_connection_pointer db] 52 db eval { 53 CREATE TABLE t1(a,b); 54 CREATE VIRTUAL TABLE t2 USING echo(t1); 55 } 56 } 57 } 58} 59 60 61finish_test 62