On Tue, Aug 04, 2009 at 01:19:43PM +0100, Martin Evans wrote:
> This is my second attempt to try and get some insight into how to do
> this. The DBD::ODBC::ping method calls DBI::_new_sth to obtain a new
> statement handle but DBD::ODBC prevents creating a new statement handle
> when not connected (you cannot actually get one even if you wanted). The
> problem is once DBD::ODBC discovers we are not connected it does:
> 
> DBIh_SET_ERR_CHAR(
>   h, imp_xxh, Nullch, 1,
>   "Cannot allocate statement when disconnected from the database",
>             "08003", Nullch);
> 
> and because PrintError is on the error is output and because RaiseError
> is on the error handler is called. Most people are calling ping when not
> connected and do not want this error and I wanted to mask it by
> temporarily disabling PrintError and RaiseError but it does not seem to
> work for me.
> 
> Initially I tried using local $dbh->{PrintError} = 0 but this did not
> work. Then I remembered I needed to call STORE from inside the driver so
> changed to $dbh->STORE('PrintError', 0); but that does not work either.

That should work. Try calling $dbh->dump_handle after (and after doing
the same for RaiseError) that to see what the state of the handle is.

Tim.

p.s. You could also try using the HandleError attribute, but the above should
work so let's find out what's happening there first.

Reply via email to