To access the value of a Period type argument, follow these steps:
- Allocate a buffer that is large enough to hold the beginning and ending bounds of the Period type, as represented by the C data type that maps to the SQL element type.
For example, consider a CREATE FUNCTION statement that specifies a PERIOD(TIME WITH TIME ZONE) argument. To access the value of the argument, the function must allocate a buffer that is large enough to hold two ANSI_Time_WZone values, where ANSI_Time_WZone is the C data type that maps to TIME WITH TIME ZONE.
- Call FNC_GetInternalValue to place the value of the Period type into the buffer you allocated.
For detailed information on FNC_GetInternalValue, see C Library Functions
Here is a code excerpt that shows how to access the value of a PERIOD(DATE) type:
void check_duration( PDT_HANDLE *duration, INTEGER *result, char sqlstate[6]) { void * tmpBuf = 0; int bufSize = 0; int length; /* Get the value of the PERIOD(DATE) duration. */ bufSize = SIZEOF_DATE * 2; tmpBuf = FNC_malloc(bufSize); FNC_GetInternalValue(*duration, tmpBuf, bufSize, &length); ... }