in reply to Perl DBI escape reserved word in Ingres database

Which is line 104 ?

Do a test without the placeholder

my $sql = q! SELECT DISTINCT "open" FROM mytable !; my $ref = $dbh->selectall_arrayref($sql); @id = map{ $_->[0] } @$ref; print join (", ", @id), "\n";
poj

Replies are listed 'Best First'.
Re^2: Perl DBI escape reserved word in Ingres database
by jtech (Sexton) on Feb 22, 2019 at 14:10 UTC
    It has returned "1", btw this is a boolean type column, intrigued.

    Got it!

    Solution: my $ref =  $dbh->selectall_arrayref($sql,undef,'1');

      It doesn't look like BOOLEAN is mentioned in DBD::Ingres so try

      my $sql = "SELECT DISTINCT id FROM mytable WHERE open = CAST(? AS BOOL +EAN)"; my $ref = $dbh->selectall_arrayref($sql,undef,'true'); @id = map{ $_->[0] } @$ref; die join (", ", @id), "\n";
      poj
        Whoops, it doesn't work, I did a wrong test previously, sorry my bad. Also, BOOLEAN(?) doesn't work either. btw Ingres doc is poor, IMHO it is a dead technology :/
Re^2: Perl DBI escape reserved word in Ingres database
by jtech (Sexton) on Feb 22, 2019 at 14:15 UTC
    The line 104 is this one: my $sql = "SELECT DISTINCT id FROM mytable WHERE open = ?"