Re: Dynamically Prepared SQL Statements and TEXT blobs in ESQL/C OnLine 4.10
Posted in 1992
>From: uunet!esd.dl.nec.com!forney (Elizabeth (Liz) J. Forney) >Subject: Dynamic SQL Statements and TEXT blobs in ESQL/C 4.10 >Date: 6 Aug 92 14:34:50 GMT >X-Informix-List-Id: <news.1627> > >I am trying to figure out how the sqlda data structure returned from a >DESCRIBE statement and the LOCATOR structure work together to retrieve BLOB >or TEXT information from a database. From the sqlda structure, I can >determine that a column contains a SQLTEXT variable, but I am not sure how >to allocate the proper amount of storage to be used for a TEXT column in >the resulting sqlda data structure when a record is FETCHED from the >database. The rtypmsize function returns 0 bytes of memory to allocate for >a variable of type SQLTEXT. Is this right? You're right, rtypmsize() says zero, and rtypalign() gives character alignment, and both are wrong (and I reported them ages ago, there is probably a bug number, and it should be fixed in 5.0 but I haven't checked). And be wary of VARCHAR, DATETIME and INTERVAL too... You need to allocate sizeof(loc_t) bytes, and these should be aligned the same as any other structure. If you assume 4-byte alignment, you'd be reasonably safe. Thereafter, you initialize the loc_t structure as documented in <locator.h> and the OnLine Programmer's Manual. (FYI: DATETIME needs sizeof(dtime_t) and INTERVAL needs sizeof(intrvl_t); both need structure alignment. VARCHAR can be treated as CSTRINGTYPE, if memory serves me correctly.) Yours, Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h>