void set_duration( DATE *date1,
DATE *date2,
PDT_HANDLE *result,
int *date1IsNull,
int *date2IsNull,
int *resultIsNull,
char sqlstate[6])
SQL_TEXT extname[129],
SQL_TEXT specific_name[129],
SQL_TEXT error_message[257] )
{
DATE new_duration[2];
/* Set the value of the PERIOD(DATE) result. */
if (*date2 > *date1)
{
new_duration[0] = *date1;
new_duration[1] = *date2;
}
else if (*date1 > *date2)
{
new_duration[0] = *date2;
new_duration[1] = *date1;
}
else
{
strcpy(sqlstate, "22023");
strcpy((char *) error_message,
"PERIOD element values cannot be equal.") ;
*resultIsNull = -1;
return;
}
FNC_SetInternalValue(*result, &new_duration[0], SIZEOF_DATE*2);
...
}