skip to main content
OpenAccess SDK SQL Engine core methods for Java : Exchanging data : 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.
Related functions:
*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.
long dam_getRestrictionList(
long hstmt,
long hcol)
Table 213. Parameters for dam_getRestrictionList
Parameter
Type
Description
INPUT
hstmt
long
The statement handle.
hcol
long
The handle of the column for which the restriction is requested.
RETURN
long
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.

Examples

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 conditions C1 and C2, and column dept_id.
The first condition, C1, has the operator set to '=' and the value set to 1.
The second condition, C2, has the operator set to '=' and the 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 = jdam_getRestrictionList(hstmt, hDeptId);
hCond1 = jdam_getFirstCond(hstmt, hCondList);
/* call dam_describeCond() to get the operator type, operand and the */
/* data type */
hCond2 = jdam_getNextCond(hstmt, hCondList);

See also

*dam_describeCond
*dam_getFirstCond
*dam_getNextCond
*dam_getOptimalIndexAndConditions
*dam_getRestrictionList
*dam_setOption