Won't $DBI::errno and $DBI::errstr be set if an error occurs?

--
Ron Reidy
Lead DBA
Array BioPharma, Inc


-----Original Message-----
From:   Henri Asseily [mailto:[EMAIL PROTECTED]
Sent:   Thu 9/9/2004 12:31 PM
To:     [EMAIL PROTECTED]
Cc:     
Subject:        Execute: How to differentiate between connectivity and sql errors
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





This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended 
to be for the use of the individual or entity named above. If you are not the 
intended recipient, please be aware that any disclosure, copying, distribution 
or use of the contents of this information is prohibited. Please notify the
sender  of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.

Reply via email to