Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/vtabL.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / vtabL.test` 75 lines ยท 1670 bytes Raw Blame History 1 # 2024-03-26 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 13 set testdir [file dirname $argv0] 14 source $testdir/tester.tcl 15 set testprefix vtabL 16 17 ifcapable !vtab { 18 finish_test 19 return 20 } 21 22 register_tcl_module db 23 24 proc vtab_command {method args} { 25 switch -- $method { 26 xConnect { 27 return $::create_table_sql 28 } 29 } 30 31 return {} 32 } 33 34 foreach {tn cts} { 35 1 {SELECT 123} 36 2 {SELECT 123, 456} 37 3 {INSERT INTO t1 VALUES(5, 6)} 38 4 {CREATE INDEX i1 ON t1(a)} 39 5 {CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN SELECT 1; END;} 40 6 {DROP TABLE nosuchtable} 41 7 {DROP TABLE x1} 42 8 {DROP TABLE t1} 43 } { 44 set ::create_table_sql $cts 45 do_catchsql_test 1.$tn { 46 CREATE VIRTUAL TABLE x1 USING tcl(vtab_command); 47 } {1 {declare_vtab: syntax error}} 48 } 49 50 foreach {tn cts} { 51 9 {CREATE TABLE xyz AS SELECT * FROM sqlite_schema} 52 10 {CREATE TABLE xyz AS SELECT 1 AS 'col'} 53 } { 54 set ::create_table_sql $cts 55 do_catchsql_test 1.$tn { 56 CREATE VIRTUAL TABLE x1 USING tcl(vtab_command); 57 } {1 {declare_vtab: SQL logic error}} 58 } 59 60 foreach {tn cts} { 61 1 {CREATE TABLE IF NOT EXISTS t1(a, b)} 62 2 {CREATE TABLE ""(a, b PRIMARY KEY) WITHOUT ROWID} 63 } { 64 set ::create_table_sql $cts 65 execsql { DROP TABLE IF EXISTS x1 } 66 do_execsql_test 2.$tn.1 { 67 CREATE VIRTUAL TABLE x1 USING tcl(vtab_command); 68 } 69 do_execsql_test 2.$tn.2 { 70 SELECT a, b FROM x1 71 } 72 } 73 74 finish_test 75