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.