Scalable Database Server, HiRDB Version 8 UAP Development Guide
In C, the -E option allows you to declare pointers as embedded variables. When you use this function, you can directly specify dynamically allocated areas in SQL statements.
For details about SQL preprocessor options, see the option descriptions in 8.2.2 Preprocessing in UNIX, or 8.2.3 Preprocessing in Windows. For details about SQL statements that can use pointers, see 8.2.8 Use of pointers, structures, and structure qualifiers when the -E2 or -E3 option of the preprocessor is specified.
Declare pointer variables according to the C syntax. An example is shown as follows.
long *xprice; long *xstock; char *xpname; ... xprice = (long *)malloc(sizeof(long)); xstock = (long *)malloc(sizeof(long)); xpname = (char *)malloc(MAX_CHAR_LEN+1); memset(xspname, ' ', MAX_CHAR_LEN); xspname [MAX_CHAR_LEN] = '\0'; EXEC SQL FETC CUR1 INTO :xprice,:xstock,:xpname;
struct { long xprice[50]; long xstock[50]; char xpname[50][17]; } *xrec_ptr;
PD_MV_SINT(32) *ptr; /* maximum element count 32 */ ptr = malloc(sizeof(*ptr)); EXEC SQL FETCH CUR1 INTO :ptr;
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.