php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70372 Emulate mysqli_fetch_all() for libmysqlclient
Submitted: 2015-08-27 19:38 UTC Modified: 2020-12-18 11:30 UTC
Votes:3
Avg. Score:3.7 ± 1.9
Reproduced:2 of 2 (100.0%)
Same Version:4 (200.0%)
Same OS:5 (250.0%)
From: asphp at dsgml dot com Assigned: nikic (profile)
Status: Closed Package: MySQLi related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-08-27 19:38 UTC] asphp at dsgml dot com
Description:
------------
mysqli_fetch_all() only works with mysqlnd and not libmysqlclient.

But it would be very easy to emulate by fetching results in a loop and returning the array.

Doing so would make it easier for people to write code that works on either. With mysqlnd it'll be faster, but without it will at least work.

Especially since store_result anyway retrieves all the data, it should not be any slower or more memory intensive if the data is directly referenced without being copied.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-22 11:20 UTC] spam2 at rhsoft dot net
it is really a bad joke that someone needs to write wrappers like below combined with a configuration or a function_exists() overhead which defeats the whole purpose of the function

why can't 'mysqli' handle that transparent and behave for the user idetical independent how php was built?

switch($this->mysqlnd)
{
 /** libmysql */
 default:
   while($row = mysqli_fetch_assoc($result))
   {
    $arr[] = $row;
   }
   break;
 /** mysqlnd - 100% native support */
 case true: return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
 [2020-12-18 11:30 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jan 20 08:01:23 2021 UTC