again: retrieving blob data with ESQL-C in IDS2000
Posted in 2000
there was a mistake, in the last line we meant "CAST" instead of "CAS" Hi to all we have recently upgraded from IDS 7.31 to IDS 2000 (s.o. Digital Unix - tru64); one of the reasons was the availability of SmartBlobs, more performant then simple BYTE or TEXT datatypes. now we have SERIOUS problems in porting our software (APIs of data access), particularly on the retrivial side we use the sqlda structure; in the ESQL-C programmer's manual (ver. 9.13 page 15-40) is written: "Allocating Memory for the Fetch Arrays struct sqlda *in_da; struct sqlvar_struct *col_ptr; .... .... for (i = 0, col_ptr = in_da->sqlvar; i < in_da->sqld; i++, col_ptr++) { switch(col_ptr->sqltype) { case SQLCHAR: col_ptr->sqltype = CCHARTYPE; break; case SQLINT: col_ptr->sqltype = CINTTYPE; break; case SQLBYTES: case SQLTEXT: if (col_ptr->sqltype == SQLBYTES) col_ptr->sqltype = CLOCATORTYPE; temp_loc = (loc_t *)malloc(col_ptr->sqllen * num_to_alloc); if (!temp_loc) { fprintf(stderr, "blob sqldata malloc failed\\n"); return(-1); } col_ptr->sqldata = (char *)temp_loc; byfill(temp_loc, col_ptr->sqllen*num_to_alloc ,0); for (j = 0; j< num_to_alloc; j++, temp_loc++) { temp_loc->loc_loctype = LOCMEMORY; temp_loc->loc_bufsize = BLOBSIZE; temp_loc->loc_buffer = (char *)malloc(BLOBSIZE); if (!temp_loc->loc_buffer) { fprintf(stderr, "loc_buffer malloc failed\\n"); return(-1); } temp_loc->loc_oflags = 0; /* clear flag */ } /* end for */ break; default: fprintf(stderr, "not yet handled(%d)!\\n", col_ptr->sqltype); return(-1); } /* switch */ " The problems are the following: for datatypes blob and clob, col_ptr->sqltype = SQLUDTFIXED; in this case 1) HOW SHOULD WE ALLOCATE MEMORY? 2) HOW SHOULD WE "CAST" TO ifx_lo_t, IN ORDER TO USE API ifx_lo_*? thank you very much in advance