On 12/6/03 8:52 AM Dan Anderson wrote:

        I am using the Perl DBI to connect to a mySQL database.  I am
using prepare and execute statements to send the query to the database
and then execute it.  Is there any benefit to doing this versus using
do?

The O'Reilly book "Programming the Perl DBI" says:

...the do() method supplied by the DBI makes executing non-SELECT statements much simpler than repeatedly preparing and executing statements.

...

There is a drawback to doing this, however: performance. If you invoked do() repeatedly to insert a huge number of rows into a table, you could be preparing a statement handle many times more than is required, especially if the statement contained placeholder variables.

HTH.

--Jo

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Reply via email to