Skip to content

Commit

Permalink
Merge pull request #226 from cyrixsimon/master
Browse files Browse the repository at this point in the history
fix for issue #223 (memory error with db2 driver)
  • Loading branch information
mkleehammer committed Apr 28, 2017
2 parents 722c74b + 0ff4e1a commit ca3df0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/getdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static bool ReadVarColumn(Cursor* cur, Py_ssize_t iCol, SQLSMALLINT ctype, bool&
// cbUsed.

Py_ssize_t cbAvailable = cbAllocated - cbUsed;
SQLLEN cbData;
SQLLEN cbData = 0;

Py_BEGIN_ALLOW_THREADS
ret = SQLGetData(cur->hstmt, (SQLUSMALLINT)(iCol+1), ctype, &pb[cbUsed], (SQLLEN)cbAvailable, &cbData);
Expand All @@ -125,7 +125,7 @@ static bool ReadVarColumn(Cursor* cur, Py_ssize_t iCol, SQLSMALLINT ctype, bool&
return false;
}

if (ret == SQL_SUCCESS && cbData < 0)
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
Expand Down

0 comments on commit ca3df0d

Please sign in to comment.