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

Re^2: Simple DBI question, select rows based on an array

by ruzam (Curate)
on Nov 05, 2009 at 13:44 UTC ( [id://805264]=note: print w/replies, xml ) Need Help??


in reply to Re: Simple DBI question, select rows based on an array
in thread Simple DBI question, select rows based on an array

That could get you into trouble with quote problems in @array values or worse sql-injection. At the very least you should use the DBI quote method:

my $sql = 'SELECT * FROM table WHERE column IN (' . ( join ',', map { $dbi->quote($_) } @array ) . ')';

Or better, use placeholders

my $sql = 'SELECT * FROM table WHERE column IN (' . '?' . (',?' x $#array) . ')';

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found