rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWDBDatabaseCallbackImp Class Reference
[Callbacks]

Abstract base class from which all custom database callbacks derive. More...

#include <rw/db/dbasecbi.h>

Inherits RWDBReference.

Inherited by RWDBDatabaseDefaultCallbackImp.

List of all members.

Public Member Functions

virtual void preEnvAllocate ()
virtual void postEnvAllocate ()
virtual void preEnvDestroy ()
RWDBEnvironmentHandleenvironmentHandle () const
RWCString serverType () const
virtual RWDBConnCallback produceConnCallback ()
RWDBStatus status () 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)

Protected Member Functions

 RWDBDatabaseCallbackImp ()

Detailed Description

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>

 class MyDBaseCallbackImp : public RWDBDatabaseCallbackImp {
 public:
     // PostEnvAllocate callback
     virtual void postEnvAllocate();

     // Connection callback producer
     virtual RWDBConnCallback produceConnCallback();
 };

 RWDBDatabase dBase =
   RWDBManager::database("accessLib", "Servername",
                         "Username", "PassWord",
                         "DatabaseName",
              RWDBDATABASECALLBACK(MyDBaseCallbackImp) );

Constructor & Destructor Documentation

RWDBDatabaseCallbackImp::RWDBDatabaseCallbackImp (  )  [inline, protected]

The default protected constructor.


Member Function Documentation

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 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.

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.

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.

virtual RWDBConnCallback RWDBDatabaseCallbackImp::produceConnCallback (  )  [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.

Parameters:
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.
RWDBStatus RWDBDatabaseCallbackImp::status (  )  const [inline]

Returns the current status of self.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.