in reply to Avoiding too many DB queries

Just a nitpick. Don't do this:

$dbh->do("INSERT INTO chain (pdb,chain) VALUES ('$pdb','$ch')");
Do this instead:
$dbh->do("INSERT INTO chain(pdb,chain) VALUES(?,?)",undef,$pdb,$ch);
and let DBI do the quoting for you.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Avoiding too many DB queries
by seaver (Pilgrim) on Jun 18, 2004 at 17:23 UTC
    Will this actually reduce any overhead?

    I've got too many statements all over my code to go through and update it as you recommend...

    Cheers
    Sam

      It is more of a security issue. You no longer have to wory about what is in those variables because DBI is going to make sure they are safe and not trying to break anything. It also means you can prepare it before hand using placeholders, then execute it multiple times later with different values, I beleive in that case it DOES reduce the overhead.


      ___________
      Eric Hodges