I need to know when I execute() a statement if the error is a connectivity error or something else.
From the DBI docs:


Perform whatever processing is necessary to execute the prepared statement. An "undef" is returned if an error occurs. A successful "execute" always returns true regardless of the number of rows affected, ...

Is it possible, in a database-agnostic fashion, to know whether an undef returned value for execute() means that the DB connection is problematic, as opposed to another perfectly valid error such as a SQL syntax error or primary key constraint error?

Right now I simply follow up with a "select 1" and see if the returned value is undef. If so, then the db connection is at fault. Anything more subtle than this?

Thanks.

H



Reply via email to