Skip Menu |

This queue is for tickets about the DBD-CSV CPAN distribution.

Report information
The Basics
Id: 43010
Status: resolved
Priority: 0/
Queue: DBD-CSV

People
Owner: Nobody in particular
Requestors: jbazik [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.22
Fixed in: 0.26



Subject: treatment of nulls scrambles joins
JOINs get scrambled when the tables involved have rows with empty (NULL) trailing values. It's because those values are simply missing - there are no commas. I noticed the discussion of the treatment of NULLs in the POD for DBD::CSV, but I still found this unexpected. Attached is a test program that demonstrates the problem, and sample output from it. Here's a one-line fix, that is backward compatible (does not add commas to the files), and passes the module's tests: --- CSV.pm.orig 2005-03-31 17:50:15.000000000 -0500 +++ CSV.pm 2009-01-29 15:49:53.000000000 -0500 @@ -210,6 +210,7 @@ die "Error while reading file " . $self->{'file'} . ": $!" if $!; return undef; } + push @$fields, undef while @$fields < @{$self->{col_names}}; } $self->{row} = (@$fields ? $fields : undef); } It just pads the response with undef's when the array is too short. John
Subject: sqlbug.out
Download sqlbug.out
application/octet-stream 285b

Message body not shown because it is not plain text.

Subject: sqlbug
Download sqlbug
application/octet-stream 1.1k

Message body not shown because it is not plain text.