Home How To Online Documentation Support Download Order





Enums and Typedefs

Class Members


SAException object

Exceptions occur when a program executes abnormally due to conditions outside the program's control, such as server error, etc. Abnormal situations should be handled by throwing and catching exceptions.A SAException object represents an exception that is used by the Library to report errors. A SAException object handles the next error classes:

  • User-generated errors
  • Library errors
  • DBMS API errors 

To get a class of error call ErrClass method.

The Library errors are generated by the Library itself. It can be like detecting some mistake in passing arguments to the function or referencing the parameter with an inappropriate name. To get a Library-defined error text call ErrText method.

The DBMS API errors come to the Library from the DBMS Client or Server. In this case the Library returns an error code and text Client- or Server-defined. To get error code and error text returned by the server call ErrNativeCode and ErrText methods.

The User-generated exception is an exception thrown by the user. To throw a user exception use throwUserException method. 

To handle an exception use standard C++ exception-handling mechanism:

// Normal program statements
    // Execute some code that might throw an exception.
catch( SAException& e )
    // Handle the exception here.
    // "e" contains information about the exception.
    printf("Error code: %d   ErrorText: %s", e.ErrNativeCode(), e.ErrText());
// Other normal program statements

Problems and Questions

If you haven't found the answer to your questions or have some problems on using the Library, please, send e-mail to howto@sqlapi.com.