Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/test/vtabI.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2015 Nov 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 # This file implements regression tests for SQLite library. Specifically,
12 # it tests the sqlite3_index_info.colUsed variable is set correctly.
13 #
14
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix vtabI
18
19 ifcapable !vtab {
20 finish_test
21 return
22 }
23
24 register_echo_module db
25
26 do_execsql_test 1.0 {
27 CREATE TABLE t1(a, b, c, d, e);
28 CREATE VIRTUAL TABLE e1 USING echo(t1);
29 }
30
31 foreach {tn query filter} {
32 1 {SELECT * FROM e1}
33 {SELECT rowid, a, b, c, d, e FROM 't1'}
34
35 2 {SELECT a, b FROM e1}
36 {SELECT rowid, a, b, NULL, NULL, NULL FROM 't1'}
37
38 3 {SELECT count(*) FROM e1 GROUP BY b}
39 {SELECT rowid, NULL, b, NULL, NULL, NULL FROM 't1'}
40
41 4 {SELECT count(*) FROM e1 GROUP BY b HAVING a=?}
42 {SELECT rowid, a, b, NULL, NULL, NULL FROM 't1'}
43
44 5 {SELECT a FROM e1 WHERE c=?}
45 {SELECT rowid, a, NULL, c, NULL, NULL FROM 't1'}
46
47 6 {SELECT a FROM e1 ORDER BY e}
48 {SELECT rowid, a, NULL, NULL, NULL, e FROM 't1'}
49
50 7 {SELECT a FROM e1 ORDER BY e, d}
51 {SELECT rowid, a, NULL, NULL, d, e FROM 't1'}
52 } {
53 do_test 1.$tn {
54 set ::echo_module [list]
55 execsql $query
56 set idx [lsearch -exact $::echo_module xFilter]
57 lindex $::echo_module [expr $idx+1]
58 } $filter
59 }
60
61 #-------------------------------------------------------------------------
62 # Tests with a table with more than 64 columns.
63 #
64 proc all_col_list {} {
65 set L [list]
66 for {set i 1} {$i <= 100} {incr i} { lappend L "c$i" }
67 set L
68 }
69
70 proc part_col_list {cols} {
71 set L [list]
72 for {set i 1} {$i <= 100} {incr i} {
73 set c "c$i"
74 if {[lsearch $cols $c]>=0} {
75 lappend L "c$i"
76 } else {
77 lappend L NULL
78 }
79 }
80 set L
81 }
82 proc CL {args} {
83 join [part_col_list $args] ", "
84 }
85 proc CLT {args} {
86 set cols $args
87 for {set i 64} {$i <= 100} {incr i} {
88 lappend cols "c$i"
89 }
90 join [part_col_list $cols] ", "
91 }
92
93 do_test 2.0 {
94 execsql "CREATE TABLE t2([join [all_col_list] ,])"
95 execsql "CREATE VIRTUAL TABLE e2 USING echo(t2)"
96 } {}
97
98 foreach {tn query filter} {
99 1 {SELECT c1, c10, c20 FROM e2}
100 {SELECT rowid, [CL c1 c10 c20] FROM 't2'}
101
102 2 {SELECT c40, c50, c60 FROM e2}
103 {SELECT rowid, [CL c40 c50 c60] FROM 't2'}
104
105 3 {SELECT c7, c80, c90 FROM e2}
106 {SELECT rowid, [CLT c7] FROM 't2'}
107
108 4 {SELECT c64 FROM e2}
109 {SELECT rowid, [CLT c64] FROM 't2'}
110
111 5 {SELECT c63 FROM e2}
112 {SELECT rowid, [CL c63] FROM 't2'}
113
114 6 {SELECT c22 FROM e2 ORDER BY c50, c70}
115 {SELECT rowid, [CLT c22 c50] FROM 't2'}
116
117 } {
118 do_test 2.$tn {
119 set ::echo_module [list]
120 execsql $query
121 set idx [lsearch -exact $::echo_module xFilter]
122 lindex $::echo_module [expr $idx+1]
123 } [subst $filter]
124 }
125
126 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/test/vtabH.test ('k') | third_party/sqlite/sqlite-src-3170000/test/vtab_alter.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698