OAEXECSQL
oaexecsql provides a SQL front end to many of the OmniAccess capabilities.
This routine supports most SQL DML statements, as well as additional statements
exclusively to support OmniAccess functionality such as index qualification.
oaexecsql supports statements that do not return a buffer. For example,
SELECT statements are supported but not FETCH statements. Therefore, a
call to oaexecsql using a SELECT statement must be followed by a call
to oafetch.
Syntax
oaexecsql (cursor, options, status, statement)
cursor -- cursor is a 32-bit
integer containing a valid cursor number as returned by oaopencursor.
Any command contained in the statement parameter will be applied
to this cursor or to the instance that owns this cursor.
If the cursor parameter contains a 0 (zero), the cursor will
be derived from the cursor member of the status structure.
If the statement parameter contains a CONNECT or OPEN CURSOR
statement, the cursor parameter is ignored and new instance
or cursor values will be placed into the status structure
accordingly.
options -- options is a character string
up to 255 bytes, terminated by either a null or a semi-colon. There are
two different categories of options that can be passed in this parameter,
options that will be processed by oaexecsql and options that will be passed
to the underlying routine in the statement parameter. The following options
affect the behavior of oaexecsql.
status -- status is a structure
of type oastatus_t which reports the success or failure of
the routine. This structure also contains instance and cursor
information as well as values specific to the current underlying
statement being executed. See the individual routines for
more information about what values are returned.
statement -- statement is
a character string up to 65536 bytes, terminated by either
a null or a semi-colon.
The statement parameter contains the statement to be executed along with
options to be used by the underlying routine. Valid options are determined
by the underlying routines that will be called for the specific commands.
Please refer to the individual oa routines for a complete list of valid
options.
All options can be passed in the WITH options-list parameter
of the commands listed below, or in the oaexecsql options
parameter. To assign options to a specific routine, pass the
routine name with option in the options parameter.
!command -- Calls oacommand.
CONNECT -- Calls oaconnect
and oaopencursor.
DELETE -- Calls oadelete,
oaselect, and oafetch.
DISCONNECT -- Calls oadisconnect.
EXPORT -- Calls oaexport
and oaselect.
INSERT -- Calls oainsert,
oaselect, and oafetch.
JOIN -- Calls oajoin.
OPEN -- Calls oaopencursor.
QUALIFY -- Calls oaqualify.
SELECT -- Calls oaselect
and oafetch.
UPDATE -- Calls oaupdate,
oaselect, and oafetch.
VERSION -- Calls oaversion.
Options
Options can be passed through oaexecsql in one of 3 ways.
- in the options parameter
- in the WITH clause of the statement to be executed
- in a SQL SET statement.
ESCAPE=character -- The character
to be used as an escape character. The default escape character
is the backslash " \ ".
NOCURSOR -- Used with the
CONNECT command to connect without opening a cursor.
ODXID and CHAR -- Used
with the EXPORT command. If the EXPORT command is used with a select statement,
ODXID and CHAR are passed to oaselect. Otherwise, they are passed to oaexport.
All other valid options are passed to the underlying routine
according to what is passed in the statement parameter. For
example, if inserting a record using oaexecsql, any valid
options for oainsert, oaselect, and oafetch can be passed
in the options parameter.
To assign options to a specific routine, pass the routine
name with option in the options parameter. For example:
oainsert.char
Example
Top
|