Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 » UltraLite - C and C++ Programming » Application development » Developing applications using the UltraLite C++ API


Handling errors

The UltraLite C++ API includes a ULError object that should be used to retrieve error information. Several methods in the API return a boolean value, indicating whether the method call was successful. In some instances, null is returned when an error occurs. The ULConnection object contains a GetLastError method, which returns a ULError object.

Use SQLCode to diagnose an error. In addition to the SQLCode, you can use the GetParameterCount and GetParameter methods to determine whether additional parameters exist to provide additional information about the error.

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 ULSetErrorCallback method.

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