Powered by Zoomin Software. For more details please contactZoomin

DataDirect OpenAccess SDK Help

dam_getOptimalIndexAndConditions

  • Last Updated: May 12, 2026
  • 2 minute read
    • OpenAccess SDK
    • Version 9.0
    • Documentation

This method is used to support single or multiple column indexes. Use this function to get the optimal index and the set of search conditions associated with the columns of that index. This information is used by the IP to restrict the rows that are read.

Each condition list contains conditions on all or some of the columns in the index. The relationship between the individual condition elements in the list is that of AND. This means that each row that the OpenAccess SDK SQL Engine builds for a condition list must satisfy all the conditions in that list and must then be validated using the dam_isTargetRow method. The order of the conditions corresponds to the order of the columns in the index. The relationship between each of the condition lists is that of OR. This means the IP builds a set of rows for each of the condition lists.

Note: You must set up the following requirements, so that the OpenAccess SDK SQL Engine can generate an optimal index:

  • One or more column names must be marked as having an index in the OA_STATISTICS table.
  • Support for one or more operators must be enabled.
int dam_getOptimalIndexAndConditions(
int64 hstmt,
out int64 phIndex,
out int64 phSetOfCondList)

Parameters for dam_getOptimalIndexAndConditions

Parameter Type Description
IN    
hstmt int64 The statement handle
OUT    
phIndex int64 The handle of the index identified as optimal for the statement. This value is 0 if no optimal index was identified. Use the method dam_describeIndex to get details about the index. Use dam_getFirstIndexCol, dam_getNextIndexCol, and dam_describeIndexCol to get details about the columns making up the index.
Note: Your IP code must create this object before calling this method.
phSetOfCondList int64 If an optimal index is found, then this is a handle to the set of conditions that are present in the query. (Otherwise, this is 0.) Navigate it by using the dam_getFirstCondList and dam_getNextCondList methods.
Your code must create this object before calling this method.
The IP must call dam_freeSetOfConditionList to free this handle when finished with the query.
RETURN    
  int Status of the call:
DAM_SUCCESS – on success
DAM_FAILURE – error

See also

TitleResults for “How to create a CRG?”Also Available inAlert