Re: dynamic ESQL/C question
Posted in 1998
On Wed, 24 Jun 1998 apatnaik@aircom.com wrote: > I am using Dynamic ESQL/C to read records with an unknown column > list. I am fetching the records, and would like to use dynamic memory > allocation to store the column field names and column field data. > > The column field data has a LENGTH associated with it that > I read in and malloc the right number of bytes to hold the character > buffer. That's careless. A DATETIME field is encoded; so are DECIMAL, MONEY, INTERVAL and (sometimes) VARCHAR fields. > However, I don't know how to derive the number of bytes for > the column field name. The examples go through fixed characters > arrays that are used to receive the data. is there a way to figure > out how long this is??? The column fields names were the subject of an extensive discussion earlier this week under the heading 'ESQL/C and SQLDA' or vice versa. Please exploit DejaNews to find that discussion -- it includes all the info on the column names that you might need, and some to spare. Suffice to say, you do not normally need to allocate the space yourself; it is allocated by ESQL/C and you can use the column names immediately after the DESCRIBE. For some example code, go poking around the IIUG archives (which are at http://www.iiug.org) and find, for example, SQLCMD -- which I wrote. The describe.ec file contains more information than you're likely to want. Also read the ESQL/C manual; it has an extensive discussion of dynamic ESQL/C in it. Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix -- see http://www.perl.com/CPAN