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.
13 # $Id: vtab2.test,v 1.9 2008/10/13 10:37:50 danielk1977 Exp $
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
18 ifcapable !vtab||!schema_pragmas {
23 register_schema_module [sqlite3_connection_pointer db]
26 CREATE VIRTUAL TABLE schema USING schema;
30 main schema 0 database {} 0 {} 0 \
31 main schema 1 tablename {} 0 {} 0 \
32 main schema 2 cid {} 0 {} 0 \
33 main schema 3 name {} 0 {} 0 \
34 main schema 4 type {} 0 {} 0 \
35 main schema 5 not_null {} 0 {} 0 \
36 main schema 6 dflt_value {} 0 {} 0 \
37 main schema 7 pk {} 0 {} 0 \
44 SELECT length(tablename) FROM schema GROUP by tablename;
49 SELECT tablename FROM schema GROUP by length(tablename);
54 SELECT length(tablename) FROM schema GROUP by length(tablename);
58 register_tclvar_module [sqlite3_connection_pointer db]
62 CREATE VIRTUAL TABLE vars USING tclvar;
63 SELECT * FROM vars WHERE name='abc';
71 SELECT * FROM vars WHERE name='A';
73 } [list A 1 1 A 2 4 A 3 9]
74 unset -nocomplain result
77 foreach var [lsort [info vars tcl_*]] {
78 catch {lappend result $var [set $var]}
82 SELECT name, value FROM vars
83 WHERE name MATCH 'tcl_*' AND arrayname = ''
92 # Make sure we do call Column(), and Rowid() methods of
93 # a virtual table when that table is in a LEFT JOIN.
97 SELECT * FROM schema WHERE dflt_value IS NULL LIMIT 1
99 } {main schema 0 database {} 0 {} 0}
103 FROM schema a LEFT JOIN schema b ON a.dflt_value=b.dflt_value
106 } {main schema 0 database {} 0 {} 0 {} {} {} {} {} {} {} {} {}}
111 CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, UNIQUE(b, c));
116 INSERT INTO "fkey" VALUES('t1',NULL);
121 execsql { CREATE VIRTUAL TABLE v_col USING schema }
124 execsql { SELECT name FROM v_col WHERE tablename = 't1' AND pk }
129 SET to_col = (SELECT name FROM v_col WHERE tablename = 't1' AND pk);
133 execsql { SELECT * FROM fkey }