Handling errors

You should check for errors after each database operation by using methods of the ULSqlca object. For example, LastCodeOK checks if the operation was successful, while GetSQLCode returns the numerical value of the SQLCode. For more information about the meaning of these values, see SQL Anywhere error messages sorted by Sybase error code.

In addition to explicit error handling, UltraLite supports an error callback function. If you register a callback function, UltraLite calls the function whenever an UltraLite error occurs. The callback function does not control application flow, but does enable you to be notified of all errors. Use of a callback function is particularly helpful during application development and debugging. For more information about using the callback function, see Tutorial: Build an application using the C++ API.

For a sample callback function, see Callback function for ULRegisterErrorCallback and ULRegisterErrorCallback function.

For a list of error codes thrown by the UltraLite C++ API, see SQL Anywhere error messages sorted by Sybase error code.