On Fri, Jun 28, 2002 at 06:58:07PM -0700, David Adam wrote:
Well, that is where I am confused. My take on the DBI docs was
that the big advantage of preparing statements is that you can do it
once and then use them over and over.
That's correct. It's more efficient to use prepared statements. DBI
does less work that way.
But if you have to use a different query to get back the
autoincrement value, don't you then have to prepare the first query
all over again before you can use it again?
Not at all.
That was why I was using multiple connections.
You can use a single connection for many prepared queries.
my $statement1 = $dbh->prepare(...);
my $statement2 = $dbh->prepare(...);
while (...)
{
$statement1->execute(...);
$statement2->execute(...);
}
That will work just fine.
Jeremy
MySQL 3.23.51: up 30 days, processed 656,836,113 queries (250/sec. avg)