Skip to content

Commit 1d74599

Browse files
committed
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.
1 parent c8a4ed7 commit 1d74599

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

mariadb/mariadb_cursor.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,9 +1191,18 @@ MrdbCursor_execute_bulk(MrdbCursor *self)
11911191
goto error;
11921192
}
11931193

1194-
self->affected_rows= CURSOR_AFFECTED_ROWS(self);
1195-
self->lastrow_id= CURSOR_INSERT_ID(self);
1196-
MARIADB_FREE_MEM(self->values);
1194+
if ((self->field_count= CURSOR_FIELD_COUNT(self)))
1195+
{
1196+
if (!MrdbCursor_InitResultSet(self))
1197+
{
1198+
return NULL;
1199+
}
1200+
} else
1201+
{
1202+
self->affected_rows= CURSOR_AFFECTED_ROWS(self);
1203+
self->lastrow_id= CURSOR_INSERT_ID(self);
1204+
MARIADB_FREE_MEM(self->values);
1205+
}
11971206
Py_RETURN_NONE;
11981207
error:
11991208
MrdbCursor_clear(self, 0);

0 commit comments

Comments
 (0)