File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2114,18 +2114,25 @@ _mysql_ConnectionObject_discard_result(
2114
2114
MYSQL * conn = & (self -> connection );
2115
2115
2116
2116
Py_BEGIN_ALLOW_THREADS ;
2117
+
2117
2118
MYSQL_RES * res = mysql_use_result (conn );
2118
2119
if (res == NULL ) {
2119
2120
Py_BLOCK_THREADS ;
2120
- return _mysql_Exception (self );
2121
+ if (mysql_errno (conn ) != 0 ) {
2122
+ // fprintf(stderr, "mysql_use_result failed: %s\n", mysql_error(conn));
2123
+ return _mysql_Exception (self );
2124
+ }
2125
+ Py_RETURN_NONE ;
2121
2126
}
2127
+
2122
2128
MYSQL_ROW row ;
2123
2129
while (NULL != (row = mysql_fetch_row (res ))) {
2124
2130
// do nothing.
2125
2131
}
2126
2132
mysql_free_result (res );
2127
2133
Py_END_ALLOW_THREADS ;
2128
2134
if (mysql_errno (conn )) {
2135
+ // fprintf(stderr, "mysql_free_result failed: %s\n", mysql_error(conn));
2129
2136
return _mysql_Exception (self );
2130
2137
}
2131
2138
Py_RETURN_NONE ;
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def _discard(self):
90
90
con = self .connection
91
91
if con is None :
92
92
return
93
- while con .next_result ():
93
+ while con .next_result () == 0 : # -1 means no more data.
94
94
con .discard_result ()
95
95
96
96
def close (self ):
You can’t perform that action at this time.
0 commit comments