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

dam_getRestrictionList

This method is used to get the handle to the list of restriction conditions on a column. This method is used in conjunction with the dam_getOptimalIndexAndConditions method to process as few rows as possible.
When using restriction lists, a row is built for evaluation if, and only if, it matches a search condition (returned by dam_getOptimalIndexAndConditions), and it matches at least one restriction condition in each of the restriction lists. The IP navigates through the search condition list, if there is one, returned by the dam_getOptimalIndexAndConditions. For each search condition, the IP builds rows that satisfy at least one condition in each of the restriction lists.
Use this function with dam_getFirstCond, dam_getNextCond, and dam_describeCond.
Use dam_getRestrictionList on other columns to further restrict the number of rows processed.
Use dam_setOption to mark a restriction expression as evaluated by the IP to prevent the OpenAccess SDK SQL Engine from attempting to evaluate it.
int64 dam_getRestrictionList(
int64 hstmt,
int64 hcol)
 
Table 176: Parameters for dam_getRestrictionList 
Parameter
Type
Description
IN
 
 
hstmt
int64
The statement handle
hcol
int64
The handle of the column for which the restriction is requested
RETURN
 
 
 
int64
The restriction condition list; navigate it by using the methods dam_getFirstCond and dam_getNextCond. 0 is returned if no restrictions apply on the specified column.

Example 

In a query of the form:
SELECT * FROM emp WHERE dept_id = 1 OR dept_id = 2;
calling dam_getRestrictionList on column dept_id returns a restriction list with two conditions C1 and C2, and column dept_id.
The first condition, C1, has:
operator set to ‘=’ and value set to 1.
The second condition, C2, has:
operator set to ‘=’ and value set to 2.
The IP should build rows where the dept_id is 1 and rows where the dept_id is 2.
/* Get restriction on column dept_id assuming hDeptId is the */
/* column handle */
hCondList = ndam_getRestrictionList(hstmt, hDeptId);
hCond1 = ndam_getFirstCond(hstmt, hCondList);
/* call dam_describeCond() to get the operator type, operand and the */
/* data type */
hCond2 = dam_getNextCond(hstmt, hCondList);

See also 

dam_describeCond
dam_getFirstCond
dam_getNextCond
dam_getOptimalIndexAndConditions
dam_setOption