Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Feedback Appreciated on text-parsing, SQL querying subroutine

by ioannis (Priest)
on May 31, 2006 at 14:21 UTC ( #552798=note: print w/ replies, xml ) Need Help??


in reply to Feedback Appreciated on text-parsing, SQL querying subroutine

The $dbh->prepare is in a loop, with the same statement and handle attributes. You only need to prepare it once:

my $sth2 = $dbh->prepare_cached("select d_id, c_id from d where d_id = ?"); $sth2->execute( $did2 ); # And since you need less clutter on the monitor (my $sth2 = $dbh->prepare_cached(<<"")) -> execute ($did2); select d_id, c_id from d where d_id = ? # line above intentionally left blank


Comment on Re: Feedback Appreciated on text-parsing, SQL querying subroutine
Download Code
Re^2: Feedback Appreciated on text-parsing, SQL querying subroutine
by saberworks (Curate) on May 31, 2006 at 19:29 UTC
    Actually, he's not using placeholders so in his case, he will have to put the prepare in the loop. Once he switches to placeholders, then preparing it once at the beginning would be much better.

    Also, your HEREDOC terminated with an empty line and a mandatory comment (otherwise, it will get broken over and over) seems a lot less clear and more cluttered than your first example.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-11-26 15:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (171 votes), past polls