SourcePro® 2021.1 |
SourcePro® API Reference Guide |
Product Documentation: SourcePro Documentation Home |
Abstract base class from which all custom database callbacks derive. More...
#include <rw/db/dbasecbi.h>
Inherits RWDBReference.
Inherited by RWDBDatabaseDefaultCallbackImp.
Public Member Functions | |
virtual void | connParams (const RWCString &serverName, const RWCString &userName, RWCString &password, const RWCString &databaseName, const RWCString &propertyString) |
RWDBEnvironmentHandle * | environmentHandle () const |
virtual void | postEnvAllocate () |
virtual void | preEnvAllocate () |
virtual void | preEnvDestroy () |
virtual RWDBConnCallback | produceConnCallback () |
RWCString | serverType () const |
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 invalidateDatabase=false) |
RWDBStatus | status () const |
Protected Member Functions | |
RWDBDatabaseCallbackImp () | |
RWDBDatabaseCallbackImp is a reference-counted implementation class that is the abstract base class for implementing database callbacks. Derive from this class to implement your custom database callbacks.
This class provides three database callback methods: preEnvAllocate(), postEnvAllocate() and preEnvDestroy(). It also provides a connection callback producer method produceConnCallback(). Please refer to the DB Interface Module User's Guide and applicable DB Access Module User's Guide for more information on these methods. You need to redefine the methods to implement database callbacks and/or produce connection callback instances.
|
inlineprotected |
The default protected constructor.
|
virtual |
This callback is invoked just before opening a connection to the database. It passes to the callback function the parameters used to establish a database connection. All the parameters, except password, are passed as const
and so cannot be modified. The password set during this call will be used to open a connection to the database. To implement connParams()
callback, derive from this class and redefine this method.
RWDBEnvironmentHandle* RWDBDatabaseCallbackImp::environmentHandle | ( | ) | const |
Returns a pointer to the RWDBEnvironmentHandle of the RWDBDatabase object to which self is associated. If self is not associated with any RWDBDatabase object, returns 0
.
|
virtual |
This callback is invoked after the allocation of database-specific-environment/context handle. It is defined as a no-op. To implement postEnvAllocate callback, derive from this class and redefine this method.
|
virtual |
This callback is invoked just before the allocation of database-specific environment/context handle. It is defined as a no-op. To implement preEnvAllocate callback, derive from this class and redefine this method.
|
virtual |
This callback is invoked just before the deallocation of environment/context handle. It is defined as a no-op. To implement preEnvDestroy callback, derive from this class and redefine this method. This callback is typically called from the destructor of the RWDBDatabase object and, hence, applications should refrain from throwing an exception.
|
virtual |
This method must produce a new instance of a connection callback implementation.
An RWDBDatabase object invokes this method when producing a new RWDBConnection object. The RWDBConnCallback object produced by this method is then associated with the new RWDBConnection.
Note that this method produces an uninitialized connection callback object with all connection callbacks as no-ops. To produce custom connection callbacks, derive from this class and redefine this method to produce new instances of connection callbacks using the macro RWDBCONNCALLBACK(CALLBACK).
For example:
RWCString RWDBDatabaseCallbackImp::serverType | ( | ) | const |
Returns the serverType of the RWDBDatabase object to which self is associated. If self is not associated with any RWDBDatabase object, returns an empty string.
void RWDBDatabaseCallbackImp::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 | invalidateDatabase = false |
||
) |
Sets an error on self. Optionally, invalidates the RWDBDatabase object to which self is associated.
code | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
message | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
vendorMessage1 | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
vendorMessage2 | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
vendorError1 | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
vendorError2 | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
isTerminal | RWDBStatus attribute used to set the error on self's RWDBStatus object. |
invokeErrorHandler | Indicates if the associated error handler should be invoked. |
invalidateDatabase | Indicates if the RWDBDatabase object to which self is associated should be invalidated. If invalidated, the RWDBDatabase object has an error code of RWDBStatus::applicationError. |
|
inline |
Returns the current status of self.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |