You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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",
}) ordie 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.
The text was updated successfully, but these errors were encountered:
Lest we forget ...
=>
The text was updated successfully, but these errors were encountered: