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

Side by Side Diff: third_party/sqlite/src/ext/rtree/rtreeC.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 # 2011 March 2 1 # 2011 March 2
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 do_test 6.3 { 263 do_test 6.3 {
264 sqlite3 db2 test.db 264 sqlite3 db2 test.db
265 db2 eval { DROP TABLE sqlite_stat1 } 265 db2 eval { DROP TABLE sqlite_stat1 }
266 db2 close 266 db2 close
267 execsql { SELECT * FROM rt } 267 execsql { SELECT * FROM rt }
268 } {1 2.0 3.0} 268 } {1 2.0 3.0}
269 db close 269 db close
270 } 270 }
271 271
272 #--------------------------------------------------------------------
273 # Test that queries featuring LEFT or CROSS JOINS are handled correctly.
274 # Handled correctly in this case means:
275 #
276 # * Terms with prereqs that appear to the left of a LEFT JOIN against
277 # the virtual table are always available to xBestIndex.
278 #
279 # * Terms with prereqs that appear to the right of a LEFT JOIN against
280 # the virtual table are never available to xBestIndex.
281 #
282 # And the same behaviour for CROSS joins.
283 #
284 reset_db
285 do_execsql_test 7.0 {
286 CREATE TABLE xdir(x1);
287 CREATE TABLE ydir(y1);
288 CREATE VIRTUAL TABLE rt USING rtree_i32(id, xmin, xmax, ymin, ymax);
289
290 INSERT INTO xdir VALUES(5);
291 INSERT INTO ydir VALUES(10);
292
293 INSERT INTO rt VALUES(1, 2, 7, 12, 14); -- Not a hit
294 INSERT INTO rt VALUES(2, 2, 7, 8, 12); -- A hit!
295 INSERT INTO rt VALUES(3, 7, 11, 8, 12); -- Not a hit!
296 INSERT INTO rt VALUES(4, 5, 5, 10, 10); -- A hit!
297
298 }
299
300 proc do_eqp_execsql_test {tn sql res} {
301 set query "EXPLAIN QUERY PLAN $sql ; $sql "
302 uplevel [list do_execsql_test $tn $query $res]
303 }
304
305 do_eqp_execsql_test 7.1 {
306 SELECT id FROM xdir, rt, ydir
307 ON (y1 BETWEEN ymin AND ymax)
308 WHERE (x1 BETWEEN xmin AND xmax);
309 } {
310 0 0 0 {SCAN TABLE xdir}
311 0 1 2 {SCAN TABLE ydir}
312 0 2 1 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B2D3B0D1}
313 2 4
314 }
315
316 do_eqp_execsql_test 7.2 {
317 SELECT * FROM xdir, rt LEFT JOIN ydir
318 ON (y1 BETWEEN ymin AND ymax)
319 WHERE (x1 BETWEEN xmin AND xmax);
320 } {
321 0 0 0 {SCAN TABLE xdir}
322 0 1 1 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
323 0 2 2 {SCAN TABLE ydir}
324
325 5 1 2 7 12 14 {}
326 5 2 2 7 8 12 10
327 5 4 5 5 10 10 10
328 }
329
330 do_eqp_execsql_test 7.3 {
331 SELECT id FROM xdir, rt CROSS JOIN ydir
332 ON (y1 BETWEEN ymin AND ymax)
333 WHERE (x1 BETWEEN xmin AND xmax);
334 } {
335 0 0 0 {SCAN TABLE xdir}
336 0 1 1 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
337 0 2 2 {SCAN TABLE ydir}
338 2 4
339 }
340
341 do_eqp_execsql_test 7.4 {
342 SELECT id FROM rt, xdir CROSS JOIN ydir
343 ON (y1 BETWEEN ymin AND ymax)
344 WHERE (x1 BETWEEN xmin AND xmax);
345 } {
346 0 0 1 {SCAN TABLE xdir}
347 0 1 0 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
348 0 2 2 {SCAN TABLE ydir}
349 2 4
350 }
272 351
273 finish_test 352 finish_test
353
354
355
356 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/ext/rtree/rtree9.test ('k') | third_party/sqlite/src/ext/rtree/rtreeE.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698