cvsuser 05/03/02 09:19:27
Modified: App-Repository/t DBI-select.t
Log:
recognize the following special cases in inferred-op params:
'ALL','NULL','NULL,value','@[db expr]'
Revision Changes Path
1.8 +90 -0 p5ee/App-Repository/t/DBI-select.t
Index: DBI-select.t
===================================================================
RCS file: /cvs/public/p5ee/App-Repository/t/DBI-select.t,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DBI-select.t 14 Dec 2004 15:43:15 -0000 1.7
+++ DBI-select.t 2 Mar 2005 17:19:27 -0000 1.8
@@ -462,6 +462,96 @@
is($sql, $expect_sql, "_mk_select_sql(): verbatim");
&check_select($sql,0);
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+where (age in (14,15,16) or age is null)
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => "14,15,16,NULL"},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): ,NULL");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+where (age in (14,15,16) or age is null)
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => "NULL,14,15,16"},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): NULL,");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+where (age in (14,15,16) or age is null)
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => "14,15,NULL,16"},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): ,NULL,");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+where age is null
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => "NULL"},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): NULL");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+where age is null
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => undef},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): undef (NULL)");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+where first_name = ''
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"first_name" => ""},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): \"\" (ALL)");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => "ALL"},
+ ["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): NULL");
+&check_select($sql,0);
+
###########################################################################
# EXCEPTIONS
###########################################################################