Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 1 (10.1) Part Number B10119-01 |
|
Applies To
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. |
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