cvsuser 03/11/18 13:37:09
Modified: P5EEx/Blue/P5EEx/Blue/Repository DBI.pm
Log:
undef param values mean NULL instead of bind variable placeholder
Revision Changes Path
1.28 +14 -5 p5ee/P5EEx/Blue/P5EEx/Blue/Repository/DBI.pm
Index: DBI.pm
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Repository/DBI.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -w -r1.27 -r1.28
--- DBI.pm 5 Aug 2003 17:49:36 -0000 1.27
+++ DBI.pm 18 Nov 2003 21:37:09 -0000 1.28
@@ -1,13 +1,13 @@
######################################################################
-## File: $Id: DBI.pm,v 1.27 2003/08/05 17:49:36 spadkins Exp $
+## File: $Id: DBI.pm,v 1.28 2003/11/18 21:37:09 spadkins Exp $
######################################################################
use P5EEx::Blue::P5EE;
use P5EEx::Blue::Repository;
package P5EEx::Blue::Repository::DBI;
-$VERSION = do { my @r=(q$Revision: 1.27 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
+$VERSION = do { my @r=(q$Revision: 1.28 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
@ISA = ( "P5EEx::Blue::Repository" );
@@ -361,7 +361,13 @@
$column_def = $tabcols->{$column};
next if (!defined $column_def); # skip if the column is unknown
if (! defined $paramvalues->{$colstr}) {
- $value = "?"; # TODO: make this work with the "contains/matches"
operators
+ # $value = "?"; # TODO: make this work with the
"contains/matches" operators
+ if (!$sqlop || $sqlop eq "=") {
+ $where .= ($colnum == 0) ? "where $column is null\n" : " and
$column is null\n";
+ }
+ else {
+ $where .= ($colnum == 0) ? "where $column is not null\n" : "
and $column is not null\n";
+ }
}
else {
$value = $paramvalues->{$colstr};
@@ -409,10 +415,10 @@
$value =~ s/'/\\'/g;
$value = "'$value'";
}
- }
$where .= ($colnum == 0) ? "where $column $sqlop $value\n" : " and
$column $sqlop $value\n";
}
}
+ }
$where;
}
@@ -742,7 +748,9 @@
next if (!defined $column_def); # skip if the column is unknown
if (! defined $paramvalues->{$param}) {
- $paramvalue = "?"; # TODO: make this work with the "contains/matches"
operators
+ #$paramvalue = "?"; # TODO: make this work with the
"contains/matches" operators
+ $sqlop = (!$sqlop || $sqlop eq "=") ? "is" : "is not";
+ $paramvalue = "null";
}
else {
$paramvalue = $paramvalues->{$param};
@@ -2006,6 +2014,7 @@
$func = DBIx::Compat::GetItem($dbidriver, "ListTables");
@tables = &{$func}($dbh);
}
+ @tables = grep(s/['"`]//g, @tables);
# go through the list of native tables from the database
foreach $table (@tables) {