Abstract base class from which all custom database callbacks derive.
More...
#include <rw/db/dbasecbi.h>
Inherits RWDBReference.
Inherited by RWDBDatabaseDefaultCallbackImp.
|
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 |
|
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.
- Synopsis
#include <rw/db/dbasecbi.h>
public:
virtual void postEnvAllocate();
};
"accessLib", "Servername", "Username", "Password", "DatabaseName",
RWDBDATABASECALLBACK(MyDBaseCallbackImp));
Handle class for connection callbacks that encapsulate a reference-counted pointer to the RWDBConnCal...
Definition conncb.h:55
Abstract base class from which all custom database callbacks derive.
Definition dbasecbi.h:53
Manages connections with database servers.
Definition dbase.h:91
static RWDBDatabase database(const RWCString &serverType, const RWCString &serverName, const RWCString &userName, const RWCString &password, const RWCString &databaseName, const RWDBDatabaseCallback &databasecb=RWDBDatabaseCallback())
◆ RWDBDatabaseCallbackImp()
RWDBDatabaseCallbackImp::RWDBDatabaseCallbackImp |
( |
| ) |
|
|
inlineprotected |
The default protected constructor.
◆ connParams()
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.
◆ environmentHandle()
◆ postEnvAllocate()
virtual void RWDBDatabaseCallbackImp::postEnvAllocate |
( |
| ) |
|
|
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.
◆ preEnvAllocate()
virtual void RWDBDatabaseCallbackImp::preEnvAllocate |
( |
| ) |
|
|
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.
◆ preEnvDestroy()
virtual void RWDBDatabaseCallbackImp::preEnvDestroy |
( |
| ) |
|
|
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.
◆ produceConnCallback()
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:
return RWDBCONNCALLBACK(MyConnCallbackImp);
}
◆ serverType()
RWCString RWDBDatabaseCallbackImp::serverType |
( |
| ) |
const |
◆ setError()
Sets an error on self. Optionally, invalidates the RWDBDatabase object to which self is associated.
- Parameters
-
◆ status()
RWDBStatus RWDBDatabaseCallbackImp::status |
( |
| ) |
const |
|
inline |
Returns the current status of self.