File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sqlite3 / test / mallocK.test
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 17:04:16 2012 UTC (12 years, 10 months ago) by misho
Branches: sqlite3, MAIN
CVS tags: v3_7_10, HEAD
sqlite3

    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.1.1 2012/02/21 17:04:16 misho Exp $
   15: 
   16: set testdir [file dirname $argv0]
   17: source $testdir/tester.tcl
   18: source $testdir/malloc_common.tcl
   19: 
   20: set sql {SELECT * FROM t1, t2 WHERE (a=1 OR a=2)}
   21: for {set x 1} {$x<5} {incr x} {
   22:   append sql " AND b=y"
   23:   do_malloc_test mallocK-1.$x -sqlbody $sql -sqlprep {
   24:     CREATE TABLE t1(a,b);
   25:     CREATE TABLE t2(x,y);
   26:   }
   27: }
   28: 
   29: set sql {SELECT * FROM t1 WHERE a GLOB 'xyz*' AND (a=1 OR a=2)}
   30: for {set x 1} {$x<5} {incr x} {
   31:   append sql " AND b!=$x"
   32:   do_malloc_test mallocK-2.$x -sqlbody $sql -sqlprep {
   33:     CREATE TABLE t1(a,b);
   34:   }
   35: }
   36: 
   37: set sql {SELECT * FROM t1 WHERE a BETWEEN 5 AND 10}
   38: for {set x 1} {$x<5} {incr x} {
   39:   append sql " AND b=$x"
   40:   do_malloc_test mallocK-3.$x -sqlbody $sql -sqlprep {
   41:     CREATE TABLE t1(a,b);
   42:   }
   43: }
   44: 
   45: set sql {SELECT * FROM t1 WHERE b=0}
   46: for {set x 1} {$x<5} {incr x} {
   47:   set term "(b=$x"
   48:   for {set y 0} {$y<$x} {incr y} {
   49:     append term " AND a!=$y"
   50:   }
   51:   append sql " OR $term)"
   52:   do_malloc_test mallocK-4.$x -sqlbody $sql -sqlprep {
   53:     CREATE TABLE t1(a,b);
   54:   }
   55: }
   56: 
   57: ifcapable vtab {
   58:   set sql {SELECT * FROM t2 WHERE a MATCH 'xyz'}
   59:   for {set x 1} {$x<5} {incr x} {
   60:     append sql " AND b!=$x"
   61:     do_malloc_test mallocK-5.$x -sqlbody $sql -tclprep {
   62:       register_echo_module [sqlite3_connection_pointer db]
   63:       db eval {
   64:         CREATE TABLE t1(a,b);
   65:         CREATE VIRTUAL TABLE t2 USING echo(t1);
   66:       }
   67:     }
   68:   }
   69: }
   70: 
   71: 
   72: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>