SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Protected Member Functions
RWDBConnCallbackImp Class Reference

Abstract base class from which all custom connection callbacks must derive. More...

#include <rw/db/conncbi.h>

Inherits RWDBReference.

Inherited by RWDBConnDefaultCallbackImp.

Public Member Functions

RWDBDatabaseCallback databaseCallback () const
 
RWDBEnvironmentHandleenvironmentHandle () const
 
virtual void postConnAllocate ()
 
virtual void postConnect ()
 
virtual void preConnAllocate ()
 
virtual void preConnDestroy ()
 
virtual void preConnect ()
 
virtual void preDisconnect ()
 
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)
 
RWDBStatus status () const
 
RWDBSystemHandlesystemHandle () const
 

Protected Member Functions

 RWDBConnCallbackImp ()
 

Detailed Description

RWDBConnCallbackImp is an abstract base implementation class used for implementing connection callbacks. It is reference counted.

You must derive from this class to implement your custom connection callbacks.

This class provides six connection callback methods that you must redefine in your derived class: 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.

Synopsis
#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));

Constructor & Destructor Documentation

RWDBConnCallbackImp::RWDBConnCallbackImp ( )
inlineprotected

The default protected constructor.

Member Function Documentation

RWDBDatabaseCallback RWDBConnCallbackImp::databaseCallback ( ) const

Returns the RWDBDatabaseCallback associated with the RWDBDatabase object that produced the RWDBConnection object associated with self. If self is not associated with any RWDBConnection object, this callback returns an uninitialized RWDBDatabaseCallback object.

RWDBEnvironmentHandle* RWDBConnCallbackImp::environmentHandle ( ) const

Returns a pointer to the RWDBEnvironmentHandle of the RWDBDatabase object that produced the RWDBConnection object associated with self. If self is not associated with any RWDBConnection object, returns 0.

virtual void RWDBConnCallbackImp::postConnAllocate ( )
virtual

This callback is invoked just after the allocation of the database-specific connection handle. It is defined as a no-op. To implement it, derive from this class and redefine this method.

virtual void RWDBConnCallbackImp::postConnect ( )
virtual

This callback is invoked after establishing the database connection. It is defined as a no-op. To implement it, derive from this class and redefine this method.

virtual void RWDBConnCallbackImp::preConnAllocate ( )
virtual

This callback is invoked just before the allocation of the database-specific connection handle. It is defined as a no-op. To implement it, derive from this class and redefine this method.

virtual void RWDBConnCallbackImp::preConnDestroy ( )
virtual

This callback is invoked just before the deallocation of the connection handle. It is defined as a no-op. To implement it, derive from this class and redefine this method. This callback is typically called from the destructor of an RWDBConnection object and therefore, you should refrain from throwing an exception.

virtual void RWDBConnCallbackImp::preConnect ( )
virtual

This callback is invoked just before establishing the database connection. It is defined as a no-op. To implement it, derive from this class and redefine this method.

virtual void RWDBConnCallbackImp::preDisconnect ( )
virtual

This callback is invoked just before the database connection is closed. It is defined as a no-op. To implement it, derive from this class and redefine this method. This callback is typically called from the destructor of an RWDBConnection object and therefore, you should refrain from throwing an exception.

void RWDBConnCallbackImp::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 associated with self.

Parameters code, message, vendorMessage1, vendorMessage2, vendorError1, vendorError2 and isTerminal are RWDBStatus attributes used to set an error on self's RWDBStatus object.

Parameter invokeErrorHandler indicates if the associated error handler should be invoked.

Parameter invalidateConnection indicates whether the RWDBConnection object associated with self should be invalidated. If invalidated, the RWDBConnection object will have an error code of RWDBStatus::applicationError.

RWDBStatus RWDBConnCallbackImp::status ( ) const
inline

Returns the current status of self.

RWDBSystemHandle* RWDBConnCallbackImp::systemHandle ( ) const

Returns a pointer to the RWDBSystemHandle of the RWDBConnection object associated with self. If self is not associated with any RWDBConnection object, returns 0.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.