Open
Description
Lest we forget ...
use 5.18.2;
use warnings;
use Text::CSV_XS qw( csv );
use DBI;
my $tbl = "issue$$";
csv (out => "$tbl.csv", in => [
[qw( c_issue issue color size )],
[1,234,"Black",4],
[2,345,"Red",8],
[3,345,"Pink",8],
[4,456,"White",16]]);
my $dbh = DBI->connect ("dbi:CSV:", undef, undef, {
RaiseError => 1,
PrintError => 1,
ShowErrorStatement => 1,
f_ext => ".csv/r",
}) or die DBI->errstr;
my $sth = $dbh->prepare (qq;
select issue, count (*)
from $tbl
group by issue
having count (*) > 1;
);
$sth->execute;
while (my @row = $sth->fetchrow) {
say "@row";
}
END { unlink "$tbl.csv"; }
=>
$ perl -MV=Text::CSV_XS,DBI,DBD::File,SQL::Statement
Text::CSV_XS
/pro/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi-ld/Text/CSV_XS.pm: 1.27
DBI
/pro/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi-ld/DBI.pm: 1.636
DBD::File
/pro/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi-ld/DBD/File.pm: 0.44
SQL::Statement
/pro/lib/perl5/site_perl/5.24.0/SQL/Statement.pm: 1.410
$ perl issue.pl
Bad table or column name: '>' has chars not alphanumeric or underscore! at /pro/lib/perl5/site_perl/5.24.0/SQL/Statement.pm line 90.
DBD::CSV::db prepare failed: Bad table or column name: '>' has chars not alphanumeric or underscore! at /pro/lib/perl5/site_perl/5.24.0/SQL/Statement.pm line 90.
[for Statement "
select issue, count (*)
from issue31889
group by issue
having count (*) > 1"] at issue.pl line 23.
DBD::CSV::db prepare failed: Bad table or column name: '>' has chars not alphanumeric or underscore! at /pro/lib/perl5/site_perl/5.24.0/SQL/Statement.pm line 90.
[for Statement "
select issue, count (*)
from issue31889
group by issue
having count (*) > 1"] at issue.pl line 23.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Tux commentedon Jun 26, 2017
ping?
rehsack commentedon Jun 26, 2017
I can take a look (usually it's better to open issues via RT) together with all the other DBI tasks I've scheduled, but I cannot promise to fix it.