gitlab.com/CoiaPrant/sqlite3@v1.19.1/testdata/tcl/view2.test (about) 1 # 2021 May 20 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 # This file implements regression tests for SQLite library. The 12 # focus of this file is testing VIEW statements. 13 # 14 # $Id: view.test,v 1.39 2008/12/14 14:45:21 danielk1977 Exp $ 15 set testdir [file dirname $argv0] 16 source $testdir/tester.tcl 17 18 # Omit this entire file if the library is not configured with views enabled. 19 ifcapable !view { 20 finish_test 21 return 22 } 23 set testprefix view2 24 25 do_execsql_test 1.0 { 26 CREATE TABLE t1(x, y); 27 INSERT INTO t1 VALUES(1, 2); 28 CREATE VIEW v1 AS SELECT * FROM ( 29 WITH x1 AS (SELECT y, x FROM t1) 30 SELECT * FROM x1 31 ); 32 } 33 34 do_execsql_test 1.1 { 35 SELECT * FROM v1 36 } {2 1} 37 38 do_execsql_test 1.2 { 39 CREATE VIEW v3 AS SELECT * FROM main.t1; 40 WITH t1(a, b) AS ( SELECT 3, 4 ) SELECT * FROM v3; 41 } {1 2} 42 43 breakpoint 44 do_execsql_test 1.3 { 45 CREATE VIEW v2 AS SELECT * FROM t1; 46 WITH t1(a, b) AS ( SELECT 3, 4 ) SELECT * FROM v2; 47 } {1 2} 48 49 finish_test