Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by ioannis (Monsignor)
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

Replies are listed 'Best First'.
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?
[james28909]: what if one day we are able to grab the curtain that is "spacetime" and pull it back to reveal <insert imagination here> pulling at levers and ropes xD
[holli]: like dorothy?
[james28909]: see ya later holli
[james28909]: yeah like wizard of oz lol. its just a joke though
[james28909]: i cannot understand how someone cant see that a cloud of gas that evolves into a solar system or galaxies. it just makes sense to me. everythign that has happened, had to have happened for anything on this planet to be.
[james28909]: /gas/gas and debris/
[james28909]: another thing, i used to be atheist. life experiences, personal evidence. and my own perception is the reason why i believe the things i do.
[erix]: and now you are agnostic?
[james28909]: arunbear, your picking bits of history to fit your own narrative. right now, humans are smarter than in any of those times.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2017-12-15 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (433 votes). Check out past polls.

    Notices?