interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / fts5 / test / fts5join.test

78 lines · 1947 bytes Raw Blame History
1# 2014 June 17
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 script is testing the FTS5 module.
13#
14
15source [file join [file dirname [info script]] fts5_common.tcl]
16set testprefix fts5join
17
18# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
19ifcapable !fts5 {
20 finish_test
21 return
22}
23
24do_execsql_test 1.0 {
25 CREATE VIRTUAL TABLE vt USING fts5(x);
26 INSERT INTO vt VALUES('abc');
27 INSERT INTO vt VALUES('xyz');
28
29 CREATE TABLE t1(a INTEGER PRIMARY KEY, b TIMESTAMP);
30 INSERT INTO t1 VALUES(1, 1), (2, 2);
31 CREATE INDEX i1 ON t1(b);
32}
33
34# set sqlite_where_trace [expr 0xFFF]
35
36do_eqp_test 1.1 {
37 SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid ORDER BY t1.rowid;
38} {
39 QUERY PLAN
40 |--SCAN t1
41 `--SCAN vt VIRTUAL TABLE INDEX 0:=
42}
43
44do_eqp_test 1.2 {
45 SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid AND b>? ORDER BY b LIMIT 10
46} {
47 QUERY PLAN
48 |--SEARCH t1 USING COVERING INDEX i1 (b>?)
49 `--SCAN vt VIRTUAL TABLE INDEX 0:=
50}
51
52do_eqp_test 1.3 {
53 SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid AND b>?
54} {
55 QUERY PLAN
56 |--SEARCH t1 USING COVERING INDEX i1 (b>?)
57 `--SCAN vt VIRTUAL TABLE INDEX 0:=
58}
59
60do_eqp_test 1.4 {
61 SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid ORDER BY b
62} {
63 QUERY PLAN
64 |--SCAN t1 USING COVERING INDEX i1
65 `--SCAN vt VIRTUAL TABLE INDEX 0:=
66}
67
68do_eqp_test 1.5 {
69 SELECT * FROM vt, t1
70 WHERE vt.rowid = t1.rowid AND vt MATCH ? AND b = ?
71} {
72 QUERY PLAN
73 |--SCAN vt VIRTUAL TABLE INDEX 0:M1
74 `--SEARCH t1 USING INTEGER PRIMARY KEY (rowid=?)
75}
76
77
78finish_test