Re: ESQL/C dynamic SQL and BLOBS
Posted in 1995
In article <3lgma3$kcb@alecto.algonet.se> jano@algonet.se (Jan Nord'n) writes: >I am writing a fairly general database interface, which leads to using dynamic SQL. > >Since we also use BLOBS, this means that I need to dynamically allocate and >deallocate loc_t structures (no problem so far). > >When fetching data I want ISQL to allocate memory for me, still no problem, >i set: > >p->loc_loctype = LOCMEMORY; >p->loc_bufsize = -1; > >according to the manual, ISQL will allocate the buffer for mw using GlobalAlloc(), >and grow it as needed. > >Now, when I want to free everything allocated I have a problem. > >Since the buffer was allocated by GlobalAlloc(), I guess it should be freed by >GlobalFree(). However GlobalFree() doesn't take a pointer to the memry area to be freed >, instead it takes some kind of windows handle, which I don't have... > >Has anyone else done this??? Yes. Checkout out the macro GlobalFreePtr() in <windowsx.h>. (actually, all of the GloablXXX() macros are useful) Don't forget that the buffer may be larger than 64K. If it is, you will need to understand huge pointers. Scott