DB Access Module for Sybase User’s Guide : Chapter 2 Technical Information : Error Messages: Contents of RWDBStatus
Error Messages: Contents of RWDBStatus
Sybase Open Client Client-Library distinguishes between errors originating from Sybase Adaptive Server Enterprise, and errors generated within Client-Library and CS-Library. The DB Interface Module honors the distinction by assigning error code serverError to errors from the server, and error code vendorLib to errors from Client-Library and CS‑Library.
Reporting Errors from Client-Library and CS‑Library
The format that RWDBStatus uses to report errors from Client-Library and CS‑Library follows this paragraph. Notice that errors with a severity level zero are given special handling: the RWDBStatus::errorCode is set to RWDBStatus::ok, the rest of the RWDBStatus is populated, and an application's error handler (if any) is invoked. This means that SourcePro DB applications ignore these errors by default, but an application can process them if necessary. It also means that the error handler for the application should check vendorError2 (severity) before raising an exception.
errorCode: RWDBStatus::vendorLib, unless the severity is zero, as rated by Client-Library or CS-Library. If severity is zero, errorCode is set to RWDBStatus::ok, and the user-installed error handler is invoked.
message: [VENDORLIB] Vendor Library Error:%s, where %s is the error text from Client-Library or CS-Library (CS_CLIENTMSG.msgstring).
vendorMessage1: The text reported by Client-Library or CS-Library as an operating system error, if any (CS_CLIENTMSG.osstring).
vendorMessage2: The text that describes the error (CS_CLIENTMSG.sqlstate). Not all client messages have state values associated with them.
vendorError1: The Client-Library or CS-Library error number (CS_CLIENTMSG.msgnumber).
vendorError2: The error's severity level (CS_CLIENTMSG.severity).
Reporting Errors from Adaptive Server
The following format shows how RWDBStatus reports messages from Adaptive Server. Notice that RWDBStatus provides special handling for messages in which both severity and message number are 0, and for context switch messages (for example, Changed database context to master). When these messages occur, the RWDBStatus::errorCode is set to RWDBStatus::ok, the rest of the RWDBStatus is populated, and the application's error handler (if any) is invoked. Because errorCode is RWDBStatus::ok, SourcePro DB applications will ignore these errors by default. However, the error information itself is still accessible if the application needs to check it. The error handler should check vendorError2 (severity) before raising an exception.
errorCode:
RWDBStatus::ok, if severity and msgnumber are both zero, or msgnumber is one of 5701, 5703, 5704.
RWDBStatus::serverMessage, if severity is less than or equal to 10.
RWDBStatus::serverError, otherwise.
message:
[SERVERERROR] %s if errorCode is RWDBStatus::serverError
[SERVERMESSAGE] %s otherwise
where %s is the text of the server message CS_SERVERMSG.text
vendorMessage1: Name of the server reporting the error (CS_SERVERMSG.svrname).
vendorMessage2: The SQLSTATE status code (CS_SERVERMSG.sqlstate). Not all Adaptive Server error conditions are associated with a SQLSTATE code.
vendorError1: Server message number (CS_SERVERMSG.msgnumber).
vendorError2: The error's severity level (CS_SERVERMSG.severity).
All errors associated with the status are reported.