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

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

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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 # 2010 September 24 1 # 2010 September 24
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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 e_select-2.1.2 { CREATE INDEX i1 ON t1(a) } 337 e_select-2.1.2 { CREATE INDEX i1 ON t1(a) }
338 e_select-2.1.3 { CREATE INDEX i1 ON t2(a) } 338 e_select-2.1.3 { CREATE INDEX i1 ON t2(a) }
339 e_select-2.1.4 { CREATE INDEX i1 ON t3(b) } 339 e_select-2.1.4 { CREATE INDEX i1 ON t3(b) }
340 } { 340 } {
341 341
342 catchsql { DROP INDEX i1 } 342 catchsql { DROP INDEX i1 }
343 catchsql { DROP INDEX i2 } 343 catchsql { DROP INDEX i2 }
344 catchsql { DROP INDEX i3 } 344 catchsql { DROP INDEX i3 }
345 execsql $indexes 345 execsql $indexes
346 346
347 # EVIDENCE-OF: R-46122-14930 If the join-op is "CROSS JOIN", "INNER 347 # EVIDENCE-OF: R-49872-03192 If the join-operator is "CROSS JOIN",
348 # JOIN", "JOIN" or a comma (",") and there is no ON or USING clause, 348 # "INNER JOIN", "JOIN" or a comma (",") and there is no ON or USING
349 # then the result of the join is simply the cartesian product of the 349 # clause, then the result of the join is simply the cartesian product of
350 # left and right-hand datasets. 350 # the left and right-hand datasets.
351 # 351 #
352 # EVIDENCE-OF: R-46256-57243 There is no difference between the "INNER 352 # EVIDENCE-OF: R-46256-57243 There is no difference between the "INNER
353 # JOIN", "JOIN" and "," join operators. 353 # JOIN", "JOIN" and "," join operators.
354 # 354 #
355 # EVIDENCE-OF: R-07544-24155 The "CROSS JOIN" join operator produces the 355 # EVIDENCE-OF: R-25071-21202 The "CROSS JOIN" join operator produces the
356 # same data as the "INNER JOIN", "JOIN" and "," operators 356 # same result as the "INNER JOIN", "JOIN" and "," operators
357 # 357 #
358 test_join $tn.1.1 "t1, t2" {t1 t2} 358 test_join $tn.1.1 "t1, t2" {t1 t2}
359 test_join $tn.1.2 "t1 INNER JOIN t2" {t1 t2} 359 test_join $tn.1.2 "t1 INNER JOIN t2" {t1 t2}
360 test_join $tn.1.3 "t1 CROSS JOIN t2" {t1 t2} 360 test_join $tn.1.3 "t1 CROSS JOIN t2" {t1 t2}
361 test_join $tn.1.4 "t1 JOIN t2" {t1 t2} 361 test_join $tn.1.4 "t1 JOIN t2" {t1 t2}
362 test_join $tn.1.5 "t2, t3" {t2 t3} 362 test_join $tn.1.5 "t2, t3" {t2 t3}
363 test_join $tn.1.6 "t2 INNER JOIN t3" {t2 t3} 363 test_join $tn.1.6 "t2 INNER JOIN t3" {t2 t3}
364 test_join $tn.1.7 "t2 CROSS JOIN t3" {t2 t3} 364 test_join $tn.1.7 "t2 CROSS JOIN t3" {t2 t3}
365 test_join $tn.1.8 "t2 JOIN t3" {t2 t3} 365 test_join $tn.1.8 "t2 JOIN t3" {t2 t3}
366 test_join $tn.1.9 "t2, t2 AS x" {t2 t2} 366 test_join $tn.1.9 "t2, t2 AS x" {t2 t2}
367 test_join $tn.1.10 "t2 INNER JOIN t2 AS x" {t2 t2} 367 test_join $tn.1.10 "t2 INNER JOIN t2 AS x" {t2 t2}
368 test_join $tn.1.11 "t2 CROSS JOIN t2 AS x" {t2 t2} 368 test_join $tn.1.11 "t2 CROSS JOIN t2 AS x" {t2 t2}
369 test_join $tn.1.12 "t2 JOIN t2 AS x" {t2 t2} 369 test_join $tn.1.12 "t2 JOIN t2 AS x" {t2 t2}
370 370
371 # EVIDENCE-OF: R-22775-56496 If there is an ON clause specified, then 371 # EVIDENCE-OF: R-38465-03616 If there is an ON clause then the ON
372 # the ON expression is evaluated for each row of the cartesian product 372 # expression is evaluated for each row of the cartesian product as a
373 # as a boolean expression. All rows for which the expression evaluates 373 # boolean expression. Only rows for which the expression evaluates to
374 # to false are excluded from the dataset. 374 # true are included from the dataset.
375 # 375 #
376 test_join $tn.2.1 "t1, t2 ON (t1.a=t2.a)" {t1 t2 -on {te_equals a a}} 376 test_join $tn.2.1 "t1, t2 ON (t1.a=t2.a)" {t1 t2 -on {te_equals a a}}
377 test_join $tn.2.2 "t2, t1 ON (t1.a=t2.a)" {t2 t1 -on {te_equals a a}} 377 test_join $tn.2.2 "t2, t1 ON (t1.a=t2.a)" {t2 t1 -on {te_equals a a}}
378 test_join $tn.2.3 "t2, t1 ON (1)" {t2 t1 -on te_true} 378 test_join $tn.2.3 "t2, t1 ON (1)" {t2 t1 -on te_true}
379 test_join $tn.2.4 "t2, t1 ON (NULL)" {t2 t1 -on te_false} 379 test_join $tn.2.4 "t2, t1 ON (NULL)" {t2 t1 -on te_false}
380 test_join $tn.2.5 "t2, t1 ON (1.1-1.1)" {t2 t1 -on te_false} 380 test_join $tn.2.5 "t2, t1 ON (1.1-1.1)" {t2 t1 -on te_false}
381 test_join $tn.2.6 "t1, t2 ON (1.1-1.0)" {t1 t2 -on te_true} 381 test_join $tn.2.6 "t1, t2 ON (1.1-1.0)" {t1 t2 -on te_true}
382 382
383 383
384 test_join $tn.3 "t1 LEFT JOIN t2 ON (t1.a=t2.a)" {t1 t2 -left -on {te_equals a a}} 384 test_join $tn.3 "t1 LEFT JOIN t2 ON (t1.a=t2.a)" {t1 t2 -left -on {te_equals a a}}
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 do_execsql_test e_select-2.2.0 { 498 do_execsql_test e_select-2.2.0 {
499 CREATE TABLE t4(x TEXT COLLATE nocase); 499 CREATE TABLE t4(x TEXT COLLATE nocase);
500 CREATE TABLE t5(y INTEGER, z TEXT COLLATE binary); 500 CREATE TABLE t5(y INTEGER, z TEXT COLLATE binary);
501 501
502 INSERT INTO t4 VALUES('2.0'); 502 INSERT INTO t4 VALUES('2.0');
503 INSERT INTO t4 VALUES('TWO'); 503 INSERT INTO t4 VALUES('TWO');
504 INSERT INTO t5 VALUES(2, 'two'); 504 INSERT INTO t5 VALUES(2, 'two');
505 } {} 505 } {}
506 506
507 # EVIDENCE-OF: R-55824-40976 A sub-select specified in the join-source 507 # EVIDENCE-OF: R-59237-46742 A subquery specified in the
508 # following the FROM clause in a simple SELECT statement is handled as 508 # table-or-subquery following the FROM clause in a simple SELECT
509 # if it was a table containing the data returned by executing the 509 # statement is handled as if it was a table containing the data returned
510 # sub-select statement. 510 # by executing the subquery statement.
511 # 511 #
512 # EVIDENCE-OF: R-42612-06757 Each column of the sub-select dataset 512 # EVIDENCE-OF: R-27438-53558 Each column of the subquery has the
513 # inherits the collation sequence and affinity of the corresponding 513 # collation sequence and affinity of the corresponding expression in the
514 # expression in the sub-select statement. 514 # subquery statement.
515 # 515 #
516 foreach {tn subselect select spec} { 516 foreach {tn subselect select spec} {
517 1 "SELECT * FROM t2" "SELECT * FROM t1 JOIN %ss%" 517 1 "SELECT * FROM t2" "SELECT * FROM t1 JOIN %ss%"
518 {t1 %ss%} 518 {t1 %ss%}
519 519
520 2 "SELECT * FROM t2" "SELECT * FROM t1 JOIN %ss% AS x ON (t1.a=x.a)" 520 2 "SELECT * FROM t2" "SELECT * FROM t1 JOIN %ss% AS x ON (t1.a=x.a)"
521 {t1 %ss% -on {te_equals 0 0}} 521 {t1 %ss% -on {te_equals 0 0}}
522 522
523 3 "SELECT * FROM t2" "SELECT * FROM %ss% AS x JOIN t1 ON (t1.a=x.a)" 523 3 "SELECT * FROM t2" "SELECT * FROM %ss% AS x JOIN t1 ON (t1.a=x.a)"
524 {%ss% t1 -on {te_equals 0 0}} 524 {%ss% t1 -on {te_equals 0 0}}
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 571
572 # Check that the actual data returned by the $select query is the same 572 # Check that the actual data returned by the $select query is the same
573 # as the expected data calculated using [te_tbljoin] above. 573 # as the expected data calculated using [te_tbljoin] above.
574 # 574 #
575 te_dataset_eq_unordered e_select-2.2.1.$tn [ 575 te_dataset_eq_unordered e_select-2.2.1.$tn [
576 te_read_sql db [string map [list %ss% "($subselect)"] $select] 576 te_read_sql db [string map [list %ss% "($subselect)"] $select]
577 ] $te 577 ] $te
578 } 578 }
579 579
580 finish_test 580 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698