Req #70372 [Com]: Emulate mysqli_fetch_all() for libmysqlclient
| From: | spam2 at rhsoft dot net | Date: | Thu, 22 Dec 2016 11:20:54 +0000 |
| Subject: | Req #70372 [Com]: Emulate mysqli_fetch_all() for libmysqlclient | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206189@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70372&edit=1
ID: 70372
Comment by: spam2 at rhsoft dot net
Reported by: asphp at dsgml dot com
Summary: Emulate mysqli_fetch_all() for libmysqlclient
Status: Open
Type: Feature/Change Request
Package: MySQLi related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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);
}
Previous Comments:
------------------------------------------------------------------------
[2015-08-27 19:38:15] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70372&edit=1