Handling specific messages

In some applications, the programmer may want to code special handling for certain message numbers.

For example, if a message is known to be informational and not an error message, you may not want the application to display the message to the end user. The example below shows a fragment from a server message callback that does not display messages 5701, 5703, or 5704. Adaptive Server always sends a 5701 message when a connection is opened and may also send the other two. Adaptive Server also sends a 5701 message after every successful use database command. Some end users may not want to see such messages. If the code shown below is placed at the top of the server message callback, these message numbers are ignored:

  /*
   ** Ignore these Server messages:
   **  5701 (changed database), 
   **  5703 (changed language),
   **  or 5704 (changed client character set)
   */
   if (srvmsg->msgnumber == 5701
       || srvmsg->msgnumber == 5703
       || srvmsg->msgnumber == 5704)
   {
     return CS_SUCCEED;
   }

This code is specific to Adaptive Server. These message numbers may mean something else entirely when connected to another type of server, such as an Open Server gateway or a custom Open Server application.