Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 1 (10.1) Part Number B10119-01 |
|
Applies To
Description
OParameter constructor
Usage
OParameter(void)
OParameter(const OParameter &otherparam)
Arguments
otherparam |
Another OParameter object that you are copying. |
These methods construct a new OParameter instance.
The default constructor constructs an unopened OParameter object. It cannot fail.
The copy constructor copies another OParameter object. If that other OParameter object is open - which means it is a handle on an implementation parameter object - the new OParameter object becomes a handle to that same parameter object. The copy constructor copies the reference to the parameter object but does not copy any strings that the source OParameter may own. The copy constructor can fail; check whether the new OParameter is open after the constructor call.
There is no Open method for the OParameter class. To get an open OParameter, call the GetParameter method of the OParameterCollection class. The way that a parameter is actually created is by the OParameterCollection::Add method.
Example
This example creates a parameter and constructs an OParameter object.
// open a database
ODatabase odb("ExampleDB", "scott", "tiger");
OParameterCollection params = odb.GetParameters();
OParameter deptp;
deptp = params.Add("dno", 20, OPARAMETER_INVAR, OTYPE_NUMBER);
/*
By using the = operator we are invoking the copy constructor. It is copying the temporary object that is returned by the Add method.
*/
// use it
ODynaset empdyn;
empdyn.Open(odb, "select * from emp where deptno = :dno");