Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Applies To
Description
This method closes the object.
Usage
oresult Close(oboolean doShutdown = TRUE)
Arguments
doShutdown | If TRUE (the default), the Shutdown triggers are called. If FALSE, the Shutdown triggers are not called. |
Closing an OBinder object frees all its resources and makes it unusable (until it is reopened). You might want to do this if the OBinder is a member variable of an object that you do not want to destroy yet, but you do not need the OBinder anymore.
Normally when you close an OBinder object you should let doShutdown be TRUE and call the Shutdown triggers (both the OBinder trigger and the triggers for all OBound objects bound to this OBinder). Depending on the circumstances and precisely what your OBound objects do on the Shutdown trigger, this can fail. Calling Close with doShutdown FALSE will not call the Shutdown triggers, but it also does not fail.
Note that once the OBinder object has been Closed, all of the OBound objects that were bound to the OBinder are unbound - just as if each had called the OBound::Unbind method.
Return Value
An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).
Example
This example shows the closing of an OBinder
// we have an OBinder object called empblock
// bind an OBoundVal object to it (see the Workbook)
OBoundVal sal;
sal.BindToBinder(&empblock, "sal");
// now close the OBinder
empblock.Close();
// that called OBoundVal.Shutdown()
salary = (int) sal;
// salary is always 0 now because sal is unbound
ODynaset empdyn = empblock.GetDynaset();
// empdyn is closed and empdyn.IsOpen() is FALSE,
// because empblock is Closed