TTStatus Reference

The TTStatus class is used by other classes in the TTClasses library to catch error and warning exceptions. You can think of TTStatus as a value-added C++ wrapper around the SQLError ODBC function.

Subclasses

TTStatus has these subclasses:

Subclass Description

TTError

TTError is used to encapsulate ODBC errors (return codes SQL_ERROR and SQL_INVALID_HANDLE).

TTWarning

TTWarning is used to encapsulate ODBC warnings (return code SQL_SUCCESS_WITH_INFO).

See TTCStatus Usage for additional information about TTError and TTWarning.

Public Members

Member Description

rc

Return code from the failing ODBC call: SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_NO_DATA_FOUND, or SQL_INVALID_HANDLE

(SQL_NO_DATA_FOUND, an ODBC 2.0 return code, is defined in sqlext.h, which is included by timesten.h.)

native_error

TimesTen native error number (if any) for the failing ODBC call

odbc_error

ODBC error state for the failing ODBC call

err_msg

ASCII printable error message for the failing ODBC call

Public Methods

This section summarizes then describes the TTStatus public methods.

Public Methods Summary

Method Description

isConnectionInvalid()

Indicates whether the database connection is invalid.

operator<<

Outputs the error message.

throwError()

Throws an error from the TTStatus object (not typical use).

isConnectionInvalid()

bool isConnectionInvalid() const

Returns TRUE if the database connection is invalid, or FALSE if it is valid. Specifically, "invalid" refers to situations when a TimesTen error 846 or 994 is encountered. See Errors 0 - 999 in Oracle TimesTen In-Memory Database Error Messages and SNMP Traps.

operator<<

The operator (<<) writes the error message to an output stream. Following is an example.

try {
  // ...
  // something has gone wrong
    throw stat;
}
catch (TTStatus st) {
  cerr << "Caught exception: " << st << endl;
}

throwError()

void throwError()

This is an alternative, but not typical, way to throw an exception. (The more typical usage is shown in the preceding operator<< section.)

try {
  // ...
  if (/* something has gone wrong */)
    stat.throwError();
}
catch (TTStatus st) {
  cerr << "Caught exception: " << st << endl;
}