Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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
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 romping around the Monastery: (2)
As of 2014-07-13 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (247 votes), past polls