Oracle® Objects for OLE Developer's Guide 10g Release 1 (10.1) Part Number B10118-01 |
|
See Also |
Example |
Description
Creates an OraDynaset object from the specified SQL SELECT statement and options.
Usage
Set oradynaset = oradatabase.CreateDynaset(sql_statement, options, SnapShotID)
Set oradynaset = oradatabase.DbCreateDynaset(sql_statement, options, SnapShotID)
Arguments |
Description |
---|---|
sql_statement |
A string containing any valid Oracle SQL SELECT statement. |
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. |
Options Flag Values
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& |
Behaves 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_NO_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. |
oraconst.txt
.
Remarks
Features such as simple views and synonyms can be used freely. You can also use 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 Update method generates a commit to the database by default. To avoid this, use the BeginTrans method 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, these conditions must be met:
· A SQL statement must refer to a simple column list or to the entire column list (*)
· The statement must not set the read-only flag of the options argument
· 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.
The SnapShotID option causes a Snapshot Descriptor to be created for the SQLStmt object created. This property can later be obtained and used in creation of other SQLStmt or OraDynaset objects. Execution Snapshots provide the ability to ensure that multiple commands executed in the context of multiple OraDatabases operate on the same consistent snapshot of the database's committed data.