Fix for CONPY-194:

Since executemany() returns a result set if the insert, update,
delete or replace statement contains returning directive, we
need to check if execute returned number of fiels and allocate
a result set.
This commit is contained in:
Georg Richter
2022-02-20 04:38:01 +01:00
parent 9eb77ff68e
commit 31048c64ab

View File

@ -1406,9 +1406,17 @@ MrdbCursor_executemany(MrdbCursor *self,
}
}
self->row_count= CURSOR_AFFECTED_ROWS(self);
self->lastrow_id= CURSOR_INSERT_ID(self);
MARIADB_FREE_MEM(self->values);
if ((self->field_count= CURSOR_FIELD_COUNT(self)))
{
if (MrdbCursor_InitResultSet(self))
{
return NULL;
}
} else {
self->row_count= CURSOR_AFFECTED_ROWS(self);
self->lastrow_id= CURSOR_INSERT_ID(self);
MARIADB_FREE_MEM(self->values);
}
Py_RETURN_NONE;
error:
MrdbCursor_clear(self, 0);