Customizing the Error Handling Mechanism
Rogue Wave DB Link assumes that the client application will have to run 24 hours a day, seven days a week, so it provides a full error-handling mechanism that does not allow the application to exit prematurely. This mechanism captures warning messages and errors. Its mainspring is an object of the class
IldErrorReporter.
To a certain extent, you can customize the mechanism by subtyping this class. Doing so enables you to set your own error reporters on every object of the classes
IldDbms and
IldRequest, by using the member functions
IldDbms::setErrorReporter or
IldRequest::setErrorReporter. It is an error to try to set a null value as the error reporter since the error
ILD_NO_REPORTER is then raised in the calling object.
Customizing the error handling mechanism is done in two main steps:
class UserErrorReporter: public IldErrorReporter {
public:
virtual void dbmsError(IlInt,
const char*,
const char*,
IldDbms*,
IldRequest* = 0,
const char* = 0) const;
virtual void dblinkError(IlInt,
const char*,
const char*,
IldDbms*,
IldRequest* = 0,
const char* = 0,
IlInt = (IlInt)0,
const IldRelation* = 0) const;
};
2. Create an instance of your derived class and attach it to the Rogue Wave DB Link object you choose.
// The following UserErrorReporter objects will be
// destroyed by the IldDbms and IldRequest destructors
// respectively.
UserErrorReporter* dbmsReporter = new UserErrorReporter;
UserErrorReporter* requestReporter = new UserErrorReporter;
...
cout << "Error reporter set to user defined one" << endl;
dbms->setErrorReporter(dbmsReporter);
...
cout << "Setting request error reporter to user defined one" << endl;
request->setErrorReporter(requestReporter);
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.