Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

OmniAccess API

Functions

Syntax

Options

Example

 

OmniAccess API

Programming Basics

Managing Data

Functions

 

OAINSERT

oainsert adds rows to a table and by default automatically updates the OMNIDEX indexes to reflect the new row. By default, oainsert waits until the file (table) referenced in table is accessible, then locks it before adding the new row.

By default, when you insert a row using oainsert, information about that row is also inserted into the indexes. This ensures that the OmniAccess search routines “find” new rows immediately after they are inserted.

This feature maintains Omnidex index integrity as rows are inserted. When inserting a high volume of rows to a table, it is often more efficient to perform data-only insertions, using the DA option, followed by a DBINSTAL BUILD operation. DBINSTAL BUILD operations are discussed in “Load the indexes”.


 

Syntax

oainsert (instance, options, status, table, columns, buffer)

instance -- Identifies a unique connection to a catalog previously established by oaconnect. Instance is a 32-bit signed integer passed by value.

options -- Is a character string, passed by reference, that indicates the action or actions for oainsert to take. Separate multiple options with commas, and terminate the option list with a semicolon or a null character.

Passing a semicolon or a null character causes default behavior.

status -- Indicates the success or failure of the oainsert routine. A zero status.error indicates the successful execution of oainsert. The status structure is passed by reference and contains fourteen 32-bit signed integers, followed by a 36-character buffer.

table -- Is a character value passed by reference, not longer than 33 bytes including a semicolon or null terminator. Table contains the name of the table to which you are adding the row.

columns -- Is a character array passed by reference, up to 4096 bytes long. Separate multiple columns with commas and terminate the array with a semicolon or null character. Columns specifies those columns from table that will contain the data passed in buffer. If your native data management system requires a unique key value, or an ODXSI, you must include the column that contains the value in the columns list to successfully insert the row. Columns may contain an asterisk ( * ) to insert all columns in the table.

buffer -- Is a pointer to a buffer area that contains the data to be added to the columns referenced in columns. The buffer area must reflect the length and data type of each column referenced in columns. The data in the buffer area must be in native format. If columns references two columns: one 30-byte character column and one four-byte integer column, then the buffer area must contain 30 bytes of character data followed by four bytes of binary integer data. Binary data may require conversion when rows are transferred from the server to a client. For more information about byte-ordering, see byte ordering and byte boundaries.

If you pass the CHAR= n option in the options parameter, be sure to allocate sufficient space in buffer for each binary numeric column, based upon the length n you specified. The CHAR= n option eliminates any concern for byte-ordering and integer conversion across hardware platforms.

 

 

Options

CHAR=n -- converts character numbers to binary for binary columns before inserting the index entry, where n is the byte length of the input number. The default is 32 bytes. The alphanumeric representation of the values is left justified, space filled to length n. For more information, see “The CHAR=n option”.

DA -- the data-only option adds the row only to the table. It does not update the index entries to the OMNIDEX indexes.

NOWAIT -- returns an error condition if the table referenced in table is not available for locking. Without NOWAIT, OmniAccess queues the lock request until a lock can be placed before the insertion. For more information, see “The NOWAIT option”.

Passing a semicolon or a null character causes default behavior.

 

 

Example

 

Top