Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl DBI escape reserved word in Ingres database

by poj (Abbot)
on Feb 22, 2019 at 13:54 UTC ( [id://1230383]=note: print w/replies, xml ) Need Help??


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 = ?"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1230383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found