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 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 set testprefix bestindex7
22 register_tcl_module db
24 proc vtab_command {src method args} {
27 return "CREATE TABLE xxx(a)"
31 set hdl [lindex $args 0]
32 set clist [$hdl constraints]
33 set orderby [$hdl orderby]
39 catch { array unset C }
42 lappend ret use $iCons
50 return [list sql "SELECT rowid, x FROM $src"]
60 INSERT INTO t1 VALUES(0), (2);
61 CREATE VIRTUAL TABLE vt1 USING tcl(vtab_command t1);
64 do_execsql_test 1.1 { select * from vt1 } {0 2}
65 do_execsql_test 1.2 { select * from vt1 WHERE a=0 } {0}
66 do_execsql_test 1.3 { select * from vt1 WHERE a=1 } {}
67 do_execsql_test 1.4 { select * from vt1 WHERE a=1 OR a=0} {0}
70 UPDATE t1 SET x=NULL WHERE x=2;
73 do_execsql_test 1.6 { select * from vt1 } {0 {}}
74 do_execsql_test 1.7 { select * from vt1 WHERE a=0 } {0}
75 do_execsql_test 1.8 { select * from vt1 WHERE a=1 } {}
76 do_execsql_test 1.9 { select * from vt1 WHERE a=1 OR a=0} {0}
77 do_execsql_test 1.10 { select * from vt1 WHERE a IN (2) } {}
78 do_execsql_test 1.10 { select * from vt1 WHERE a IN (0,1,2,3) } {0}
79 do_execsql_test 1.11 { select * from vt1 WHERE a IN (0, NULL) } {0}
80 do_execsql_test 1.12 { select * from vt1 WHERE a IN (NULL) } {}