Skip to content

Instantly share code, notes, and snippets.

@msabramo
Last active December 22, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msabramo/6501240 to your computer and use it in GitHub Desktop.
Save msabramo/6501240 to your computer and use it in GitHub Desktop.
2013-09-09 - Patch for pymssql 1.0.2 to make it work with newer versions of FreeTDS
diff --git a/mssqldbmodule.c b/mssqldbmodule.c
index 151bc2c..7081715 100644
--- a/mssqldbmodule.c
+++ b/mssqldbmodule.c
@@ -1934,12 +1934,12 @@ PyObject *get_result(_mssql_connection *conn) {
// find a result set that has at least one column
conn->last_dbresults = SUCCEED;
- while (conn->last_dbresults == SUCCEED &&
- (conn->num_columns = dbnumcols(conn->dbproc)) <= 0) {
+ do {
Py_BEGIN_ALLOW_THREADS
conn->last_dbresults = dbresults(conn->dbproc);
Py_END_ALLOW_THREADS
- }
+ } while (conn->last_dbresults == SUCCEED &&
+ (conn->num_columns = dbnumcols(conn->dbproc)) <= 0);
check_cancel_and_raise(conn->last_dbresults, conn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment