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

ActionRequest Method

Applies To

OAdvise

Description

The ActionRequest method is called by a dynaset when that dynaset is about to start an operation. You do not call ActionRequest; the ActionRequest method of your OAdvise subclass is called by the dynaset.

Usage

oboolean ActionRequest(int actiontype)

Arguments

actiontype will have one of the following values:

Value
Description
OADVISE_MOVE_FIRST
// dynaset moving to first record
OADVISE_MOVE_PREV
// dynaset moving to previous record
OADVISE_MOVE_NEXT
// dynaset moving to next record
OADVISE_MOVE_LAST
// dynaset moving to last record
OADVISE_MOVE_TOMARK
// dynaset moving to dynaset mark
OADVISE_REFRESH
// dynaset refreshing
OADVISE_DELETE
// dynaset deleting current record
OADVISE_ADDNEW
// dynaset adding a new record
OADVISE_UPDATE
// dynaset updating
OADVISE_ROLLBACK
// session (that dynaset is part of) is rolling back

Remarks

When you subclass OAdvise, you can override the ActionRequest method. After an instance of your OAdvise subclass is attached to a dynaset (by way of the OAdvise::Open method), your instance receives calls to its ActionRequest method. Use an ActionRequest method to control whether certain dynaset actions should be allowed to proceed, or to do your own processing before dynaset actions occur.

The unoverridden ActionRequest method of OAdvise always returns TRUE, allowing all dynaset operations to proceed immediately.

Return value

TRUE - tells the dynaset that the action can proceed

FALSE - tells the dynaset to cancel the action

Example

This example attempts to save a change to the current record if there is one. This is an action that needs to be taken before the dynaset does an operation.

oboolean YourOAdvise::ActionRequest(int actiontype)
{
    // check whether we have an unsaved change in this record
    int error;
    if (m_havechange)
    { // we have a change, try to save it
        error = m_context->SaveTheChange();
        if (error != 0)
        { // some problem - cancel the action
            return(FALSE);
        }
    }

    // everything is fine, allow the action
    return(TRUE);
}