__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
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment