skip to main content
OpenAccess SDK SQL Engine core methods for .NET : Methods for .NET reference : dam_getOptimalIndexAndConditions
 

dam_getOptimalIndexAndConditions

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)
Table 169: 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 

dam_describeIndex
dam_describeIndexCol
dam_freeSetOfConditionList
dam_getFirstCondList
dam_getFirstIndexCol
dam_getNextCondList
dam_getNextIndexCol
dam_isTableFunction