Blobs n ESQL/C for Windows 
Author Message
 Blobs n ESQL/C for Windows
I have a WFW 3.11 app that read/writes BLOBS to a Informix 5.x Online
engine using ESQL/C 5.01WE1 for Windows.  The documentation for ESQL/C
say that if you pass in a -1 for your uffer size on a fetch Informix wil
allocate a buffer and return the size and a pointer to this buffer.  When
does Informix actually release this buffer or is it up to my app?

Thanks
--terry



Wed, 18 Jun 1902 08:00:00 GMT
 Blobs n ESQL/C for Windows


Quote:
>I have a WFW 3.11 app that read/writes BLOBS to a Informix 5.x Online
>engine using ESQL/C 5.01WE1 for Windows.  The documentation for ESQL/C
>say that if you pass in a -1 for your uffer size on a fetch Informix wil
>allocate a buffer and return the size and a pointer to this buffer.  When
>does Informix actually release this buffer or is it up to my app?

It is up to your app. The memory was allocated using GlobalAllocPtr()
and should be freed using GlobalFreePtr().  These are both macros found
in <windowsx.h>.
Scott


Wed, 18 Jun 1902 08:00:00 GMT
 Blobs n ESQL/C for Windows

Quote:


>>I have a WFW 3.11 app that read/writes BLOBS to a Informix 5.x Online
>>engine using ESQL/C 5.01WE1 for Windows.  The documentation for ESQL/C
>>say that if you pass in a -1 for your uffer size on a fetch Informix wil
>>allocate a buffer and return the size and a pointer to this buffer.  When
>>does Informix actually release this buffer or is it up to my app?
>It is up to your app. The memory was allocated using GlobalAllocPtr()
>and should be freed using GlobalFreePtr().  These are both macros found
>in <windowsx.h>.
>Scott

To follow up, the documentation(Informix ESQL/C for WIndows  5.01 6-5)
says that "If you do subsequent fetches and the amount of data selected
increases, the buffer is freed and the necessary memory is allocated".
What happens if I free and Informix comes around and tries to free it again?
thanks
--terry


Wed, 18 Jun 1902 08:00:00 GMT
 Blobs n ESQL/C for Windows

Quote:


>>>I have a WFW 3.11 app that read/writes BLOBS to a Informix 5.x Online
>>>engine using ESQL/C 5.01WE1 for Windows.  The documentation for ESQL/C
>>>say that if you pass in a -1 for your uffer size on a fetch Informix wil
>>>allocate a buffer and return the size and a pointer to this buffer.  When
>>>does Informix actually release this buffer or is it up to my app?

>>It is up to your app. The memory was allocated using GlobalAllocPtr()
>>and should be freed using GlobalFreePtr().  These are both macros found
>>in <windowsx.h>.
>>Scott
>To follow up, the documentation(Informix ESQL/C for WIndows  5.01 6-5)
>says that "If you do subsequent fetches and the amount of data selected
>increases, the buffer is freed and the necessary memory is allocated".
>What happens if I free and Informix comes around and tries to free it again?
>thanks
>--terry

Don't free the memory until after you finish with the last fetch.
Informix will grow the buffer as necessary on intervening fetches if and
only if you told Informix to allocate the memory in the first place.
On the other hand, if you allocated a 10k buffer and the blob was 11k,
you will get a truncated indication. Informix does not reallocate your
memory as it had no idea where your memory came from.

Since there is no easy way to know how big a blob is prior to any given
fetch, I usually let Informix handle my blob memory management. However,
for specialized memory management, I have used the LOCUSER flag and
implemented by own loc_open/read/write/close() methods.  (see locator.h)
Scott



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Delphi 2.0 CS Update & BLOB Problem

2. Inserting blobs into sql server 2000 with esql

3. ESQL Loading blobs in memory using locator structure

4. List of DB-Spaces or Blobs-Spaces from ESQL/C

5. BLOBs, ESQL/C, Multithreaded

6. Dynamically Prepared SQL Statements and TEXT blobs in ESQL/C OnLine 4.10

7. Dynamic SQL SELECT Statements and text blobs using ESQL/C and OnLine 4.10

8. ESQL error messages for BLOBs

9. again: retrieving blob data with ESQL-C in IDS2000

10. retrieving blob data with ESQL-C in IDS2000

11. ESQL/C and BLOBS....

12. problem with blob in ESQL/C


 
Powered by phpBB® Forum Software