All errors from the Adaptive Server database driver for Perl and CT-Lib are propagated into the DBI layer.
Exceptions include errors or warnings that must be reported during driver start-up, when there is no context available yet.
The DBI layer performs basic error reporting when the PrintError attribute is enabled. Use DBI trace method to enable tracing on DBI operations to track program- or system-level problems.
Examples of adding more detailed error messages (server messages) are as follows:
Set dbh->{syb_show_sql} = 1 on the active dbh to include the current SQL statement in the string returned by $dbh->errstr.
Set dbh->{syb_show_eed} = 1 on the active dbh to add extended error information (EED) such as duplicate insert failures and invalid date formats to the string returned by $dbh->errstr.
Use the syb_err_handler attribute to set an ad hoc error handler callback (that is, a Perl subroutine) that gets called before the normal error handler performs its processing. If this subroutine returns 0, the error is ignored. This is useful for handling PRINT statements in Transact-SQL, and showplan output and dbcc output.
The subroutine is called with parameters that include the Sybase error number, the severity, the state, the line number in the SQL batch, the server name (if available), the stored procedure name (if available), the message text, the SQL text and the strings "client" or "server" to denote type.