Hello,
As you know,
use Apache::DBI;
DBI->connect(....)
returns a db/connection handle.
I am wondering if it is possible, at different times during the server life,
that Apache::DBI returns twice the same memory reference, while the connection
is in fact physically not the same.
The reason for this question is simple: I would like to know if I can reuse
statement handles (for example doing a $sth->execute) without having to
recreate them if the conection handle is the same with an algorithm like this
simplified one:
our $sth;
our $currentdbh ;
our $olddbh;
$currentdbh = DBI->connect(....);
if ($currentdbh != $olddbh){
$sth = $currentdbh->prepare(...)
}
$sth->execute(....);
$olddbh = $currentdbh;
This would save me the need to prepare at every request, while I could benefit
from old prepared statements.
What I'm afraid of, by doing that, are situations where db handles appear to be
the same (same address) while they are not in fact the same.
Thanks,
Lionel.