Compares two data values.
CS_RETCODE cs_cmp(context, datatype, var1, var2, result) CS_CONTEXT *context; CS_INT datatype; CS_VOID *var1; CS_VOID *var2; CS_INT *result;
A pointer to a CS_CONTEXT structure.
One of following symbolic values, to indicate the datatype of var1 and var2:
Value of datatype |
Indicates this datatype |
---|---|
CS_DATE_TYPE |
CS_DATE |
CS_TIME_TYPE |
CS_TIME |
CS_DATETIME_TYPE |
CS_DATETIME |
CS_DATETIME4_TYPE |
CS_DATETIME4 |
CS_DECIMAL_TYPE |
CS_DECIMAL |
CS_MONEY_TYPE |
CS_MONEY |
CS_MONEY4_TYPE |
CS_MONEY4 |
CS_NUMERIC_TYPE |
CS_NUMERIC |
CS_BIGDATETIME_TYPE |
CS_BIGDATETIME |
CS_BIGTIME_TYPE |
CS_BIGTIME |
A pointer to the first operand for the comparison.
A pointer to the second operand for the comparison.
On successful return, *result is set to indicate the result of the comparison:
Value of *result |
Indicates |
---|---|
-1 |
var1 is less than var2. |
0 |
var1 is equal to var2. |
1 |
var1 is greater than var2. |
cs_cmp can return the following values:
Returns |
Indicates |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. If cs_cmp returns CS_FAIL, *result is undefined. |
The most common reason for a cs_cmp failure is an invalid parameter.
cs_cmp generates a CS-Library error message for most failure conditions. See “Error handling”.
cs_cmp sets *result to indicate the result of the comparison.
var1 and var2 must have the same datatype, as indicated by the datatype parameter.
To compare string values, an application can call cs_strcmp.