HELP! BLOB esql problem!
Posted in 2003
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi All, I have a small little routine which will fetch in a table containing BLOB space. while (true) { static BOOL entered = false; static $loc_t buf; buf.loc_loctype = LOCMEMORY; buf.loc_oflags = 0; // Q1: Do I need to set these every loop? if (!entered) { buf.loc_bufsize = -1; buf.loc_mflags = 0; entered = true; } else buf.loc_mflags = LOC_ALLOC; // Q2: Is it correct to set to LOC_ALLOC // CODE to select the BLOB spaces. ...... } Thanks Regards
Kwan wrote: > I have a small little routine which will fetch in a table containing BLOB space. > > while (true) > { > static BOOL entered = false; > static $loc_t buf; > > buf.loc_loctype = LOCMEMORY; > buf.loc_oflags = 0; // Q1: Do I need to set these every loop? > > if (!entered) > { > buf.loc_bufsize = -1; > buf.loc_mflags = 0; > entered = true; > } > else buf.loc_mflags = LOC_ALLOC; // Q2: Is it correct to set to LOC_ALLOC > > // CODE to select the BLOB spaces. > ...... > } Check out the code in SQLCMD related to blob handling - especially the selblob, updblob, appblob, selmultiblob etc code. Available from the IIUG archive. You're on the right tracks; I'm not sure that I bother with the equivalent of your !entered block. You need to be very careful to ensure that you release the blob space properly to (or that the ESQL/C libraries do it for you). A little leakage of a megabyte or two here and there usually makes itself felt rather quickly, so you will probably see if you have problems. I assume the // Code to select the BLOBs actually breaks your loop? -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/