Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 1 (10.1)

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

Update Method

Applies To

ODynaset

OBinder

Description

This method saves dynaset changes to the Oracle database.

Usage

oresult Update(void)

Remarks

For ODynaset, Update is the end of the three-part record editing sequence:

  1. Call StartEdit.
  2. Change field values, either with SetFieldValue or SetValue.
  3. Call Update.
Calling Update saves to the Oracle database the changes that have been made. If you are in the middle of a transaction (that is, your session had BeginTransaction called on it), the changes are not made permanent until a Commit is done. Alternatively, the changes can be canceled with a Rollback.

For OBinder, Update saves any changes that have been marked in the current record. This results in the same behavior as ODynaset::Update.

ODATABASE_ORAMODE determines precisely what happens to values of fields that have not been explicitly set. See ODatabase for details.

Calling Update sends OADVISE_UPDATE messages to all advisories attached to the dynaset. If the dynaset is being managed by an OBinder object, PreUpdate and PostUpdate triggers are called.

Note that once you call Update on a given row in a dynaset in a global transaction (that is once you issue a BeginTrans), locks will remain on the selected rows until you call commit the transaction or rollback.

Return Value

An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).

Example

This example sets the salary in the current record to $9985.

// we have a dynaset named empdyn

// edit the salary

empdyn.StartEdit();

empdyn.SetFieldValue("salary", 9985.0);

empdyn.Update();