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

Side by Side Diff: third_party/sqlite/src/test/fts3query.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
1 # 2009 December 20 1 # 2009 December 20
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 do_execsql_test 5.4.0 { UPDATE t2_content SET c0content = X'1234' } 166 do_execsql_test 5.4.0 { UPDATE t2_content SET c0content = X'1234' }
167 do_select_tests 5.4 -errorformat { 167 do_select_tests 5.4 -errorformat {
168 illegal first argument to %s 168 illegal first argument to %s
169 } { 169 } {
170 1 "SELECT matchinfo(content) FROM t2 WHERE t2 MATCH 'history'" matchinfo 170 1 "SELECT matchinfo(content) FROM t2 WHERE t2 MATCH 'history'" matchinfo
171 2 "SELECT offsets(content) FROM t2 WHERE t2 MATCH 'history'" offsets 171 2 "SELECT offsets(content) FROM t2 WHERE t2 MATCH 'history'" offsets
172 3 "SELECT snippet(content) FROM t2 WHERE t2 MATCH 'history'" snippet 172 3 "SELECT snippet(content) FROM t2 WHERE t2 MATCH 'history'" snippet
173 4 "SELECT optimize(content) FROM t2 WHERE t2 MATCH 'history'" optimize 173 4 "SELECT optimize(content) FROM t2 WHERE t2 MATCH 'history'" optimize
174 } 174 }
175 do_catchsql_test 5.5.1 { 175 do_catchsql_test 5.5.1 {
176 SELECT matchinfo(t2, 'abc') FROM t2 WHERE t2 MATCH 'history' 176 SELECT matchinfo(t2, 'abcd') FROM t2 WHERE t2 MATCH 'history'
177 } {1 {unrecognized matchinfo request: b}} 177 } {1 {unrecognized matchinfo request: d}}
178 178
179 do_execsql_test 5.5 { DROP TABLE t2 } 179 do_execsql_test 5.5 { DROP TABLE t2 }
180 180
181 181
182 # Test the snippet() function with 1 to 6 arguments. 182 # Test the snippet() function with 1 to 6 arguments.
183 # 183 #
184 do_execsql_test 6.1 { 184 do_execsql_test 6.1 {
185 CREATE VIRTUAL TABLE t3 USING FTS4(a, b); 185 CREATE VIRTUAL TABLE t3 USING FTS4(a, b);
186 INSERT INTO t3 VALUES('no gestures', 'another intriguing discovery by observin g the hand gestures (called beats) people make while speaking. Research has show n that such gestures do more than add visual emphasis to our words (many people gesture while they''re on the telephone, for example); it seems they actually he lp our brains find words'); 186 INSERT INTO t3 VALUES('no gestures', 'another intriguing discovery by observin g the hand gestures (called beats) people make while speaking. Research has show n that such gestures do more than add visual emphasis to our words (many people gesture while they''re on the telephone, for example); it seems they actually he lp our brains find words');
187 } 187 }
(...skipping 13 matching lines...) Expand all
201 5 "SELECT snippet(t3, 'XXX', 'YYY', 'ZZZ', 1) FROM t3 WHERE t3 MATCH 'gestures '" 201 5 "SELECT snippet(t3, 'XXX', 'YYY', 'ZZZ', 1) FROM t3 WHERE t3 MATCH 'gestures '"
202 {{ZZZhand XXXgesturesYYY (called beats) people make while speaking. Research h as shown that such XXXgesturesYYY doZZZ}} 202 {{ZZZhand XXXgesturesYYY (called beats) people make while speaking. Research h as shown that such XXXgesturesYYY doZZZ}}
203 203
204 6 "SELECT snippet(t3, 'XXX', 'YYY', 'ZZZ', 0) FROM t3 WHERE t3 MATCH 'gestures '" 204 6 "SELECT snippet(t3, 'XXX', 'YYY', 'ZZZ', 0) FROM t3 WHERE t3 MATCH 'gestures '"
205 {{no XXXgesturesYYY}} 205 {{no XXXgesturesYYY}}
206 206
207 7 "SELECT snippet(t3, 'XXX', 'YYY', 'ZZZ', 1, 5) FROM t3 WHERE t3 MATCH 'gestu res'" 207 7 "SELECT snippet(t3, 'XXX', 'YYY', 'ZZZ', 1, 5) FROM t3 WHERE t3 MATCH 'gestu res'"
208 {{ZZZthe hand XXXgesturesYYY (called beatsZZZ}} 208 {{ZZZthe hand XXXgesturesYYY (called beatsZZZ}}
209 } 209 }
210 210
211 # Test some range queries on the rowid field.
212 #
213 do_execsql_test 7.1 {
214 CREATE VIRTUAL TABLE ft4 USING fts4(x);
215 CREATE TABLE t4(x);
216 }
217
218 set SMALLINT -9223372036854775808
219 set LARGEINT 9223372036854775807
220 do_test 7.2 {
221 db transaction {
222 foreach {iFirst nEntry} [subst {
223 0 100
224 $SMALLINT 100
225 [expr $LARGEINT - 99] 100
226 }] {
227 for {set i 0} {$i < $nEntry} {incr i} {
228 set iRowid [expr $i + $iFirst]
229 execsql {
230 INSERT INTO ft4(rowid, x) VALUES($iRowid, 'x y z');
231 INSERT INTO t4(rowid, x) VALUES($iRowid, 'x y z');
232 }
233 }
234 }
235 }
236 } {}
237
238 foreach {tn iFirst iLast} [subst {
239 1 5 10
240 2 $SMALLINT [expr $SMALLINT+5]
241 3 $SMALLINT [expr $SMALLINT+50]
242 4 [expr $LARGEINT-5] $LARGEINT
243 5 $LARGEINT $LARGEINT
244 6 $SMALLINT $LARGEINT
245 7 $SMALLINT $SMALLINT
246 8 $LARGEINT $SMALLINT
247 }] {
248 set res [db eval {
249 SELECT rowid FROM t4 WHERE rowid BETWEEN $iFirst AND $iLast
250 } ]
251
252 do_execsql_test 7.2.$tn.1.[llength $res] {
253 SELECT rowid FROM ft4 WHERE rowid BETWEEN $iFirst AND $iLast
254 } $res
255 set res [db eval {
256 SELECT rowid FROM t4 WHERE rowid BETWEEN $iFirst AND $iLast
257 ORDER BY +rowid DESC
258 } ]
259 do_execsql_test 7.2.$tn.2.[llength $res] {
260 SELECT rowid FROM ft4 WHERE rowid BETWEEN $iFirst AND $iLast
261 ORDER BY rowid DESC
262 } $res
263 }
264
265 foreach ii [db eval {SELECT rowid FROM t4}] {
266 set res1 [db eval {SELECT rowid FROM t4 WHERE rowid > $ii}]
267 set res2 [db eval {SELECT rowid FROM t4 WHERE rowid < $ii}]
268 set res1s [db eval {SELECT rowid FROM t4 WHERE rowid > $ii ORDER BY +rowid DES C}]
269 set res2s [db eval {SELECT rowid FROM t4 WHERE rowid < $ii ORDER BY +rowid DES C}]
270
271 do_execsql_test 7.3.$ii.1 {
272 SELECT rowid FROM ft4 WHERE rowid > $ii
273 } $res1
274
275 do_execsql_test 7.3.$ii.2 {
276 SELECT rowid FROM ft4 WHERE rowid < $ii
277 } $res2
278
279 do_execsql_test 7.3.$ii.3 {
280 SELECT rowid FROM ft4 WHERE rowid > $ii ORDER BY rowid DESC
281 } $res1s
282
283 do_execsql_test 7.3.$ii.4 {
284 SELECT rowid FROM ft4 WHERE rowid < $ii ORDER BY rowid DESC
285 } $res2s
286 }
211 287
212 finish_test 288 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/fts3prefix.test ('k') | third_party/sqlite/src/test/fts3snippet.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698