|Oracle Objects for OLE C++ Class Library
Part Number A95896-01
The OAdvise class enables you to set up callbacks that attach to a dynaset. When operations occur on the dynaset attached OAdvise instances are notified of the operations. You will not declare any instances of OAdvise yourself. Instead, you write a new class that is a subclass of OAdvise, and your subclass then receives calls to its methods. OAdvise is a subclass of OOracleObject.
When an operation occurs on a dynaset, the dynaset
The advisories are given a message that tells them what is happening. These messages are one of three types: navigational advisories, other advisories, and status changes. The specific defines are as follows:
// navigation advisories
OADVISE_MOVE_TOMARK // move to mark
// other advisories
OADVISE_REFRESH // dynaset being refreshed
OADVISE_DELETE // record being deleted
OADVISE_ADDNEW // new record being added
OADVISE_UPDATE // dynaset being updated
OADVISE_ROLLBACK // session being rolled back
OADVISE_OTHER // undefined advisories
// status changes
OADVISE_FOUNDLAST // dynaset knows that the last record has been read
The ActionRequest method is called before the operation. The advisory can cancel an operation by returning FALSE from the ActionRequest method; it must return TRUE from ActionRequest to allow the operation. The ActionNotify method is called after the operation. The StatusChange method is called when the dynaset status changes.
The OAdvise class does nothing. Its ActionRequest method always returns TRUE. To obtain other behavior, create a subclass of OAdvise and override the ActionRequest, ActionNotify, and StatusChange methods. Declare an instance of your subclass, and then open it to attach it to a dynaset.
It is often useful for your subclass to have its own members for reference to some sort of application context. You can add these, along with methods to set the context, in your own class. An example of an OAdvise subclass is provided in the Workbook.
The OAdvise class supports the following methods:
Construction and destruction: