DBD::CSV group by on multiple columns not working



I cannot get DBD::CSV & SQL::Statement to work correctly when there is
more than 1 column in the group by.
I have version 1.15 of SQL::Statement and version 0.22 of DBD::CSV.

I wonder if this is a known bug, or I am missing something, because
the docs for SQL::Statement show that it should be supported?

Example:
% cat > testData.csv
1,1,10
1,2,10
1,3,10
2,1,10
2,1,10
2,1,10

% cat > testdbdcsv.pl
#!/usr/bin/perl
use strict;
use warnings;
use DBI;

my $csvdb = DBI->connect( "dbi:CSV:" ) || die "Cannot connect: $DBI::errstr";
$csvdb->{'csv_tables'}->{'log'} = {
'file' => "testData.csv",
'eol' => "\n",
'col_names' => ["a","b","c"]
};
$csvdb->{'RaiseError'} = 1;
$@ = '';
eval {
my $csth = $csvdb->prepare("SELECT a,b,sum(c) as tot from log
GROUP BY a,b");
$csth->execute();
while (my $row = $csth->fetchrow_hashref) {
print " row: " . join(",",
$row->{'a'},
$row->{'b'},
$row->{'tot'},
) . "\n";

}
$csth->finish();
};
if ($@) { warn "SQL database error: $@";}

$csvdb->disconnect;


% perl testdbdcsv.pl
row: 2,1,40
row: 1,2,10
row: 1,3,10


Thanks,
John Krystynak

--
Amazon Prime Users - add my search tool to your Firefox search bar!
http://searchaprime.com <-- new URL!
.



Relevant Pages

  • Re: OT - Update on Missing Merlot
    ... Our Moses went missing for 40 days. ... > cat was missing one day. ... >>wearing ID), none made it to the other animal shelter, and the local ... >>Wayne came home from work early and has been doorknocking but Merlot ...
    (rec.crafts.textiles.quilting)
  • Re: Sysmask security challenge: useful or not?
    ... at least without first testing with ls and cat. ... A stupid bug in the sysmask package. ... > more useless things to play with and would waste more time. ... Doing everything via a web form is not very ...
    (comp.os.linux.security)
  • Re: Sysmask security challenge: useful or not?
    ... It is true that tests using ls and cat don't prove anything and are ... A stupid bug in the sysmask package. ... A nasty bug in the kernel, leading to a privilege elevation. ... more useless things to play with and would waste more time. ...
    (comp.os.linux.security)
  • [Full-Disclosure] THREATCON HITTING DANGEROUS LEVELS!
    ... > This is the linux glibc bootstrap code behaviour. ... $ cat noargv2.c ... Consider the glibc-2.1.3 bug with LD_PRELOAD loading libraries, ...
    (Full-Disclosure)
  • Re: Missing Cat in Godalming
    ... Our cat has been missing since Friday afternoon. ... small grey/black tabby with a white front, approx. ... Jason Yates ...
    (uk.local.surrey)