Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/skipscan5.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / skipscan5.test` 182 lines ยท 5488 bytes Raw Blame History 1 # 2013-11-13 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 # 12 # This file implements tests of the "skip-scan" query strategy. In 13 # particular it tests that stat4 data can be used by a range query 14 # that uses the skip-scan approach. 15 # 16 17 set testdir [file dirname $argv0] 18 source $testdir/tester.tcl 19 set testprefix skipscan5 20 21 ifcapable !stat4 { 22 finish_test 23 return 24 } 25 26 do_execsql_test 1.1 { 27 CREATE TABLE t1(a INT, b INT, c INT); 28 CREATE INDEX i1 ON t1(a, b); 29 } {} 30 31 expr srand(4) 32 do_test 1.2 { 33 for {set i 0} {$i < 1000} {incr i} { 34 set a [expr int(rand()*4.0) + 1] 35 set b [expr int(rand()*20.0) + 1] 36 execsql { INSERT INTO t1 VALUES($a, $b, NULL) } 37 } 38 execsql ANALYZE 39 } {} 40 41 foreach {tn q res} { 42 1 "b = 5" {/*ANY(a) AND b=?*/} 43 2 "b > 12 AND b < 16" {/*ANY(a) AND b>? AND b 2 AND b < 16" {/*SCAN t1*/} 45 4 "b > 18 AND b < 25" {/*ANY(a) AND b>? AND b 16" {/*ANY(a) AND b>?*/} 47 6 "b > 5" {/*SCAN t1*/} 48 7 "b < 15" {/*SCAN t1*/} 49 8 "b < 5" {/*ANY(a) AND b b" {/*ANY(a) AND b '12' AND b < '16'" {/*ANY(a) AND b>? AND b '2' AND b < '16'" {/*SCAN t1*/} 54 13 "b > '18' AND b < '25'" {/*ANY(a) AND b>? AND b '16'" {/*ANY(a) AND b>?*/} 56 15 "b > '5'" {/*SCAN t1*/} 57 16 "b < '15'" {/*SCAN t1*/} 58 17 "b < '5'" {/*ANY(a) AND b b" {/*ANY(a) AND b? AND c 'q' } {/*ANY(a) AND ANY(b) AND c>?*/} 109 4 { c > 'e' } {/*SCAN t2*/} 110 5 { c < 'q' } {/*SCAN t2*/} 111 6 { c < 'b' } {/*ANY(a) AND ANY(b) AND c? AND b X'5555'" {/*ANY(a) AND b>?*/} 175 5 "b > 'zzz'" {/*ANY(a) AND b>?*/} 176 6 "b < 'zzz'" {/*SCAN t3*/} 177 } { 178 set sql "EXPLAIN QUERY PLAN SELECT * FROM t3 WHERE $q" 179 do_execsql_test 3.3.$tn $sql $res 180 } 181 182 finish_test