MySQL Forums
Forum List  »  Connector/ODBC

SQLBindCols using way too much memory
Posted by: dmballweg
Date: October 27, 2004 08:48AM

I have a memory problem with SQLBindCols versus SQLGetData. I really need to BindCols since it is significantly faster than GetData. The problem occurs mainly for SQL_C_Binary and SQL_C_CHAR types. If I use GetData the memory for my App does not really grow very much. If I use BindCols the memory grows almost 10 times that of GetData. There are no memory leaks (memchecked and memproofed), plus when the window that is doing the work in the app is closed, the app's memory goes back to normal. I have traced a BDE app that binds Binary types with 32,000+ bytes and its memory does not grow like this. I also cannot use a combination of both since MSSQL only allows GetData to be used after the last bound column. Is this an ODBC bug? or am I missing an attribute to set? I am really at a loss.

Here is some pseudo code:

ODBC 3.0
Does not matter which driver is used. Happens using the new 3.51 and the old versions.

SQLBindCols:
Loop
Clean up (freehandle) the hstmt and all memory for the variables that store data for
BindCol.
Alloc the hstmt
Execute the Query
Set up all memory for the data using SQLDescribeCols
SQLBindCols
Loop
Fetch or ExtendedFetch (I have tried it both ways, doesn't matter which one is
used)
End Loop
End Loop

SQLGetData:
Loop
Clean up (freehandle) the hstmt and all memory for the variables that store data for
GetData.
Alloc the hstmt
Execute the Query
Set up all memory for the data using SQLDescribeCols
Loop
Fetch
SQLGetData
End Loop
End Loop

Options: ReplyQuote


Subject
Written By
Posted
SQLBindCols using way too much memory
October 27, 2004 08:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.