Re: No error reset on ping

"Greg Sabino Mullane" <greg-738XdyZ4GzZWk0Htik3J/[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Apache::DBI intercepts the connect() calls, and returns an existing
> database handle if possible. It uses the ping() method to check the
> validity of the database handle.
>
> I was checking for an error condition by examinging $DBI::ERR
> afterwards. $DBI::ERR however is set to the error state of the last
> transaction.
...
> I can fix my code by not examining $DBI::ERR, but I think this is a bug.

I don't think this is a bug so much as ping not behaving as you would
like it too. :) The ping method is passive - it merely checks the status
of the connection, but does not necessarily change anything. You should
not need to check for an error from the ping method - it either returns
true or false. Ideally, your previous connection should have cleaned up the
error (e.g. with a commit or rollback) but in your case I would think that
seeing the old error code would be a good thing, as you can issue a rollback
before going on (which is what a disconnect would have done, but Apache::DBI
intercepts that as well, IIRC).

- --
Greg Sabino Mullane greg-738XdyZ4GzZWk0Htik3J/[email protected]
PGP Key: 0x14964AC8 200604091748
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFEOYGRvJuQZxSWSsgRArHeAKCkFsGX+eeqzZBK5zN043zJK1l9lACg+6aI
myzYqkARhXd0AEHmfZe4QQk=
=0CpL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.