Re: HELP: loading BLOBs
Posted in 1996
Both $ and EXEC SQL are correct, though $ is the older Informix-only method. If you think your code should be portable, then (a) don't use blobs, and (b) do use EXEC SQL (and colon ':' on host variables). I see that the example uses colons for variables, but $ for statements and is therefore confusing. Oh, and you'd use "EXEC SQL BEGIN DECLARE SECTION;" to start a block of variable declarations, and, you guessed it, "EXEC SQL END DECLARE SECTION;" to end it. Oh well... Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: Mike Segel <mikey@segel.com> }Date: Tue, 16 Jul 1996 01:11:07 +0000 }X-Informix-List-Id: <news.26177> } }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 sqlca; }> $include locator; }> }> main() }> { }> $char lv_str[20]; }> $long lv_int; }> int fd; }> $loc_t lv_img; }> [...] }> $DATABASE 'input@sa2'; }> errcheck("open database"); }> [...] }> $BEGIN WORK; }> }> $SELECT bi_image INTO :lv_img FROM ODIRMS.t_batch_image }> WHERE bi_batch_image_id = "U00046C0001"; }> [...] }> $COMMIT WORK; }> $CLOSE DATABASE; }> [...] }[SNIP]