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 #***********************************************************************
12 # Test cases for CSV virtual table.
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
18 ifcapable !vtab||!cte { finish_test ; return }
20 load_static_extension db csv
23 CREATE VIRTUAL TABLE temp.t1 USING csv(
32 SELECT * FROM t1 WHERE c1=10;
35 SELECT * FROM t1 WHERE c1='10';
43 CREATE VIRTUAL TABLE temp.t2 USING csv(
51 schema='CREATE TABLE t2(a INT, b TEXT, c REAL, d BLOB)'
53 SELECT * FROM t2 WHERE a=9;
56 SELECT * FROM t2 WHERE b=10;
59 SELECT * FROM t2 WHERE c=11;
62 SELECT * FROM t2 WHERE d=12;
65 SELECT * FROM t2 WHERE d='12';
68 SELECT * FROM t2 WHERE a='9';
73 CREATE VIRTUAL TABLE temp.t3 USING csv(
82 'CREATE TABLE t3(a PRIMARY KEY,b TEXT,c TEXT,d TEXT) WITHOUT ROWID',
85 SELECT a FROM t3 WHERE b=6 OR c=7 OR d=12 ORDER BY +a;
88 SELECT a FROM t3 WHERE +b=6 OR c=7 OR d=12 ORDER BY +a;
91 # The rowid column is not visible on a WITHOUT ROWID virtual table
92 do_catchsql_test 3.2 {
93 SELECT rowid, a FROM t3;
94 } {1 {no such column: rowid}}
96 do_catchsql_test 4.0 {
98 CREATE VIRTUAL TABLE temp.t4 USING csv_wr(
107 'CREATE TABLE t3(a PRIMARY KEY,b TEXT,c TEXT,d TEXT) WITHOUT ROWID',
110 } {1 {vtable constructor failed: t4}}