swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts   Other Library Functions  
function  

db.execute

 
 

Library: Interfaces, Database access (OMDB)
Import: omdb.xmd

Declaration

  define  external function db.execute
           value       db.procedure procedure
    in     read-only   stream       inshelf   optional
    null   value       stream       null      optional
    out    modifiable  db.field     outshelf  optional
    result modifiable  db.field     result    optional

  or

  define external function db.execute
           value       db.statement statement
     with  read-only   stream      values    optional
     null  value       stream      null      optional
     into  modifiable  db.field     record    optional

Argument definitions

procedure
is the db.procedure object associated with an open procedure.
inshelf
is a shelf of stream items that contain the input and inout parameter values.
null
is a string, rather than an unattached stream, to represent a NULL value in the input parameter values.
outshelf
is a shelf of db.field items to receive output and inout parameter values, and the function procedure return.
result
is a db.field shelf attached to the attached to the result set for any SQL query executed.
statement
is a compiled db.statement object.
values
is a shelf containing the parameter data.
null
is an optional string representing null values.
record
is a shelf of db.field items bound to result set fields.


Purpose

Executing a Stored Procedure

The database where the procedure is stored must be:

procedure must:

The input shelf inshelf must The keys must be in the correct order.

At the beginning of the function, the output shelf is cleared and filled with db.field items attached to the output and inout (combined input and output) procedure parameters. The input shelf items are sequentially matched to the procedure input parameters by position. You can represent NULL values in the input shelf item by an optional null specifier string or as an unattached stream.

The result shelf can contain multiple records. The input and output shelves can only contain a single record.

The result shelf is cleared in the function. If the procedure returns a result set the result shelf is filled with db.field items attached to the result set. The data value is extracted from the output and return parameters in a subsequent call to the db.reader function.

The output and result db.field field items are keyed with the name of the procedure parameter, if one exists.

If a record used by the procedure has a date, time, or timestamp field, you must represent the field's value in the OmniMark Date and Time library format. (This format returns the time with a time zone offset from UTC time, which most databases do not provide.)

Executing a Compiled SQL Statement

Use db.execute to execute a compiled SQL statement that was produced by the db.compile-statement function.

The db.database object supplied when the statement was compiled must be open (else external exception OMDB101).

The db.statement object statement must be open (else external exception OMDB701).

If the db.statement object is a compiled query, it requires the db.field shelf argument record to receive the results (else external exception OMDB704).

The input shelf values must:

If you specify any date, time, or timestamp values in the "values" parameter data, you must express them in the OmniMark Date and Time library format. When you call db.execute, you must supply data for all the defined parameters. You can express null data values as unattached shelf items or as the supplied null identifier string.

db.execute allows you to execute a compiled statement and to specify all the parameter values at once. This is more efficient for small parameters.

For large parameters (for example, db.blob-type types) when there is a large amount of data to be inserted, it is more efficient to use the db.streaming-execute function, as that avoids creating an entire copy of the data in memory prior to execution.

See db.compile-statement for additional notes and examples.

    Related Syntax
   db.database
   db.open-procedure
   dbProcedureClose
   db.procedure
 
Related Concepts
   Using the OMDB library
 
Other Library Functions
   db.advance-recordset
   db.close
   db.commit
   db.compile-statement
   db.database
   db.delete
   db.discard
   db.execute
   db.execute-in
   db.field
   db.insert
   db.move-record
   db.omdb-version
   db.omdb-version-oci8
   db.omdb-version-oci8i
   db.omdb-version-odbc
   db.open-oci8
   db.open-oci8i
   db.open-odbc
   db.open-procedure
   db.open-table
   db.prepare
   db.procedure
   db.query
   db.reader
   db.record-exists
   db.rollback
   db.set-transaction-type
   db.statement
   db.streaming-execute
   db.table
   db.update
   db.writer
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:02 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.