modernc.org/cc@v1.0.1/v2/testdata/_sqlite/ext/fts5/test/fts5plan.test (about) 1 # 2014 Dec 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 # 12 # This file focuses on testing the planner (xBestIndex function). 13 # 14 15 source [file join [file dirname [info script]] fts5_common.tcl] 16 set testprefix fts5plan 17 18 # If SQLITE_ENABLE_FTS5 is defined, omit this file. 19 ifcapable !fts5 { 20 finish_test 21 return 22 } 23 24 do_execsql_test 1.0 { 25 CREATE TABLE t1(x, y); 26 CREATE VIRTUAL TABLE f1 USING fts5(ff); 27 } 28 29 do_eqp_test 1.1 { 30 SELECT * FROM t1, f1 WHERE f1 MATCH t1.x 31 } { 32 0 0 0 {SCAN TABLE t1} 33 0 1 1 {SCAN TABLE f1 VIRTUAL TABLE INDEX 65537:} 34 } 35 36 do_eqp_test 1.2 { 37 SELECT * FROM t1, f1 WHERE f1 > t1.x 38 } { 39 0 0 1 {SCAN TABLE f1 VIRTUAL TABLE INDEX 0:} 40 0 1 0 {SCAN TABLE t1} 41 } 42 43 do_eqp_test 1.3 { 44 SELECT * FROM f1 WHERE f1 MATCH ? ORDER BY ff 45 } { 46 0 0 0 {SCAN TABLE f1 VIRTUAL TABLE INDEX 65537:} 47 0 0 0 {USE TEMP B-TREE FOR ORDER BY} 48 } 49 50 do_eqp_test 1.4 { 51 SELECT * FROM f1 ORDER BY rank 52 } { 53 0 0 0 {SCAN TABLE f1 VIRTUAL TABLE INDEX 0:} 54 0 0 0 {USE TEMP B-TREE FOR ORDER BY} 55 } 56 57 do_eqp_test 1.5 { 58 SELECT * FROM f1 WHERE rank MATCH ? 59 } { 60 0 0 0 {SCAN TABLE f1 VIRTUAL TABLE INDEX 2:} 61 } 62 63 64 65 66 finish_test