mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-15 23:42:40 +00:00
Fix for CONPY-178:
When a cursor was not properly cleared (all results weren't fetched) the clear_result routine has to free result sets only if field_count > 0.
This commit is contained in:
@ -386,12 +386,14 @@ static void MrdbCursor_clear_result(MrdbCursor *self)
|
||||
self->stmt)
|
||||
{
|
||||
/* free current result */
|
||||
mysql_stmt_free_result(self->stmt);
|
||||
if (mysql_stmt_field_count(self->stmt))
|
||||
mysql_stmt_free_result(self->stmt);
|
||||
|
||||
/* check if there are more pending result sets */
|
||||
while (mysql_stmt_next_result(self->stmt) == 0)
|
||||
{
|
||||
mysql_stmt_free_result(self->stmt);
|
||||
if (mysql_stmt_field_count(self->stmt))
|
||||
mysql_stmt_free_result(self->stmt);
|
||||
}
|
||||
} else if (self->is_text)
|
||||
{
|
||||
@ -1631,6 +1633,8 @@ MrdbCursor_callproc(MrdbCursor *self, PyObject *args)
|
||||
PyTuple_SetItem(new_args, 0, PyUnicode_FromString(stmt));
|
||||
PyTuple_SetItem(new_args, 1, data);
|
||||
|
||||
MrdbCursor_clear_result(self);
|
||||
|
||||
rc= MrdbCursor_execute(self, new_args, NULL);
|
||||
end:
|
||||
if (stmt)
|
||||
|
@ -13,6 +13,7 @@ def conf():
|
||||
d = {
|
||||
"user": os.environ.get('TEST_USER', 'root'),
|
||||
"host": os.environ.get('TEST_HOST', 'localhost'),
|
||||
"unix_socket" : "/tmp/mysql.sock",
|
||||
"database": os.environ.get('TEST_DATABASE', 'testp'),
|
||||
"port": int(os.environ.get('TEST_PORT', '3306')),
|
||||
}
|
||||
|
Reference in New Issue
Block a user