Instantiating RWDBStoredProc
RWDBStoredProc instances are obtained from RWDBDatabase instances by invoking the latter's storedProc() method with the stored procedure's name. RWDBStoredProc contains an RWDBSchema to store information about its formal parameters. This information is necessary for the library to successfully match actual arguments supplied by your application with the procedure's formal parameter list. The schema information is fetched automatically whenever an RWDBStoredProc is instantiated, so instantiating an RWDBStoredProc is a more expensive proposition than instantiating most objects of the DB Interface Module.
NOTE: Unlike most objects of the DB Interface Module, instantiation of a stored procedure object requires database access.
Since the storedProc() method of RWDBDatabase involves a database access, it has a variant with which you can specify the connection to use. If only the procedure name is provided, a default connection is used.
The insertion operator << is used to pass actual parameters to an RWDBStoredProc. Use it to insert actual values if the stored procedure expects IN parameters, or to insert pointers to values if the stored procedure expects OUT or IN/OUT parameters and your application needs to obtain results through the parameters. It is an error to insert a NULL pointer; if you do, the status of RWDBStoredProc changes to RWDBStatus::nullReference. A NULL value can be inserted using rwdbNull.
The indexing operator [ ] can be used to access a particular parameter position by number or by name. For the stored procedure myStoredProc, which expects the parameters number and name in that order, the following notations are equivalent:
 
myStoredProc << 1 << "Hello, world";
 
myStoredProc[0] << 1;
myStoredProc[1] << "Hello, world";
 
myStoredProc[1] << "Hello, world";
myStoredProc[0] << 1;
 
myStoredProc["name"] << "Hello, world";
myStoredProc["number"] << 1;