Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Interface Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

10.5 Callback Sequence

This section describes the callback sequence.

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

10.5.2 Callback sequence for a database callback producing a connection callback

The sequence of events remains the same except that you do not create the instance of UserConnCallbackImp. When the RWDBDatabase::connection() method is called, the RWDBDatabase calls the method produceConnCallback() on the UserDatabaseCallbackImp to produce the UserConnCallbackImp instance.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.