Processing message results

All types of servers can return message results.

A message result set contains no fetchable results. Instead, a message has an ID, which an application can retrieve by calling ct_res_info(CS_MSGTYPE).

Message IDs in the range 1–32,767 are reserved for Adaptive Server and Sybase internal use.

Application-defined message IDs must be in the range CS_USER_MSGID to CS_USER_MAX_MSGID.

If parameter values are associated with a message, they are returned as a separate parameter result set following the message result set. See “Processing parameter results”.

NoteA message result set is not the same thing as a server message. Server messages are generated in response to error conditions or to indicate server conditions of interest. They are generally handled within an application’s server-message callback. For more information about server messages, see Chapter 4, “Handling Errors and Messages.”

An application calls ct_res_info to retrieve a message ID.

Most synchronous applications use a program structure similar to the following one to process a message result set:

 case CS_MSG_RESULT
     ct_res_info to get the message ID
     code to handle the message ID
 end case