From: dan Date: Thu, 9 Sep 2010 11:33:09 +0000 (+0000) Subject: Add WHERE clause tests to e_select.test. X-Git-Tag: experimental~54 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7413847759303cbfac00e016efa7c737ffe1e03a;p=thirdparty%2Fsqlite.git Add WHERE clause tests to e_select.test. FossilOrigin-Name: 721b73fa5c5898f6c6d5946e1c70ccd2d0b0dccc --- diff --git a/manifest b/manifest index 3b7d5d3d90..9a37503d1f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stests\sfor\ssub-select\sstatements\sin\sthe\sFROM\sclause\sof\sa\sSELECT\sto\se_select.test. -D 2010-09-09T10:00:44 +C Add\sWHERE\sclause\stests\sto\se_select.test. +D 2010-09-09T11:33:09 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -350,7 +350,7 @@ F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376 F test/e_expr.test 164e87c1d7b40ceb47c57c3bffa384c81d009aa7 F test/e_fkey.test 6721a741c6499b3ab7e5385923233343c8f1ad05 F test/e_fts3.test 75bb0aee26384ef586165e21018a17f7cd843469 -F test/e_select.test 1adce7a2fcb698518eedddf3bc729c039e6bbedd +F test/e_select.test a3f2bc8bf21f189bec90008d883ae86448d291c9 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398 F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041 @@ -857,7 +857,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 8fe34faf6b8ddbb8ddd23418163650e846104328 -R 9bfaedbd899efa5c6570049f959ec78c +P 2c6b1ca952be9979b8079431c2abad28419b6256 +R b6f7deab8c7be4f26ac3335bb0b04fd4 U dan -Z 71f159ae174766adb4ac41d95f0a3515 +Z 4c41231d0dc68008d74e0f7cc7244851 diff --git a/manifest.uuid b/manifest.uuid index 9a637f466d..893a4cffbe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2c6b1ca952be9979b8079431c2abad28419b6256 \ No newline at end of file +721b73fa5c5898f6c6d5946e1c70ccd2d0b0dccc \ No newline at end of file diff --git a/test/e_select.test b/test/e_select.test index 0cac077464..6b91fb1f93 100644 --- a/test/e_select.test +++ b/test/e_select.test @@ -1080,5 +1080,56 @@ foreach {tn subselect select spec} { ] $te } +#------------------------------------------------------------------------- +# The next block of tests - e_select-3.* - concentrate on verifying +# statements made regarding WHERE clause processing. +# +drop_all_tables +do_execsql_test e_select-3.0 { + CREATE TABLE x1(k, x, y, z); + INSERT INTO x1 VALUES(1, 'relinquished', 'aphasia', 78.43); + INSERT INTO x1 VALUES(2, X'A8E8D66F', X'07CF', -81); + INSERT INTO x1 VALUES(3, -22, -27.57, NULL); + INSERT INTO x1 VALUES(4, NULL, 'bygone', 'picky'); + INSERT INTO x1 VALUES(5, NULL, 96.28, NULL); + INSERT INTO x1 VALUES(6, 0, 1, 2); + + CREATE TABLE x2(k, x, y2); + INSERT INTO x2 VALUES(1, 50, X'B82838'); + INSERT INTO x2 VALUES(5, 84.79, 65.88); + INSERT INTO x2 VALUES(3, -22, X'0E1BE452A393'); + INSERT INTO x2 VALUES(7, 'mistrusted', 'standardized'); +} {} + +# EVIDENCE-OF: R-22873-49686 If a WHERE clause is specified, the WHERE +# expression is evaluated for each row in the input data and the result +# cast to a numeric value. All rows for which the WHERE clause +# expression evaluates to a NULL value or to zero (integer value 0 or +# real value 0.0) are excluded from the dataset before continuing. +# +do_execsql_test e_select-3.1.1 { SELECT k FROM x1 WHERE x } {3} +do_execsql_test e_select-3.1.2 { SELECT k FROM x1 WHERE y } {3 5 6} +do_execsql_test e_select-3.1.3 { SELECT k FROM x1 WHERE z } {1 2 6} +do_execsql_test e_select-3.1.4 { SELECT k FROM x1 WHERE '1'||z } {1 2 4 6} +do_execsql_test e_select-3.1.5 { SELECT k FROM x1 WHERE x IS NULL } {4 5} +do_execsql_test e_select-3.1.6 { SELECT k FROM x1 WHERE z - 78.43 } {2 4 6} + +do_execsql_test e_select-3.2.1a { + SELECT k FROM x1 LEFT JOIN x2 USING(k) +} {1 2 3 4 5 6} +do_execsql_test e_select-3.2.1b { + SELECT k FROM x1 LEFT JOIN x2 USING(k) WHERE x2.k +} {1 3 5} +do_execsql_test e_select-3.2.2 { + SELECT k FROM x1 LEFT JOIN x2 USING(k) WHERE x2.k IS NULL +} {2 4 6} + +do_execsql_test e_select-3.2.3 { + SELECT k FROM x1 NATURAL JOIN x2 WHERE x2.k +} {3} +do_execsql_test e_select-3.2.4 { + SELECT k FROM x1 NATURAL JOIN x2 WHERE x2.k-3 +} {} + finish_test