Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

Development

OmniAccess API

Managing Large Lists of Rows

Managing Data Across Several Cursors

Convert Data Types Through oaselect_list

oaselect_list

Undetermined Criteria

 

OmniAccess API

Programming Basics

Managing Data

Functions

 

Development

 

Managing Data

 

Managing Large Lists of Rows

oaassignvalues provides the mechanism to pass any number of search values in repeated executions of an oafetch loop. This mechanism can be used to effectively break down one oversized array of search values into several smaller, manageable arrays. oafetch can also be incorporated into the loop to support forward and backward reads through a list of qualified rows.

The data parameter of oaassignvalues contains the actual data to pass to the $VALUES buffer. Each value contained in data is assumed to be of the defined type and length of the column on the left side of the $VALUES expression in oaselect’s criteria parameter. For example, if the criteria parameter contains the expression CUSTOMER_NO IN $VALUES, and CUSTOMER_NO is defined as TYPE INTEGER LENGTH 2 in the environment catalog, oaselect assumes that the values in the data parameter of oaassignvalues are also TYPE INTEGER LENGTH 2 (two-byte signed integers).

The num_values parameter tells oaassignvalues how many elements (values) data contains. Based on this information, as well as the number provided in the oaselect $VALUES declaration, oafetch can use the criteria to retrieve rows.

The labels parameter tells oaassignvalues which $VALUES token to use if there are several $VALUES tokens on the oaselect criteria expression. When using more than one $VALUES token in a call to oaselect, a different $VALUES label must first be assigned for each $VALUES token. oaassignvalues must be called once for each $VALUES token in the oaselect expression before calling oafetch.

 

Managing Data Across Several Cursors

Sometimes it is necessary to transfer data across cursors to complete a search.

For example, a separate environment catalog may be maintained for each department in an organization.

Account information may be managed in one environment catalog, while customer order information is managed in another.

So, to place a hold on all deliveries to customers with delinquent accounts, the accounting environment catalog (ACCTEC) would be searched first, for all customers who are three months in arrears.

Then the order entry environment catalog (CUSTEC) would be searched for customer rows using the account numbers qualified in the ACCTEC environment.

 

Convert Data Types Through oaselect_list

To declare a select item as a different type than its default or defined type in the Omnidex environment catalog, you must pass its new type through the oaselect_list parameter of oabind.

The data type element contains an integer value representing the default data type. To convert the data into a different data type, specify an integer value representing the data type you want in the req_datatype element.

 

 

oaselect_list

oaselect_list is a type declaration for the OmniAccess select list control blocks. These control blocks are used exclusively by the oadescribe and oabind functions.

typedef struct oaselect_list
{

int

type;

int

subtype;

union
{

 

char

expression[132];

char

literal[132];

char

numeric[36];

struct
{

 

char

environment[33];

char

database[33];

char

table[33];

char

column[33];

} column;

 

} select_item;

 

char

alias[36];

int

datatype;

int

length;

int

usage;

int

occurrences;

int

offset;

char

options[64];

int

req_datatype;

int

req_length;

int

req_usage;

int

req_offset;

char

req_options[64];

char

*data;

int

*null_indicator;

} oaselect_list_t;

 

 

Undetermined Criteria

oaassignvalues can be used to apply criteria that is not previously known.

For example, the criteria for a query (query2) may actually be the results of another query (query1).

Query1 may select the customer numbers from the Orders table, for all canceled orders.

Query2 then selects the company name, contact, and phone number from the Customers table for the customer numbers that were returned from query1.

In this case, the results of query1 are placed in the $VALUES buffer and used in the WHERE clause of query 2, WHERE customer_no in $VALUES.

Another example would be an online application that allows the user to specify multiple criteria. The criteria is not known until the user makes their choices. The criteria choices are placed into the $VALUES buffer and applied to the query in the WHERE clause.

 

Top