fix 11940: quickCSV chokes on newlines in data

This commit is contained in:
Doug Bell 2010-11-01 14:39:44 -05:00
parent f2ac0bc67c
commit 4864a75340
2 changed files with 16 additions and 3 deletions

View file

@ -679,7 +679,7 @@ sub quickCSV {
my $params = shift;
my ($sth, $output, @data);
my $csv = Text::CSV_XS->new({ eol => "\n" });
my $csv = Text::CSV_XS->new({ eol => "\n", binary => 1 });
$sth = $self->prepare($sql);
$sth->execute($params);
@ -688,7 +688,10 @@ sub quickCSV {
$output = $csv->string();
while (@data = $sth->array) {
return undef unless $csv->combine(@data);
if ( ! $csv->combine(@data) ) {
$self->session->log->error( "Problem creating CSV row: " . $csv->error_diag );
return undef;
}
$output .= $csv->string();
}