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

AutoEnable Method

Applies To

OParameter

Description

This method turns the AutoEnable status for a parameter on or off.

Usage

oresult AutoEnable(oboolean enable)

Arguments

enable
If TRUE, enables the parameter. If FALSE, disables the parameter.
Remarks

Parameters can have auto-enabling turned on or off. Only parameters that have auto-enabling turned on can be bound to newly executed SQL statements. Disabling a parameter does not change its use in an already executed SQL statement.

If Update or Delete methods fail on a given row in a dynaset in a global transaction (that is once you issue a BeginTrans), be aware that locks will remain on those rows on which you called Update or Delete. These locks will persist until you call CommitTrans or Rollback.

Return Value

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

Example

This example adds, enables, and disables a parameter.

// add a parameter to an existing ODatabase: odb

OParameterCollection params = odb.GetParameters();

OParameter deptp;

// initial value of 20

deptp = params.Add("dno", 20, OPARAMETER_INVAR, OTYPE_NUMBER);

// disable it

deptp.AutoEnable(FALSE);

// try to use it

ODynaset empdyn;

oresult ores;

ores = empdyn.Open(odb, "select * from emp where deptno = :dno");

// that failed: ores == OFAILURE

// enable the parameter and try again

deptp.AutoEnable(TRUE);

ores = empdyn.Open(odb, "select * from emp where deptno = :dno");

// now ores == OSUCCESS