The information in this article applies to:
SYMPTOMSWhen using "void *" to map a SQL BINARY column, an access violation (AV) may occur in Sqlakw32.dll. WORKAROUND
To work around this problem, use the method described in the following
article in the Microsoft Knowledge Base:
Q184564 : INF: ESQL: How to Handle Binary Data in ESQL STATUS
Microsoft has confirmed this to be a problem in Microsoft Embedded SQL
for C Programmer's Toolkit version 6.5.
MORE INFORMATION
The ESQL documentation states in one section that the SQL binary datatype
maps to the void * C datatype. However, using a void * for an input host
variable causes an access violation in Sqlakw32.dll.
The rest of this article describes the details on how to use 'void *' host variables in static ESQL to map binary data after applying this hotfix: After the precompiler generates the .c file, you need to edit it and replace the '-1' in the sqlasetv API call with the appropriate size for your void * variable (that you used malloc on). There is no other way of doing this because you have no idea about the size of the memory buffers that had malloc run on them. Therefore, it must be provided by you after nsqlprep precompiles the code. This also comes as a warning message from the precompiler. The following is the sample code to show how it works:
So in the above example, after you precompile the code, you need to search through the .c file it generates and replace -1 with 10 in:
For output data, using an unsigned char array to map the host variable should work fine in both static and dynamic ESQL, even when data contains embedded null (0x00). There is no need to use the void * host variable. Additional query words: data type
Keywords : SSrvESQL_C SSrvProg kbbug6.50 |
Last Reviewed: April 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |