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
22 register_tcl_module db
24 proc vtab_command {method args} {
27 return $::create_table_sql
38 3 {INSERT INTO t1 VALUES(5, 6)}
39 4 {CREATE INDEX i1 ON t1(a)}
40 5 {CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN SELECT 1; END;}
41 6 {DROP TABLE nosuchtable}
44 9 {CREATE TABLE xyz AS SELECT * FROM sqlite_schema}
45 10 {CREATE TABLE xyz AS SELECT 1 AS 'col'}
47 set ::create_table_sql $cts
48 do_catchsql_test 1.$tn {
49 CREATE VIRTUAL TABLE x1 USING tcl(vtab_command);
50 } {1 {vtable constructor failed: x1}}
54 1 {CREATE TABLE IF NOT EXISTS t1(a, b)}
55 2 {CREATE TABLE ""(a, b PRIMARY KEY) WITHOUT ROWID}
57 set ::create_table_sql $cts
58 execsql { DROP TABLE IF EXISTS x1 }
59 do_execsql_test 2.$tn.1 {
60 CREATE VIRTUAL TABLE x1 USING tcl(vtab_command);
62 do_execsql_test 2.$tn.2 {