Skip to content
Snippets Groups Projects
Commit f224e2c5 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

__builtin.Sql.Connection: Improved field fetching in res_obj_to_array().

Some SQL drivers do not support fetching the set of field names
before the first call of fetch_row(), and/or after the last
such call.

Note: Also switches to using fetch_row() instead of fetch_row_array()
to avoid the above issue.

Fixes #10035.
parent 6476a44d
Branches
Tags
No related merge requests found
......@@ -387,10 +387,13 @@ array(mapping(string:mixed))
if (arrayp(res_obj))
rows = res_obj;
else {
fields = 0;
fields = res_obj->fetch_fields();
rows = ({});
while (row = res_obj->fetch_row_array())
rows += row;
while (row = res_obj->fetch_row()) {
rows += ({ row });
if (!fields)
fields = res_obj->fetch_fields();
}
}
if (!fields)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment