OMDB is the OmniMark database interface library, a set of functions that let you access and manipulate information in both relational and XML databases. This library uses either your existing ODBC-compliant database software drivers or Oracle client installation.
OMDB is designed to be as database vendor and database interface independent as possible. In a few places, OMDB's behavior is dependent on the database vendor or interface, and notes have been added to the documentation specifying the differences.
The library consists of the following files:
omdb.so(UNIX)—the dynamic link library file that creates the required opaque data types and contains the functions used to manipulate those components.
omdb_odbc.so(UNIX)—the dynamic link library that enables accessing databases using ODBC.
omdb_oci11g.so(UNIX)—the dynamic link library that enables accessing databases using OCI11g (or higher).
omdb.xmd—the OmniMark include file that contains the opaque data type definitions, the function declarations, and the required predefined variables.
Using the OMDB library is an introduction to the functions in the library, with sample code illustrating their use.
OMDB functions allow you to:
The functions in this library use the following opaque data types:
db.database—used by functions performing actions on the database as a whole.
db.field—used to retrieve a data value from a query.
db.table—used to modify the contents of a single table in the relational database.
db.statement—used to compile an SQL statement.
db.procedure—used to access a stored procedure in a database.
All dates, times, and timestamps are retrieved in the Date and Time library format. (This format returns the time with a time zone offset from UTC time.)
To use the OMDB functions in your OmniMark program, you have to add the following statement to your program:
import "omdb.xmd" prefixed by db.
If you are running OmniMark under UNIX and using ODBC to access databases, you must explicitly specify the location
of your ODBC driver before you can use the OMDB library functions. Presuming your ODBC driver is installed in
LD_LIBRARY_PATH=/usr/local/odbc/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH
To make use of the OCI interface for accessing a database, you must have SQL*NET installed on your machine and configured to locate the database server(s) you wish to access. Oracle 11g (or higher) client installations are supported.
To use OMDB, you must import it into your program using an import declaration such as:
import "omdb.xmd" prefixed by db.
db.query accept query/execute strings passed to
them in either the named parameter sql or in the named parameter statement. It is an error to use both
parameters in the same call. For non-relational databases the named parameter statement must be used.
This is a complete list of the OMDB library external exceptions that may be thrown back to the calling
OmniMark program. These are all catchable using the
Failed to allocate memory
The database does not support the requested operation
db.database is not currently open for statement execution
The source db.database has left the current scope and is no longer available
The source db.database has changed internal state
The specified SQL statement has a zero length
The specified transaction mode value is invalid
The database does not support streaming LOB parameters.
SQL query must return at least one column
This database driver may only retrieve BLOB columns after all other columns. Reorder the columns in your query.
The record set is not positioned on a valid row
The database does not support the requested cursor movement
The attempted field retrieval order requires an implicit refresh of the record set that is not supported by this database
Absolute and relative cursor positions cannot both be specified
The database has been closed since the query was executed
An invalid value was specified for the cursor type
db.field is not currently associated with a query
The SQL operation associated with the db.field returns a single record that does not support cursor movement
The db.field argument shelf contains no columns
The db.field is not a streaming execution handle
The db.field is a streaming execution handle
An external output has already been created for the current parameter
The requested stored procedure could not be found
Unable to determine the parameter type in the procedure
The number of parameters in the procedure exceeds OMDB's internal limit
The db.procedure item is not currently open for processing requests
The input value exceeds the maximum length allowed by the procedure parameter
The procedure has more input parameters than items on the input shelf
The specified procedure name has a zero length
All of the procedure parameter description arguments must be supplied
All of the procedure parameter description shelves must contain the same number of items
The item keys of the procedure parameter description shelves are inconsistent with each other
The procedure parameter data size must not be less than zero
The procedure has been re-executed, so previous data is no longer available
A database error occurred
db.table is not currently open for processing
The stream item key has no matching table column name
The datetime stream shelf item must be in OmniMark date format/
The specified table name has a zero length
The specified table record contains zero items
The table record item has no key value
db.statement is not currently open for processing
The compiled statement requires input values
The shelf of input parameter values for the compiled statement has too few items
The compiled statement is a query and requires a db.field shelf argument to receive the results
The input stream length exceeds the maximum size allowed by the parameter
The ODBC driver is unable to determine the data types of the parameters in the SQL statement. The shelf of parameter data types is required by db.compile-statement using this ODBC driver.
The shelf of input parameter data types values for the compiled statement has too few items
An invalid value was specified for a parameter data type
The number of parameters exceeds the database's limit
A streaming execute operation is currently active on this statement
This statement does not have an active streaming execute operation
The data for this parameter has already been received
An internal error was detected. Contact Stilo.