Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

having cannot have > or < #14

Open
Tux opened this issue Mar 6, 2017 · 2 comments
Open

having cannot have > or < #14

Tux opened this issue Mar 6, 2017 · 2 comments

Comments

@Tux
Copy link
Member

Tux commented Mar 6, 2017

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.
@Tux
Copy link
Member Author

Tux commented Jun 26, 2017

ping?

@rehsack
Copy link
Member

rehsack commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants