The following examples demonstrate how command-processing errors are handled differently by DB-Library and Client-Library:
The application sends a language command that contains a syntax error:
In DB-Library, dbsqlexec or dbsqlok (whichever was called) invokes the application’s server message handler to forward the error reported by the server. dbsqlexec or dbsqlok returns FAIL. No data is returned, and a call to dbresults returns NO_MORE_RESULTS.
In Client-Library, ct_results forwards the error reported by the server by calling the application’s server message handler. ct_results returns CS_SUCCEED, but with result_type set to CS_CMD_FAIL. The application must process the rest of the results with ct_results or cancel them with ct_cancel.
The second statement in a language batch of four statements selects an object, but the user lacks select permission for the object:
In DB-Library, dbresults forwards the permissions violation reported by the server by calling the application’s server message handler. dbresults returns FAIL. Results from the rest of the commands in the batch are available, and the application must retrieve them with dbresults or cancel them with dbcancel.
In Client-Library, ct_results forwards the permissions violation reported by the server by calling the application’s server message handler. ct_results returns CS_SUCCEED, but with result_type set to CS_CMD_FAIL. The application must process the rest of the results with ct_results or cancel them with ct_cancel.