The ITErrorInfo interface

The ITErrorInfo interface includes methods that manage errors from the server or from the library. The ITErrorInfo interface enables your application to set callback routines that are called when an error occurs.

For details, see The ITErrorManager class.

This functionality of this interface is only supported with Informix® databases.

Value objects such as large objects and set interface objects that have methods that cause interactions with the server expose the ITErrorInfo interface. The following excerpts illustrate the correct use of the ITErrorInfo interface:
  1. Extract the large object interface.
    ITErrorInfo *errif;
    if (v->QueryInterface(ITLargeObjectIID, (void **) &loif)
        == IT_QUERYINTERFACE_SUCCESS)
    {
    }
  2. Extract the error management interface.
    // Extract the errorinfo interface.
    if (v->QueryInterface(ITErrorInfoIID, (void **) &errif)
        == IT_QUERYINTERFACE_SUCCESS)
    {
    }
  3. Close the connection before reading the large object.
    conn.Close();

    This induces an error.

  4. Check byte count. If 0 bytes were read, check to see if an error occurred.
    if (size == 0)
    {
        // No bytes were read. Was there an error?
        if (errif->Error()) 
        {
            cerr << "Zero bytes read. Server error was" << endl
                 << errif->ErrorText() << endl;
        }
    }