-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryError with Version 4.0. #223
Comments
Hi, a backtrace can be found at the bottom of this post. I think the returned values from the driver are not determined correctly.
This should be handled here (getdata.cpp >>> ReadVarColumn) ... if (ret == SQL_SUCCESS && cbData < 0)
{
// HACK: FreeTDS 0.91 on OS/X returns -4 for NULL data instead of SQL_NULL_DATA
// (-1). I've traced into the code and it appears to be the result of assigning -1
// to a SQLLEN. We are going to treat all negative values as NULL.
ret = SQL_NULL_DATA;
cbData = 0;
} ... but in this case not correctly for the null value. BACKTRACE
Regards |
Hi, I have add a cast to int of cbData in the ReadVarColumn function of getdata.cpp. This solves the null value handling problem but there are still memory errors on data values. if (ret == SQL_SUCCESS && (int)cbData < 0)
{
// HACK: FreeTDS 0.91 on OS/X returns -4 for NULL data instead of SQL_NULL_DATA
// (-1). I've traced into the code and it appears to be the result of assigning -1
// to a SQLLEN. We are going to treat all negative values as NULL.
ret = SQL_NULL_DATA;
cbData = 0;
} Regards |
Is there any chance that the commit of @cyrixsimon will be reviews as this would fix our issues |
fix for issue #223 (memory error with db2 driver)
I've merged it in but have not made a build yet. I was hoping to fix a few things before. Is that a problem or do you need a prebuilt, official version to continue? |
Hi,
we recently tried to switch to pyodbc 4.0.16 from 3.x and ran into troubles with a connection to IBM DB2
We use a db2 version 10.1 client and the unixodbc drivers.
This configuration has been working with version pyodbc 3.x for many months but now fails whenever we read a NULL value from a char or varchar field in the database
Sample program:
On the execute
we get a Segmentation fault or memory error as soon as a null value is present. The kind of error differs from script to script.
Any ideas what might cause this. The IBM DB2 driver works fine with other ODBC Tools.
Kind Regards
Charly
The text was updated successfully, but these errors were encountered: