rwlogo

Rogue Wave DBLink API Reference Guide

Product Documentation:

Rogue Wave DBLink
Documentation Home

List of all members | Public Member Functions
IldErrorReporter Class Reference

The class IldErrorReporter organizes the way in which DB Link errors are handled. More...

#include <ildblink/dberr.h>

Public Member Functions

virtual void dblinkError (IlInt code, const char *functionName, const char *message, IldDbms *dbms, IldRequest *request=0, const char *query=0, IlInt index=0, const IldRelation *rel=0) const
 This virtual member function is called each time DB Link detects an internal error. More...
 
virtual void dbmsError (IlInt code, const char *functionName, const char *message, IldDbms *dbms, IldRequest *request=0, const char *query=0) const
 DB Link calls this virtual member function each time the RDBMS raises an error. More...
 
IlInt getCode () const
 Get the curent error code. More...
 
const char * getConnectStr () const
 Get the connection string. More...
 
IldDbmsgetDbms () const
 Get the connection object. More...
 
IlInt getIndex () const
 Get the column index. More...
 
const char * getMessage () const
 Get the current error message. More...
 
const char * getName () const
 Get the name of the object. More...
 
IL_STDPREF ostream & getOStream () const
 Get the current output stream. More...
 
const char * getQuery () const
 Get the statement text. More...
 
IldRelationgetRelation () const
 Get the relation object. More...
 
IldRequestgetRequest () const
 Get the statement object. More...
 
IlInt getSize () const
 Get the data size. More...
 
void setOStream (IL_STDPREF ostream &ostr)
 Set the output stream for error reporting. More...
 

Detailed Description

The class IldErrorReporter organizes the way in which DB Link errors are handled.

Library: dbkernel

The API of this class includes three virtual functions and a set of nonvirtual functions, one for each possible type of error. When an abnormal situation occurs, DB Link invokes the appropriate member function, and that function, in turn, calls one of the three virtual functions. By redefining these virtual functions, you can customize the way your application handles errors. See the section "Customizing the Error Handling Mechanism" in the Rogue Wave DB Link User's Manual for more information.

You can attach an output stream (that is, an instance of the C++ class ostream) to an IldErrorReporter object by calling the member function IldErrorReporter::setOStream.

You can retrieve the output stream attached to an error object by calling the member function IldErrorReporter::getOStream.

Once you have attached an output stream to an error object, DB Link will put the symbolic code and message of any error raised on that output stream in the following format:

function name = symbolic error code = error message

The function name indicates which DB Link member function raised the error. See the section "Output Error Stream" in the Rogue Wave DB Link User's Manual for a complete list of the valid values that can be assigned to the function name. The manual also documents the errors that can be raised by the member functions of the DB Link classes, indicating their source and recovery (see the section "Errors").

See Also
IldDbms, IldRequest, IldIldBase, "Connection String Format" and the chapter "Errors and Warnings" in the Rogue Wave DB Link User's Manual.

Member Function Documentation

virtual void IldErrorReporter::dblinkError ( IlInt  code,
const char *  functionName,
const char *  message,
IldDbms dbms,
IldRequest request = 0,
const char *  query = 0,
IlInt  index = 0,
const IldRelation rel = 0 
) const
virtual

This virtual member function is called each time DB Link detects an internal error.

Parameters
codeThe internal error code.
functionNameThe name of the DB Link function that encountered the problem.
messageThe internal error message.
dbmsThe IldDbms object involved in the error.
requestThe IldRequest object involved in the error.
queryCan be one of two character strings:
  • Either the character string used during the attempt to connect to the RDBMS with the IldDbms object (which attempt failed because no more free connections were available),
  • Or an SQL select command that failed when the IldRequestobject encountered an unknown data type.
indexThe erroneous index provided during a call to an accessor of one of the DB Link classes.
relIf the index passed with the previous argument involves an accessor for the class IldRelation, the argument rel is provided during the call to the virtual function. Otherwise the argument is null.

When the argument dbms is non-null, the argument request is null. Conversely, when the argument request is non-null, the argument dbms is null because an error cannot occur simultaneously both in an IldDbms object and in an IldRequest object.

Certain DB Link errors can be corrected by this virtual function so that normal execution of other DB Link functions is resumed after the error is corrected.

virtual void IldErrorReporter::dbmsError ( IlInt  code,
const char *  functionName,
const char *  message,
IldDbms dbms,
IldRequest request = 0,
const char *  query = 0 
) const
virtual

DB Link calls this virtual member function each time the RDBMS raises an error.

Parameters
codeThe error code returned by the RDBMS.
functionNameThe name of the DB Link function that encountered the problem.
messageThe error message returned by the RDBMS.
dbmsThe IldDbms object involved in the error.
requestThe IldRequest object involved in the error.
queryCan be one of two character strings:
  • Either the character string used during the attempt to connect to the RDBMS with the IldDbms object,
  • Or an SQL statement that failed with an IldRequest object.

There is always one and only one of the dbms or request arguments whose value is not null. When the argument dbms is non-null, the argument request is null. Conversely, when the argument request is non-null, the argument dbms is null because an error cannot occur simultaneously both in an IldDbms object and in an IldRequest object.

IlInt IldErrorReporter::getCode ( ) const

Get the curent error code.

Returns
The error code (a symbol) associated with the invoking error reporter.
const char* IldErrorReporter::getConnectStr ( ) const

Get the connection string.

Returns
The connection string used to make the current connection.

For more information about valid connection strings, see the section "Connection String Format" in the Rogue Wave DB Link User's Manual.

IldDbms * IldErrorReporter::getDbms ( ) const

Get the connection object.

Returns
The pointer to the IldDbms object, if a connection object is involved in the reported error. Otherwise, it returns null.
IlInt IldErrorReporter::getIndex ( ) const

Get the column index.

Returns
The column index, if a column is involved in the reported error.
const char* IldErrorReporter::getMessage ( ) const

Get the current error message.

Returns
The message (a string) associated with the invoking error reporter.
const char* IldErrorReporter::getName ( ) const

Get the name of the object.

Returns
The character string indicating the name of the object involved in the reported error.

Depending on the kind of error that occurred, the object can be one of the following: host name, column name, database name, parameter name, or file name.

IL_STDPREF ostream & IldErrorReporter::getOStream ( ) const

Get the current output stream.

Returns
A reference to the current output stream for error reporting.
const char * IldErrorReporter::getQuery ( ) const

Get the statement text.

Returns
The character string containing the query, if an SQL query is involved in the reported error.
IldRelation * IldErrorReporter::getRelation ( ) const

Get the relation object.

Returns
The pointer to the IldRelation object, if a relation descriptor is involved in the reported error.
IldRequest * IldErrorReporter::getRequest ( ) const

Get the statement object.

Returns
The pointer to the IldRequest object, if a request is involved in the reported error. Otherwise, it returns null.
IlInt IldErrorReporter::getSize ( ) const

Get the data size.

Returns
The size in bytes of the data involved in the reported error.

This information is relevant when a column is being bound but the size given for the binding was inappropriate for the type of data in that column.

void IldErrorReporter::setOStream ( IL_STDPREF ostream &  ostr)

Set the output stream for error reporting.

Parameters
ostrThe stream to use.

© Copyright 2014, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.