Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

CreateCustomDynaset Method

Example

Applies To

OraDatabase

Description

Creates a dynaset using custom cache and fetch parameters

Usage

Set oradynaset = oradatabase.CreateCustomDynaset(sql_statement, options, slicesize, perblock, blocks, FetchLimit, Fetchsize, SnapShotID)

Arguments
Description
sql_statement
Any valid Oracle SQL SELECT statement.
slicesize
Cache slice size.
perblock
Cache slices for each block.
blocks
Cache maximum number of blocks.
FetchLimit
Fetch array size.
FetchSize
Fetch array buffer size.
options
A bit flag indicating the status of any optional states of the dynaset. You can combine one or more options by adding their respective values. Specifying &H0& gives the following defaults for the dynaset:
· Behave like Visual Basic Mode for a database: 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.
SnapShotID [optional]
A SnapshotID obtained from the SnapShot property of an OraDynaset.

Constants
Constant
Value
Description
ORADYN_DEFAULT
&H0&
Accept the default behavior.
ORADYN_NO_AUTOBIND
&H1&
Do not perform automatic binding of database parameters.
ORADYN_NO_BLANKSTRIP
&H2&
Do not strip trailing blanks from character string data retrieved from the database.
ORADYN_READONLY
&H4&
Force dynaset to be read-only.
ORADYN_NOCACHE
&H8&
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.
ORADYN_ORAMODE
&H10&
Same as Oracle Mode for a database except it affects only the dynaset being created. If database was created in Oracle Mode, dynaset inherits the property from it (for compatibility)
ORADYN_NO_REFETCH
&H20&
Behaves same as ORADB_NO_REFETCH mode for a database except this mode affects only the dynaset being created. If the database was created in ORADB_NO_REFETCH mode, the dynaset inherits the property for compatibility.
ORADYN_N_MOVEFIRST
&H40&
Does not force a MoveFirst on dynaset creation. BOF and EOF are both TRUE.
ORADYN_DIRTY_WRITE
&H80&
Update and Delete will not check for read consistency.

These values can be found in the file oraconst.txt located in:

ORACLE_BASE\ORACLE_HOME\oo4o

Remarks

The SQL statement must be a SELECT statement or an error is returned. Features such as simple views and synonyms can be used freely. You can also schema references, column aliases, table joins, nested selects and remote database references, but in each case you will end up with a read-only dynaset.

If you use a complex expression or SQL function on a column, such as "sal + 100" or "abs(sal)" , you will get an updatable dynaset, but the column associated with the complex expression will not be updatable.

Object names generally are not modifed, but in certain cases they can be changed. For example, if you use a column alias, you must use the alias to refer to the field by name. Also if you use spaces in a complex expression, you must refer to the column without the spaces, since the database strips spaces. Note that you can always refer to a field by number, that is, by its ordinal position in the SELECT statement.

Executing the SQL SELECT statement generates a commit to the database by default. To avoid this, use BeginTrans on the session object before using CreateDynaset.

The updatability of the resultant dynaset depends on the Oracle SQL rules of updatability, on the access you have been granted, and on the options flag. For the dynaset to be updatable, three conditions must be met:

  1. A SQL statement must refer to a simple column list or to the entire column list (*)
  2. The statement must not set the read-only flag of the options argument
  3. Oracle must permit ROWID references to the selected rows of the query.
Any SQL statement that does not meet these criteria is processed, but the results are not updatable and the dynaset's Updatable property returns False.

This method automatically moves to the first row of the created dynaset.

You can use SQL bind variables in conjunction with the OraParameters collection.