Fix a problem causing the recovery extension to use excessive memory and CPU time...
[sqlite.git] / test / vtabL.test
blob0834655ffd0c02ebe3b2a3cf9fe0d10c4c6f1cc2
1 # 2024-03-26
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
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 set testprefix vtabL
17 ifcapable !vtab {
18   finish_test
19   return
22 register_tcl_module db
24 proc vtab_command {method args} {
25   switch -- $method {
26     xConnect {
27       return $::create_table_sql
28     }
29   }
31   return {}
34 breakpoint
35 foreach {tn cts} {
36   1 {SELECT 123}
37   2 {SELECT 123, 456}
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}
42   7 {DROP TABLE x1}
43   8 {DROP TABLE t1}
44   9 {CREATE TABLE xyz AS SELECT * FROM sqlite_schema}
45   10 {CREATE TABLE xyz AS SELECT 1 AS 'col'}
46 } {
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}}
53 foreach {tn cts} {
54   1 {CREATE TABLE IF NOT EXISTS t1(a, b)}
55   2 {CREATE TABLE ""(a, b PRIMARY KEY) WITHOUT ROWID}
56 } {
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);
61   }
62   do_execsql_test 2.$tn.2 {
63     SELECT a, b FROM x1
64   }
67 finish_test