OD SET OPTIONS

4D - Documentation   Français   English   German   English   4D for Oracle, Command Theme List   4D for Oracle, Command Alphabetical List   Back   Previous   Next

version 6.5 (Modified)


OD SET OPTIONS (object_ID; options{; mode})

ParameterTypeDescription
object_IDLongintContext, cursor, or connection identifier
optionsLongintOptions to consider
modeIntegerAction

Description

The OD SET OPTIONS command allows you to specify options for the behavior of a context, cursor, or connection. object_ID can be either an inactive context identifier, inactive cursor identifier, a connection identifier, or "0".

To set options for a context or cursor, the context or cursor must be deactivated first. A cursor is considered inactive when there are no more rows to retrieve.

options is the sum of the options that you want to set. The options you can set depend on whether object_ID refers to a context, cursor, or connection.

OptionNumberDescription
kAutoRollback1For cursors only. Specifies that, in case of a SQL error, the current
transaction must be canceled.
kAutoCommit2For connections only. Specifies that after each SQL data
modification query (INSERT, UPDATE, or DELETE), the current
transaction must be validated.
kNoWait4For contexts only. Specifies that an error must be returned if a lock
is found upon opening a context for which the kWithLock option
has been selected. The query is then of the SELECT...FOR UPDATE
OF...NOWAIT type. In the opposite case, by default, the query will
wait for the records to be unlocked.
kWithLock8For contexts only. Specifies that the context must lock the result
rows. The query will be of the SELECT… FOR UPDATE OF… type if
at least one bind has the kForUpdate option.
kDistinctLines16For contexts only. Specifies that the context must be activated by
adding the DISTINCT keyword to the SELECT clause of the context
(which removes duplicates in the result rows). The context is then
automatically put in read-only mode.
kNoDialogErrors32Tells the program not to display the alert when an error occurs.
kDeferred64Allows the program to use the OCI's deferred mode while sending
requests to an Oracle7 server.
kTextMapping128Specifies that in an INSERT or UPDATE statement with variable
substitution, 4D C_TEXT objects will be converted to VARCHAR
(2000) instead of the default LONG. Solves the problem of the
multiple LONG columns per query not supported by Oracle
kCrLfMapping256Specifies the translation mode of the CR LF between Mac and PC
for 4D Text variables or fields and 4D String variables or fields.
When kCrLfMapping is unset, LF are converted to CR on PC side
only

mode indicates the action to take for the options specified by Options:

ModeDescription
0 or no codeSets the specified options
1Unsets the specified options
2Toggles the options between set and unset

Examples

(1) The following statement sets the kAutoCommit and the kAutoRollback options:

   OD SET OPTIONS (Login_ID;1+2)

(2) The following statement toggles the error display mode. If the option was set before, it is unset. If the option was not set before, it is set.

   OD SET OPTIONS (0;32;2)

Taking Advantage of the Deferred Mode

OD SET OPTIONS accepts the code kDeferred = 64 for all objects and as the default (passing 0 as object_ID). This option allows 4D for Oracle to use the OCI's deferred mode while sending requests to an Oracle7 Server.

The deferred mode tells the OCI to defer processing the step that parses an SQL statement and the steps that bind input variables and define output variables, until the statement is actually executed. This increases performance, as each step would otherwise result in a call to the server through the network.

In non-deferred mode, 4D for Oracle asks for a description of a statement's parameters (types and sizes of input and output parameters) before executing it. 4D for Oracle asks for a description so that it knows how many columns are to be returned and what data types are expected in order to perform type checking and data type conversions.

When in deferred mode, the speed advantage is lost if a description of the statement's parameters is requested before the SQL statement is executed. So, in order to achieve maximum performance, 4D for Oracle assumes that the types and sizes of the statement's parameters match the bound 4th Dimension objects.

This causes the following consequences in deferred mode:

In OD Execute SQL, if you specify more 4th Dimension objects than there are resulting columns, you will receive the error ORA-01007 "Variable not in select list."

In deferred mode, 4D for Oracle asks Oracle7 to perform the conversions itself if needed. Therefore, the list of supported data type conversions depends on Oracle7's capabilities.

Conversions are performed by Oracle7, so national language support uses the Oracle7 scheme and settings instead of a client's settings (for example, when you insert an Oracle date into a 4th Dimension alphanumeric variable).

Therefore, the we recommend that you do not use the deferred mode if you do not know the statement's parameter types and sizes at coding time.

See Also

OD Get options, OD ON ERROR CALL.


4D - Documentation   Français   English   German   English   4D for Oracle, Command Theme List   4D for Oracle, Command Alphabetical List   Back   Previous   Next