Re: HELP: loading BLOBs
Posted in 1996
Chao Y. Din wrote: [SNIP] I just wanted to focus on the code segment for a second. Am I mistaken, or does this not follow the guidelines for ESQL/C ? Yeah I know it works, but like, uhm, I don't know but I like to follow standards which make it easier to DEBUG and things like that? I know this came from the manual, but shouldn't it be updated? I mean, which is right? Using $ or EXEC SQL statements? > Program getblob.ec: > > #include <stdio.h> > #include <fcntl.h> > #include <malloc.h> > > $include sqlca; > $include locator; > > main() > { > $char lv_str[20]; > $long lv_int; > int fd; > $loc_t lv_img; > > int i; > int j; > int rtn; > > $DATABASE 'input@sa2'; > errcheck("open database"); > > lv_img.loc_loctype = LOCFILE; > lv_img.loc_fd = fd; > lv_img.loc_oflags = LOC_WONLY; > lseek(fd,0L,0); > $BEGIN WORK; > > $SELECT bi_image INTO :lv_img FROM ODIRMS.t_batch_image > WHERE bi_batch_image_id = "U00046C0001"; > > errcheck("select (with BYTE)"); > printf(" Byte length: %d",lv_img.loc_size); > > $COMMIT WORK; > $CLOSE DATABASE; > errcheck("close database"); [SNIP] -Mikey