Skip to content

Commit f61c7a4

Browse files
committed
Merge pull request mkleehammer#23 from geota/master
Fixes mkleehammer#22 - Increase number of loop iterations to fully pull in data
2 parents f790dfe + 1772786 commit f61c7a4

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎src/getdata.cpp‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static PyObject* GetDataString(Cursor* cur, Py_ssize_t iCol)
327327
char tempBuffer[1026]; // Pad with 2 bytes for driver bugs
328328
DataBuffer buffer(nTargetType, tempBuffer, sizeof(tempBuffer)-2);
329329

330-
for (int iDbg = 0; iDbg < 10; iDbg++) // failsafe
330+
for(;;)
331331
{
332332
SQLRETURN ret;
333333
SQLLEN cbData = 0;
@@ -396,14 +396,15 @@ static PyObject* GetDataString(Cursor* cur, Py_ssize_t iCol)
396396
{
397397
// For some reason, the NULL terminator is used in intermediate buffers but not in this final one.
398398
buffer.AddUsed(cbData);
399+
return buffer.DetachValue();
399400
}
400-
401-
if (ret == SQL_SUCCESS || ret == SQL_NO_DATA)
401+
else if (ret == SQL_NO_DATA) {
402402
return buffer.DetachValue();
403+
}
404+
else {
405+
return RaiseErrorFromHandle("SQLGetData", cur->cnxn->hdbc, cur->hstmt);
406+
}
403407
}
404-
405-
// REVIEW: Add an error message.
406-
return 0;
407408
}
408409

409410

0 commit comments

Comments
 (0)