skip to main content
OpenAccess SDK SQL Engine Core Functions API : Function Reference : dam_describeCondEx
 

dam_describeCondEx

This function is used to retrieve the description of the condition. Use this function to retrieve the condition ( =, >, <, and so on) and the value of the operand ('TAG', 100, and so on). It returns details of either the left or right part of the condition based on the input iCondPart. The right part only applies in a BETWEEN condition. For other conditions, when the right part is requested, a value of 0 is returned for the Operator type. Each condition is described by the operator type, the value of the operand, and the data type of the operand value.
This function allocates temporary storage for conditions that are expressions and this is indicated by a non-Null value for phVal. Use dam_freeVal to free this storage after you have retrieved the data from ppData.
int dam_describeCondEx(
DAM_HSTMT hstmt,
DAM_HCOND hcond,
int iCondPart,
int * piOpType,
void ** ppData,
int * piXoType,
int * piDataLen,
DAM_HVAL * phVal)
Table 79. Parameters for dam_describeCondEx
Parameter
Type
Description
IN
hstmt
DAM_HSTMT
The statement handle.
hcond
DAM_HCOND
The condition handle.
iCondPart
int
The condition part (left or right) for which details are being requested. Pass one of the following:
DAM_COND_PART_LEFT
DAM_COND_PART_RIGHT
OUT
piOpType
int *
The operator type. See Table 80 for the operators and descriptions of the associated values. When details of a right part are requested for condition that does not have a right part, piOpTyp is set to 0.
ppData
void **
A pointer to the data. The C type of the data corresponds to the piXoType value. This value is NULL for col=NULL condition. See Table 33.
piXoType
int *
The data type.
piDataLen
int *
The length of the data. XO_NULL_DATA indicates a NULL value.
phVal
DAM_HVAL *
A pointer to DAM_HVAL. Non-NULL handle is returned when OpenAccess SDK SQL engine creates temporary value for returning value of the expressions in the condition. IP should call dam_freeVal(*phVal) to release memory after using the condition value from ppData.
RETURN
Int
DAM_SUCCESS - valid condition returned.
DAM_FAILURE - error getting a condition because the arguments to the call are invalid or the format of the data in the condition cannot be converted to the column type.
The table that follows shows the operator types for the piOpType parameter.
Refer to "Default Optimization" in OpenAccess SDK SQL Engine Programmer's Guide for examples on the operator values returned by this method to describe conditions such as VALUE>=xxx and VALUE BETWEEN xxx AND yyy.
Table 80. Operator Types for Conditions
Operator
Description
SQL_OP_SMALLER
Column value should be smaller than. This bit is set if <, <=, or BETWEEN predicates are used in the SQL query.
SQL_OP_GREATER
Column value should be greater than. This bit is set if >, >=, or BETWEEN predicates are used in the SQL query.
SQL_OP_LIKE
Column value should be LIKE. The ppRightData contains a valid pointer to XO_TYPE_CHAR data if an ESCAPE clause was used with LIKE.
SQL_OP_ISNULL
Column value should be NULL.
SQL_OP_EQUAL
Column Value should be equal. This bit is set if <=, >=, or BETWEEN predicates are used in the SQL query.
SQL_OP_NOT
This operator, which occurs in combination with either SQL_OP_NULL or SQL_OP_EQUAL, implies that the column value should not be NULL or the column value should not be EQUAL.

See also

*dam_freeVal