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 |
Called when 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 |
Called by DB Link when the RDBMS raises an error. More... | |
IlInt | getCode () const |
Get the curent error code. More... | |
const char * | getConnectStr () const |
Get the connection string. More... | |
IldDbms * | getDbms () 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... | |
std::ostream & | getOStream () const |
Get the current output stream. More... | |
const char * | getQuery () const |
Get the statement text. More... | |
IldRelation * | getRelation () const |
Get the relation object. More... | |
IldRequest * | getRequest () const |
Get the statement object. More... | |
IlInt | getSize () const |
Get the data size. More... | |
void | setOStream (std::ostream &ostr) |
Set the output stream for error reporting. More... | |
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 non-virtual 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").
IldDbms
, IldRequest
, IldIldBase
, "Connection String Format" and the chapter "Errors and Warnings" in the Rogue Wave DB Link User's Manual.
|
virtual |
Called when DB Link detects an internal error.
code | The internal error code. |
functionName | The name of the DB Link function that encountered the problem. |
message | The internal error message. |
dbms | The IldDbms object involved in the error. |
request | The IldRequest object involved in the error. |
query | Can be one of two character strings:
|
index | The erroneous index provided during a call to an accessor of one of the DB Link classes. |
rel | If 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 |
Called by DB Link when the RDBMS raises an error.
code | The error code returned by the RDBMS. |
functionName | The name of the DB Link function that encountered the problem. |
message | The error message returned by the RDBMS. |
dbms | The IldDbms object involved in the error. |
request | The IldRequest object involved in the error. |
query | Can be one of two character strings:
|
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.
const char* IldErrorReporter::getConnectStr | ( | ) | const |
Get the connection string.
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.
IldDbms
object, if a connection object is involved in the reported error. Otherwise, a null
pointer. IlInt IldErrorReporter::getIndex | ( | ) | const |
Get the column index.
const char* IldErrorReporter::getMessage | ( | ) | const |
Get the current error message.
const char* IldErrorReporter::getName | ( | ) | const |
Get the name of the object.
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.
ostream & IldErrorReporter::getOStream | ( | ) | const |
Get the current output stream.
const char * IldErrorReporter::getQuery | ( | ) | const |
Get the statement text.
IldRelation * IldErrorReporter::getRelation | ( | ) | const |
Get the relation object.
IldRelation
object, if a relation descriptor is involved in the reported error. IldRequest * IldErrorReporter::getRequest | ( | ) | const |
Get the statement object.
IldRequest
object, if a request is involved in the reported error. Otherwise, it returns a null
pointer. IlInt IldErrorReporter::getSize | ( | ) | const |
Get the data size.
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 | ( | std::ostream & | ostr | ) |
Set the output stream for error reporting.
ostr | The stream to use. |