Oracle Objects for OLE C++ Class Library Release 9.2 Part Number A95896-01 |
|
Applies To
Description
This method asks the Oracle database for a set of records and sets up a dynaset to access them.
Usage
oresult Open(const ODatabase &odb, const char * sqlstmt, long options = ODYNASET_DEFAULT, OSnapshotID *snapID = NULL)
oresult Open(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 |
---|---|
odb |
The database with which to open this dynaset. |
sqlstmt |
A valid select SQL statement. |
options |
Options to be used to create the dynaset. |
sqlstmt |
A valid select SQL statement. |
slicesize |
Cache slice size. |
perblock |
Cache slices per block. |
blocks |
Cache maximum number of blocks. |
fetchlimit |
Fetch array size. |
fetchsize |
Fetch array buffer size. |
The first method opens the ODynaset object, creating an underlying dynaset object. The dynaset is formed on records retrieved from the database represented by odb and the SQL select statement in sqlstmt. The ODynaset is automatically positioned at the first record after opening. The ODynaset copies the SQL statement, so the caller does not have to retain it.
The second Open method opens the ODynaset object using custom cache and fetch parameters.
The options argument can have the following values:
Open Method Options
Constant |
Value |
Description |
---|---|---|
ODYNASET_DEFAULT |
0 |
Accept the following default behavior: Behave like the default mode for an ODatabase object: Field values not explicitly set are set to NULL, overriding server column defaults. Perform automatic binding of database parameters. Strip trailing blanks from character string data retrieved from the database. Create an updatable dynaset. Cache data on client. Force a MoveFirst on dynaset creation. Maintain read-consistency. |
ODYNASET_NOBIND |
1 |
Do not perform automatic binding of database parameters. |
ODYNASET_KEEP_BLANKS |
2 |
Do not strip trailing blanks from character string data retrieved from the database. |
ODYNASET_READONLY |
4 |
Force dynaset to be read-only. |
ODYNASET_NOCACHE |
8 |
Do not create a local dynaset data cache. Without the local cache, previous rows within a dynaset are unavailable; however, increased performance results during retrieval of data from the database (move operations) and from the rows (field operations). Use this option in applications that make single passes through the rows of a dynaset for increased performance and decreased resource usage. |
ODYNASET_ORAMODE |
16 |
Behaves same as ODATABASE_ORAMODE for a ODatabase class except it affects only the dynaset being created. If the database was created in ODATABASE_ORAMODE mode, dynaset inherits the property for compatibility. |
ODYNASET_NO_REFETCH |
32 |
Behaves same as ODATABASE_NO_REFETCH mode for a ODatabase class except it affects only the dynaset being created. If database was created in ODATABASE_NO_REFETCH mode, the dynaset inherits the property for compatibility. |
ODYNASET_N_MOVEFIRST |
64 |
Does not force a MoveFirst on dynaset creation. BOF and EOF are both TRUE. |
ODYNASET_DIRTY_WRITE |
128 |
Update and Delete will not check for read consistency. |
Options may be combined by adding their respective values.
These values can be found in the file ORCL.H.
It is legal to Open an already open ODynaset. The ODynaset is closed and then opened with the new arguments.
Using a "FOR UPDATE" clause in the SQL statement that opens the dynaset requires some special attention. Please refer to Select for Update.
Return Value
An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).
Example
Examples of opening ODynasets:
// first, open an ODatabase
ODatabase odb("ExampleDB", "scott", "tiger");
// create and open a dynaset
ODynaset odyn;
odyn.Open(odb, "select * from emp");
isopen = odyn3.IsOpen();
// isopen is TRUE; the open was successful
|
Copyright © 1998, 2002 Oracle Corporation. All Rights Reserved. |
|