MCO_RET mco_uda_collate_get_range(/*IN*/ const mco_collate_h c,
/*IN*/ uint2 from,
/*OUT*/ mco_uda_value_t *val );
c
mco_collate_t struct containing the collation operands.from
val
mco_uda_value_t variable to receive the value in the mco_collate_t struct.This function returns a string value from the specified collation by copying from the specified starting position to the end of the string within the collation. The val.v.p.len element of the value structure is then set to indicate the number of characters copied. This function is used within collation compare and hash functions.
MCO_S_OK
Application snippet:
/* custom compare & hash functions */
int2 coll_cmp(mco_collate_h c1, uint2 len1, mco_collate_h c2, uint2 len2)
{
mco_uda_value_t val1, val2;
char buf1[20], buf2[20];
/* get first object's value */
val1.type = MCO_DD_STRING;
val1.v.p.size = sizeof(buf1);
val1.v.p.p.c = buf1;
mco_uda_collate_get_range(c1, 0, &val1);
/* get second object's value */
val2.type = MCO_DD_STRING;
val2.v.p.size = sizeof(buf2);
val2.v.p.p.c = buf2;
mco_uda_collate_get_range(c2, 0, &val2);
/* compare values */
return STR_CMP(buf1, buf2);
}