Re: ESQL/C vs. SQLDA
Posted in 1998
Art S. Kagel wrote: > > Stefan Weideneder wrote: > > > > steve53@earthlink.net wrote: > > >[SNIPPED] > > > be carefull when using the old fashioned DESCRIBE method. There > > is no need to do another DESCRIBE after a PREPARE. But Informix > > tells you, that you must free the memory by yourself. So never > True. But this refers to the memory added to point to your data > elements, not the structure itself. > > > forget to free the memory Informix allocated. Don't use the > > EXEC SQL FREE statement, use the C-function > > > > free((char*)sqldapointer) > > That's just WRONG Stefan. Among other things it does not free any of > the memory attached to the substructure pointers, like the variable > definition blocks. In addition there are several data structures > internal to the ESQL library and in the engine to which you are > connected that need to be freed. Only the SQL FREE statement can do > for you. Definitely walk through the structure freeing anything that > you have allocated yourself then ABSOLUTELY do EXEC SQL FREE! > > Art S. Kagel It's not WRONG. It's definitely CORRECT. I didn't say that you do not have to FREE a PREPARED statement. I just said that you must use the C-function free() to free the DESCRIBED sqlda-pointer. See also: J.Leffler's response. Stefan