Module: DB Interface Module Group: Callback Classes
RWDBConnCallbackImp RWDBReference
databaseCallback() environmentHandle() postConnAllocate() |
postConnect() preConnAllocate() preConnDestroy() |
preConnect() preDisconnect() RWDBConnCallbackImp() |
setError() status() systemHandle() |
#include <rw/db/conncbi.h> class MyConnCallbackImp : public RWDBConnCallbackImp { public: // PreConnect callback virtual void preConnect(); // PostConnect callback virtual void postConnect(); }; RWDBConnection connection = myDbase.connection( RWDBCONNCALLBACK(MyConnCallbackImp));
RWDBConnCallbackImp is an implementation class and is reference counted.
It is the abstract base class for implementing connection callbacks. You will need to derive from this class to implement your custom connection callbacks.
This class provides six connection callback methods preConnAllocate(), postConnAllocate(), preConnect(), postConnect(), preDisconnect() and preConnDestroy(). Please refer to the DB Interface Module User's Guide and the applicable DB Access Module User's Guide for more information on these methods. You will need to redefine the methods to implement connection callbacks.
RWDBConnCallbackImp();
The default protected constructor.
virtual void preConnAllocate();
This callback is invoked just before the allocation of the database-specific connection handle. It is defined as a no-op. To implement preConnAllocate callback, you will need to derive from this class and redefine this method.
virtual void postConnAllocate();
This callback is invoked just after the allocation of the database-specific connection handle. It is defined as a no-op. To implement postConnAllocate callback, you will need to derive from this class and redefine this method.
virtual void preConnect();
This callback is invoked just before establishing the database connection. It is defined as a no-op. To implement preConnect callback, users will need to derive from this class and redefine this method.
virtual void postConnect();
This callback is invoked after establishing the database connection. It is defined as a no-op. To implement postConnect callback, you will need to derive from this class and redefine this method.
virtual void preDisconnect();
This callback is invoked just before the database connection is closed. It is defined as a no-op. To implement preDisconnect callback, you will need to derive from this class and redefine this method. This callback will typically be called from the destructor of an RWDBConnection object and, hence, you should refrain from throwing an exception.
virtual void preConnDestroy();
This callback is invoked just before the deallocation of the connection handle. It is defined as a no-op. To implement preConnDestroy callback, you will need to derive from this class and redefine this method. This callback is typically called from the destructor of an RWDBConnection object and, hence, you should refrain from throwing an exception.
RWDBDatabaseCallback databaseCallback() const;
Returns the RWDBDatabaseCallback associated with the RWDBDatabase object that produced the RWDBConnection object to which self is associated. If self is not associated with any RWDBConnection object, this callback returns an uninitialized RWDBDatabaseCallback object.
RWDBEnvironmentHandle* environmentHandle() const;
Returns pointer to the RWDBEnvironmentHandle of the RWDBDatabase object that produced the RWDBConnection object to which self is associated. If self is not associated with any RWDBConnection object, returns 0.
RWDBSystemHandle* systemHandle() const;
Returns pointer to the RWDBSystemHandle of the RWDBConnection object to which self is associated. If self is not associated with any RWDBConnection object, returns 0.
RWDBStatus status() const;
Returns the current status of self.
void setError(RWDBStatus::ErrorCode code, const RWCString& message, const RWCString& vendorMessage1 = RWCString(), const RWCString& vendorMessage2 = RWCString(), long vendorError1 = 0, long vendorError2 = 0, bool isTerminal = false, bool invokeErrorHandler = true, bool invalidateConnection = false);
Sets error on self. Optionally, invalidates the RWDBConnection object to which self is associated.
Parameters code, message, vendorMessage1, vendorMessage2, vendorError1, vendorError2 and isTerminal are RWDBStatus attributes used to set error on self's RWDBStatus object.
Parameter invokeErrorHandler indicates if the associated error handler should be invoked.
Parameter invalidateConnection indicates whether the RWDBConnection object to which self is associtaed should be invalidated. If invalidated, the RWDBConnection object will have an error code of RWDBStatus::applicationError.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.