C interval structure
Specify the C data type for the SQL interval data type by using a C interval structure.
The following structures specify the C data type for the
SQL interval data type:
typedef struct tagSQL_INTERVAL_STRUCT
{
SQLINTERVAL interval_type;
SQLSMALLINT interval_sign;
union
{
SQL_YEAR_MONTH_STRUCT year_month;
SQL_DAY_SECOND_STRUCT day_second;
} intval;
}SQLINTERVAL_STRUCT;
typedef enum
{
SQL_IS_YEAR=1,
SQL_IS_MONTH=2,
SQL_IS_DAY=3,
SQL_IS_HOUR=4,
SQL_IS_MINUTE=5,
SQL_IS_SECOND=6,
SQL_IS_YEAR_TO_MONTH=7,
SQL_IS_DAY_TO_HOUR=8,
SQL_IS_DAY_TO_MINUTE=9,
SQL_IS_DAY_TO_SECOND=10,
SQL_IS_HOUR_TO_MINUTE=11,
SQL_IS_HOUR_TO_SECOND=12,
SQL_IS_MINUTE_TO_SECOND=13,
}SQLINTERVAL;
typedef struct tagSQL_YEAR_MONTH
{
SQLUINTEGER year;
SQLUINTEGER month;
}SQL_YEAR_MOHTH_STRUCT;
typedef struct tagSQL_DAY_SECOND
{
SQLUINTEGER day;
SQLUNINTEGER hour;
SQLUINTEGER minute;
SQLUINTEGER second;
SQLUINTEGER fraction;
}SQL_DAY_SECOND_STRUCT;