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 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is creating and dropping virtual tables.
14 # $Id: vtabD.test,v 1.3 2009/06/05 17:09:12 drh Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 ifcapable !vtab||!schema_pragmas { finish_test ; return }
21 # Register the echo module
22 register_echo_module [sqlite3_connection_pointer db]
26 CREATE TABLE t1(a, b);
27 CREATE INDEX i1 ON t1(a);
28 CREATE INDEX i2 ON t1(b);
29 CREATE VIRTUAL TABLE tv1 USING echo(t1);
34 for {set i 0} {$i < 100000} {incr i} {
35 execsql { INSERT INTO t1 VALUES($i, $i*$i) }
40 execsql { SELECT * FROM tv1 WHERE a = 1 OR b = 4 }
43 execsql { SELECT * FROM tv1 WHERE a = 1 OR b = 1 }
46 execsql { SELECT * FROM tv1 WHERE (a > 0 AND a < 5) OR (b > 15 AND b < 65) }
47 } {1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64}
50 execsql { SELECT * FROM tv1 WHERE a < 500 OR b = 810000 }
52 SELECT * FROM t1 WHERE a < 500;
53 SELECT * FROM t1 WHERE b = 810000 AND NOT (a < 500);
57 execsql { SELECT * FROM tv1 WHERE a < 90000 OR b = 8100000000 }
59 SELECT * FROM t1 WHERE a < 90000;
60 SELECT * FROM t1 WHERE b = 8100000000 AND NOT (a < 90000);
63 if {[working_64bit_int]} {
65 execsql { SELECT * FROM tv1 WHERE a = 90001 OR b = 810000 }
66 } {90001 8100180001 900 810000}