/* ALL RIGHTS RESERVED,COPYRIGHT (C)2007,HITACHI,LTD. */
/* LICENSED MATERIAL OF HITACHI,LTD. */
/************************************************************************/
/* name = HiRDB 08-03 sample program of C stored function 1 */
/************************************************************************/
#include <math.h>
#include <stdio.h>
/*---------------------------------------------------------------------*/
/* Define structure for receiving VARCHAR-type data */
/*---------------------------------------------------------------------*/
typedef struct varchar{
short len;
char str[80];
}VCH;
/************************************************************************/
/* name = sample1 */
/************************************************************************/
void func_modf(double *value, double *ret,
short *ind1, short *ind_ret,
char *sqlstate, VCH *routine_name,
VCH *specific_name, VCH *message_text )
{
double int_value;
/* Set fraction part obtained by calling modf function as return value */
*ret = modf(*value, &int_value);
/* Set indicator part of return value (non-null value) */
*ind_ret = 0;
/* Set SQLSTATE (normal termination) */
memcpy(sqlstate, "00000", 5);
/* Set null character string in message text */
message_text->len = sprintf(message_text->str, "");
}
|