Skip Headers
Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 2 (10.2)

Part Number B14308-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

OAdvise

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

  1. Calls all attached advisories before the operation occurs and allows them to veto the operation; and
  2. Calls all attached advisories after the operation to tell them that it occurred.

In addition, when the status of the dynaset changes, it notifies the advisory. In this release, the only dynaset status change is that which occurs when the dynaset has found the last record.

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_FIRST

OADVISE_MOVE_PREV

OADVISE_MOVE_NEXT

OADVISE_MOVE_LAST

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:

OAdvise

~OAdvise

operator=

Attributes:

operator==

operator!=

IsOpen

Operations:

ActionNotify
ActionRequest
Close
GetDynaset
Open
StatusChange
Error Handling:

ErrorNumber

ErrorReset

GetErrorText

LookupErrorText