Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl DBI escape reserved word in Ingres database

by choroba (Cardinal)
on Feb 22, 2019 at 13:19 UTC ( [id://1230380]=note: print w/replies, xml ) Need Help??


in reply to Perl DBI escape reserved word in Ingres database

The quote_identifier method should handle the correct quoting for you:
my $sql = 'SELECT DISTINCT id FROM mytable WHERE ' . $dbh->quote_ident +ifier('open') . ' = ?';
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Perl DBI escape reserved word in Ingres database
by jtech (Sexton) on Feb 22, 2019 at 14:02 UTC

    Curiously after applied "quote_ident" it doesn't return anything, not even an error, the @id is empty/undef. It works just fine in other columns but, not with a reserved word between double quotes. Also, I have double checked the data by SQL command and it is in there.

    I haven't played with substring yet and this little monster scares me tbh.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-03-28 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found