cvsuser 05/03/14 08:42:15
Modified: App-Repository/lib/App/Repository DBI.pm
App-Repository/t DBI-select.t
Log:
empty param value for unquoted param (inferred op) is an ALL
Revision Changes Path
1.24 +7 -2 p5ee/App-Repository/lib/App/Repository/DBI.pm
Index: DBI.pm
===================================================================
RCS file: /cvs/public/p5ee/App-Repository/lib/App/Repository/DBI.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- DBI.pm 2 Mar 2005 17:18:10 -0000 1.23
+++ DBI.pm 14 Mar 2005 16:42:15 -0000 1.24
@@ -1,13 +1,13 @@
######################################################################
-## File: $Id: DBI.pm,v 1.23 2005/03/02 17:18:10 spadkins Exp $
+## File: $Id: DBI.pm,v 1.24 2005/03/14 16:42:15 spadkins Exp $
######################################################################
use App;
use App::Repository;
package App::Repository::DBI;
-$VERSION = do { my @r=(q$Revision: 1.23 $=~/\d+/g); sprintf
"%d."."%02d"x$#r,@r};
+$VERSION = do { my @r=(q$Revision: 1.24 $=~/\d+/g); sprintf
"%d."."%02d"x$#r,@r};
@ISA = ( "App::Repository" );
@@ -641,6 +641,8 @@
$quoted = (defined $column_def->{quoted}) ?
($column_def->{quoted}) : ($value !~ /^-?[0-9.]+$/);
}
+ next if ($inferred_op && !$quoted && $value eq "");
+
$include_null = 0;
if ($repop eq "contains") {
@@ -1118,6 +1120,7 @@
next if (defined $table_def->{param}{$param}{all_value} &&
$paramvalue eq $table_def->{param}{$param}{all_value});
+
next if ($inferred_op && $paramvalue eq "ALL");
if (ref($paramvalue) eq "ARRAY") {
@@ -1140,6 +1143,8 @@
$quoted = (defined $column_def->{quoted}) ?
($column_def->{quoted}) : ($paramvalue !~ /^-?[0-9.]+$/);
}
+ next if ($inferred_op && !$quoted && $paramvalue eq "");
+
if ($repop eq "contains") {
$paramvalue =~ s/'/\\'/g;
$paramvalue = "'%$paramvalue%'";
1.9 +12 -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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DBI-select.t 2 Mar 2005 17:19:27 -0000 1.8
+++ DBI-select.t 14 Mar 2005 16:42:15 -0000 1.9
@@ -537,6 +537,18 @@
$sql = $rep->_mk_select_sql("test_person",
{"first_name" => ""},
["first_name","last_name"]);
+is($sql, $expect_sql, "_mk_select_sql(): \"\" (use literal as string)");
+&check_select($sql,0);
+
+$expect_sql = <<EOF;
+select
+ first_name,
+ last_name
+from test_person
+EOF
+$sql = $rep->_mk_select_sql("test_person",
+ {"age" => ""},
+ ["first_name","last_name"]);
is($sql, $expect_sql, "_mk_select_sql(): \"\" (ALL)");
&check_select($sql,0);