]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add rowvalue5.test, which should have been part of the previous commit on this branch.
authordan <dan@noemail.net>
Tue, 9 Aug 2016 05:48:40 +0000 (05:48 +0000)
committerdan <dan@noemail.net>
Tue, 9 Aug 2016 05:48:40 +0000 (05:48 +0000)
FossilOrigin-Name: ea03e219ced87777f0c3c6bbb0274078dbb829e2

manifest
manifest.uuid
test/rowvalue5.test [new file with mode: 0644]

index b187cc2dd914ee763abef2dab2f27b3180432f48..db8399f339047bb65ee23bb7b76a5e84c0c2e3f7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\ssome\scases\sinvolving\srow\svalues\sand\svirtual\stables.
-D 2016-08-08T20:15:41.766
+C Add\srowvalue5.test,\swhich\sshould\shave\sbeen\spart\sof\sthe\sprevious\scommit\son\sthis\sbranch.
+D 2016-08-09T05:48:40.637
 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
@@ -1022,6 +1022,7 @@ F test/rowvalue.test 56b34d31d91340a6e922e753b798880170cc1aa7
 F test/rowvalue2.test 8d5dfe75b8f4d1868a2f91f0356f20d36cba64ff
 F test/rowvalue3.test dbe935260851b197dfbbbcb0ac2a15cb5f324fd4
 F test/rowvalue4.test 8d3b26c7ab26314b625cd2b113d782b011b91851
+F test/rowvalue5.test 01c7e0bc4048f30b58e6eb27ecd26e5bd312635e
 F test/rowvaluefault.test 7b16485e3f2b371f3e3d05455b8ded6d0c090244
 F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
 F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
@@ -1514,7 +1515,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P bb60651163553c5e46bf7b2805490570cea647b8
-R 874f48b6764b2a2fd58ccae5d488cbf6
+P 156a41f30a0afd9a70e6c26470dcc468a11bd402
+R c38c81cb8ebb8c1f60f796251d669e34
 U dan
-Z 25cd4c4731603d2ae10da74afc2be17b
+Z f2cc02b61092cf3b9735f66f5f90cbf0
index 0e8e885da4e22d90dfba7950cce103692270ce4f..293e4dd8a18ea876db93e61a281ad671aa19e2ad 100644 (file)
@@ -1 +1 @@
-156a41f30a0afd9a70e6c26470dcc468a11bd402
\ No newline at end of file
+ea03e219ced87777f0c3c6bbb0274078dbb829e2
\ No newline at end of file
diff --git a/test/rowvalue5.test b/test/rowvalue5.test
new file mode 100644 (file)
index 0000000..c961cf7
--- /dev/null
@@ -0,0 +1,113 @@
+# 2016 July 29
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.  The
+# focus of this file is syntax errors involving row-values and
+# virtual tables.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set ::testprefix rowvalue5
+
+proc vtab_command {method args} {
+  switch -- $method {
+    xConnect {
+      return "CREATE TABLE t1(a, b, c, d, expr)"
+    }
+
+    xBestIndex {
+      set COL(0) a
+      set COL(1) b
+      set COL(2) c
+      set COL(3) d
+      set COL(4) expr
+
+      set OP(eq) =
+      set OP(ne) !=
+      set OP(gt) >
+      set OP(le) <=
+      set OP(lt) <
+      set OP(ge) >=
+      set OP(match) MATCH
+      set OP(like) LIKE
+      set OP(glob) GLOB
+      set OP(regexp) REGEXP
+
+      set clist [lindex $args 0]
+      set ret [list]
+      set elist [list]
+      set i 0
+      foreach c $clist {
+        array set C $c
+        if {$C(usable)} {
+          lappend ret omit $i
+          lappend elist "$COL($C(column)) $OP($C(op)) %$i%"
+        }
+        incr i
+      }
+
+      lappend ret idxstr [join $elist " AND "]
+      #puts "xBestIndex: $ret"
+      return $ret
+    }
+
+    xFilter {
+      foreach {idxnum idxstr arglist} $args {}
+      set i 0
+      set ee $idxstr
+      foreach a $arglist {
+        if {[string is double $a]==0} {
+          set a "'[string map {' ''} $a]'"
+        }
+        set ee [string map [list "%$i%" $a] $ee]
+        incr i
+      }
+      set ee [string map [list "'" "''"] $ee]
+
+      set ret [list sql "SELECT 1, 'a', 'b', 'c', 'd', '$ee'"]
+      #puts "xFilter: $ret"
+      return $ret
+    }
+  }
+
+  return {}
+}
+
+register_tcl_module db
+do_execsql_test 1.0 {
+  CREATE VIRTUAL TABLE x1 USING tcl(vtab_command);
+} {}
+
+
+foreach {tn where res} {
+  1 "1"                              {{}}
+  2 "a=1"                            {{a = 1}}
+  3 "a=1 AND 4 = b"                  {{a = 1 AND b = 4}}
+  4 "c>'hello'"                      {{c > 'hello'}}
+  5 "c<='hel''lo'"                   {{c <= 'hel''lo'}}
+  6 "(a, b) = (SELECT 9, 10)"        {{a = 9 AND b = 10}}
+  7 "(+a, b) = (SELECT 'a', 'b')"    {{b = 'b'}}
+  8 "(a, +b) = (SELECT 'a', 'b')"    {{a = 'a'}}
+  10 "(a, b) IN (SELECT 9, 10 UNION SELECT 11, 12)" 
+      {{a = 9 AND b = 10} {a = 11 AND b = 12}}
+  11 "(+a, b) IN (SELECT 'a', 'b')" {{b = 'b'}}
+  12 "(a, +b) IN (SELECT 'a', 'b')" {{a = 'a'}}
+
+  13 "(a, b) < ('d', 'e')"  {{a <= 'd'}}
+  14 "(a, b) < ('a', 'c')"  {{a <= 'a'}}
+  15 "(a, b) <= ('a', 'b')" {{a <= 'a'}}
+  16 "(a, b) < ('a', 'b')"  {}
+} {
+  do_execsql_test 1.$tn "SELECT expr FROM x1 WHERE $where" $res
+}
+
+finish_test
+