[interchange-cvs] interchange - racke modified lib/Vend/Table/DBI.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Fri Jun 23 04:43:58 EDT 2006
User: racke
Date: 2006-06-23 08:43:57 GMT
Modified: lib/Vend/Table DBI.pm
Log:
avoid unwanted expansion of array in the case we have PREFER_NULL fields and
number of fields passed is one (thanks to Peter Ajamian for the patch and
investigations)
Revision Changes Path
2.71 +10 -10 interchange/lib/Vend/Table/DBI.pm
rev 2.71, prev_rev 2.70
Index: DBI.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/DBI.pm,v
retrieving revision 2.70
retrieving revision 2.71
diff -u -r2.70 -r2.71
--- DBI.pm 14 Feb 2006 08:30:51 -0000 2.70
+++ DBI.pm 23 Jun 2006 08:43:57 -0000 2.71
@@ -1,8 +1,8 @@
# Vend::Table::DBI - Access a table stored in an DBI/DBD database
#
-# $Id: DBI.pm,v 2.70 2006/02/14 08:30:51 racke Exp $
+# $Id: DBI.pm,v 2.71 2006/06/23 08:43:57 racke Exp $
#
-# Copyright (C) 2002-2005 Interchange Development Group
+# Copyright (C) 2002-2006 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
# MA 02111-1307 USA.
package Vend::Table::DBI;
-$VERSION = substr(q$Revision: 2.70 $, 10);
+$VERSION = substr(q$Revision: 2.71 $, 10);
use strict;
no warnings qw(uninitialized numeric);
@@ -1290,13 +1290,6 @@
$s->filter(\@fields, $s->[$CONFIG]{COLUMN_INDEX}, $s->[$CONFIG]{FILTER_TO})
if $cfg->{FILTER_TO};
- if ($cfg->{PREFER_NULL}) {
- for (keys %{$cfg->{PREFER_NULL}}) {
- my $i = $cfg->{COLUMN_INDEX}{$_};
- undef $fields[$i] if $fields[$i] eq '';
- }
- }
-
my $val;
if(scalar @fields == 1) {
@@ -1349,6 +1342,13 @@
return undef;
}
return $fields[0];
+ }
+
+ if ($cfg->{PREFER_NULL}) {
+ for (keys %{$cfg->{PREFER_NULL}}) {
+ my $i = $cfg->{COLUMN_INDEX}{$_};
+ undef $fields[$i] if $fields[$i] eq '';
+ }
}
if(! length($fields[$ki]) ) {
More information about the interchange-cvs
mailing list