-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Nov 7, 2005, at 8:57 PM, Jonathan Leffler wrote:
On 11/6/05, Aaron Turner <[EMAIL PROTECTED]> wrote:
When I run my code, I see the
$dbh hash change inside of the child process and the parent hash stay
the same. Aren't I avoiding using the same handle by doing a $dbh =
undef in the child and then calling connect again?
The undef probably does the damage - the connect again would be
correct.
If the 'undef' causes the child process to disconnect, then it
closes the
connection and the server is none the wiser that it was only one of
two
processes that closed the connection.
Uh, that makes no sense (at least to me). Setting the parent's $dbh
handle to undef or replacing it with another should both cause the
client to process to disconnect under normal circumstances since it
will go out of scope and Perl will call DESTROY on the object at that
time. However, by setting $dbh->{InactiveDestroy} = 1 on the parent
inside the child, should avoid implicitly calling DESTROY (and
thereby avoid the disconnect) when the $dbh goes out of scope for any
reason.
In other words this:
$dbh->{InactiveDestroy} = 1;
$dbh = undef;
$dbh = DBI->connect(...);
should be equivalent to:
$dbh->{InactiveDestroy} = 1;
$dbh= DBI->connect(...);
Or am I missing something?
Thanks,
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)
iD8DBQFDcDz9klVhPAXg8nARAhvtAJ9xH4vikFXyRwfXdL4txZ50u3/eWwCfSLUb
k8cV3rPKvN+7dZuE5RSCCM4=
=BVkL
-----END PGP SIGNATURE-----