Oracle Objects for OLE C++ Class Library Release 9.2 Part Number A95896-01 |
|
Applies To
Description
ODynaset constructor
Usage
ODynaset(void)
ODynaset(const ODynaset &otherdyn)
ODynaset(const ODatabase &odb, const char *sqlstmt, long options = ODYNASET_DEFAULT, OSnapshotID *snapID = NULL)
ODynaset(const ODatabase &odb,const char *sqlstmt, unsigned int slicesize, unsigned int perblock, unsigned int blocks, unsigned int fetchlimit, unsigned int fetchsize, long options = ODYNASET_DEFAULT, OSnapshotID *snapID = NULL)
Arguments |
Description |
---|---|
otherdyn |
The ODynaset object to copy. |
odb |
The database on which to open this dynaset. |
sqlstmt |
A valid select SQL statement |
options |
Options to create the dynaset. |
slicesize |
Cache slice size. |
perblock |
Cache slices per block. |
blocks |
Cache maximum number of blocks. |
FetchLimit |
Fetch array size. |
FetchSize |
Fetch array buffer size. |
These methods construct a new ODynaset instance.
The default constructor constructs an unopened ODynaset object. It cannot fail. You must open the object before you can use it.
The copy constructor copies another ODynaset object. If that other ODynaset object is open - which means it is a handle on an implementation dynaset object - the new ODynaset object becomes a handle to that same dynaset object. The copy constructor copies the reference to the dynaset object but does not copy any strings that the source ODynaset may own. The copy constructor can fail; check whether the new ODynaset is open after the constructor call.
The third constructor both constructs and attempts to open the ODynaset object. Opening a ODynaset object creates a new dynaset object. An ODatabase and a SQL statement must be given to open the ODynaset. These specify which Oracle database to get the records from and which records to get. The options affect various aspects of the dynaset's behavior; see ODynaset section for more information. When the ODynaset is opened, it moves to the first record automatically. The copy and open constructor can fail; check whether the ODynaset object is open after the constructor call.
The fourth constructor constructs and attempts to open the ODynaset using custom cache and fetch parameters.
Using a "FOR UPDATE" clause in the SQL statement that opens the dynaset requires some special attention. Refer to Select for Update.
Example
Examples of opening ODynasets:
// first we need a database
ODatabase odb("ExampleDB", "scott", "tiger");
// default constructor
ODynaset odyn;
oboolean isopen = odyn.IsOpen();
// isopen is FALSE
// copy constructor
ODynaset odyn2(odyn);
isopen = odyn2.IsOpen();
// isopen is FALSE because odyn was not open
// create and open a dynaset
ODynaset odyn3(odb, "select * from emp");
isopen = odyn3.IsOpen();
// isopen is TRUE - the open was successful
// and now if we use a copy constructor
ODynaset odyn4(odyn3);
isopen = odyn4.IsOpen();
// isopen is TRUE
odyn4.MoveLast();
// now odyn3 also refers to the last record, because
// odyn3 and odyn4 are handles to the same dynaset
|
Copyright © 1998, 2002 Oracle Corporation. All Rights Reserved. |
|