A Client-Library application calls ct_diag to handle Client-Library and server messages inline.
An application can use inline error handling at the connection level only. That is, inline error handling cannot be enabled for a context. If an application has more than one connection, it must make separate ct_diag calls for each connection.
An application calls ct_diag to:
Initialize inline error handling.
Clear messages.
Get messages.
Limit the number of saved messages.
Find out how many messages are currently saved.
Retrieve the CS_COMMAND structure on which extended error data (if any) is available. See “Extended error data”.
Client-Library does not start saving messages for a connection until inline error handling has been initialized for the connection.
An application can retrieve client-message information into a CS_CLIENTMSG structure or a SQLCA, SQLCODE, or SQLSTATE structure. An application can retrieve server-message information with a CS_SERVERMSG structure or a SQLCA, SQLCODE, or SQLSTATE structure. For information about these structures, see the Open Client Client-Library/C Reference Manual.
If a Client-Library error occurs that makes a CS_CONNECTION structure unusable, ct_diag returns CS_FAIL when called to retrieve information about the original error.