[ic] Matrix options and set_row possible bug?
Peter
peter at pajamian.dhs.org
Thu Jun 22 22:05:56 EDT 2006
On 06/22/2006 02:53 PM, Jon Jensen wrote:
> On Thu, 22 Jun 2006, Peter wrote:
>
>> I may see if I can fix both because the first mentioned bug would pay
>> to help everyone out if I can fix it. I think it's branching wrong in
>> set_row (from looking it should be branching to a different part of
>> the function if only the key is defined, but it's not) so I'll see if
>> I can figure out why. I've got a change in mond of using DEFAULT
>> instead of the '?' placeholder for fields that don't exist in the
>> @fields array, that may go a long ways towards fising it, but it would
>> also require changing the number of bindings or the db will error out
>> because of a mismatch of bindings to ?'s.
>
>
> I'd like to see a fix for this key-only problem if you fix it.
Here's a diff against CVS, it just moves the problem block further down
so it won't cause a problem (may suffer from word wrap):
Index: lib/Vend/Table/DBI.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/DBI.pm,v
retrieving revision 2.70
diff -u -p -r2.70 DBI.pm
--- lib/Vend/Table/DBI.pm 14 Feb 2006 08:30:51 -0000 2.70
+++ lib/Vend/Table/DBI.pm 23 Jun 2006 02:03:31 -0000
@@ -1290,13 +1290,6 @@ sub set_row {
$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 @@ sub set_row {
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-users
mailing list