Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: OOP: How to construct multiple instances of a class at once

by Tanktalus (Canon)
on Nov 15, 2012 at 03:03 UTC ( #1003923=note: print w/ replies, xml ) Need Help??


in reply to Re: OOP: How to construct multiple instances of a class at once
in thread OOP: How to construct multiple instances of a class at once

Scrubbing for Bobby Tables issues? No, the SQL needs to be written for those issues.

my $sql = 'SELECT user_id, user_name FROM users WHERE user_id IN (' . +join(',', ('?') x @ids) . ')'; #... $sth->execute(@ids);
Especially since perl makes this so trivially easy, as compared to, say, C.


Comment on Re^2: OOP: How to construct multiple instances of a class at once
Download Code
Replies are listed 'Best First'.
Re^3: OOP: How to construct multiple instances of a class at once
by runrig (Abbot) on Nov 15, 2012 at 16:18 UTC
    If the ids were strings, I might use map $dbh->quote($_), @ids, but since they're probably integers, validating that they're /^\d+$/ is probably good enough. Either is also easy.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2015-07-28 21:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (259 votes), past polls