SourcePro DB : DB Interface Module User’s Guide : PART III Using Advanced Features : Database and Connection Callbacks : Callback Sequence : Callback sequence for a database callback and explicit connection callback
Callback sequence for a database callback and explicit connection callback
1. Create an instance of the class UserDatabaseCallbackImp and pass it in the method RWDBManager::database().
This method creates an instance of RWDBDatabase and also creates the RWDBEnvironmentHandle associated with it. The creation of the RWDBEnvironmentHandle allocates the database-specific environment/context handle and, thus, invokes the preEnvAllocate() and postEnvAllocate() callbacks just before and just after its allocation.
2. Create an instance of the class UserConnCallbackImp and pass it in the method RWDBDatabase::connection().
This call creates an instance of RWDBConnection and the R WDBSystemHandle associated with it. The creation of RWDBSystemHandle results in allocation of the database-specific connection handle. The callbacks preConnAllocate() and postConnAllocate() are called just before and just after the connection handle allocation.
3. RWDBDatabase then opens the connection resulting in two more callbacks — preConnect() and postConnect() — just before and just after establishing the database connection.
4. When the RWDBConnection object is destroyed, the database connection is closed and the connection handle is deallocated. The callback preDisconnect() is called before closing the database connection. The callback preConnDestroy() is called before deallocating the connection handle.
5. Similarly, during the destruction of the RWDBDatabase object, the callback preEnvDestroy() is called just before deallocating the environment/context handle.
NOTE: Note that connParams() is not considered here because the timing when it is called is not fixed relative to other callbacks.