Req #38150 [Asn]: Please add row tell and seek for mysqli
Edit report at http://bugs.php.net/bug.php?id=38150&edit=1
ID: 38150
Updated by: kalle@php.net
Reported by: php at adaniels dot nl
Summary: Please add row tell and seek for mysqli
Status: Assigned
Type: Feature/Change Request
Package: MySQLi related
Operating System: Any
PHP Version: 5.1.4
Assigned To: mysql
Block user comment: N
Private report: N
New Comment:
From a "features complete" standpoint, I do not see why not add it, as
it can achieve some flexibility that a developer might need over the
iterator and vice versa.
Previous Comments:
------------------------------------------------------------------------
[2011-01-06 15:03:44] uw@php.net
That's for buffered results only. I don't see a big win considering the
iterator support added rather recently (but not properly documented).
Johannes, what's your take?
------------------------------------------------------------------------
[2006-07-19 19:13:24] php at adaniels dot nl
I mean:
function get_all_rows(mysqli_result $result)
{
$ptr = $result->row_tell();
$rows = array();
$result->data_seek(0);
while ($row = $result->fetch_row()) $rows[] = $row;
$result->row_seek($ptr);
return $rows;
}
------------------------------------------------------------------------
[2006-07-19 19:06:42] php at adaniels dot nl
Description:
------------
The mysql API functions mysql_row_tell and mysql_row_seek are not ported
to the mysqli libary.
I believe this is a shame, because currently it isn't possible to create
a function which uses a mysql_result but does not influence the code
outside of the function.
I do not see the fact that, mysqli_row_seek would return a resource and
not an actual rownumber, as a problem.
P.S. If it is generaly agreed that this is a usefull feature, but there
are no volenteers to add the function, I volenteer myself.
Reproduce code:
---------------
I would like to do the following:
function get_all_rows(mysqli_result $result)
{
$ptr = $result->row_tell();
$rows = array();
while ($row = $result->fetch_row()) $rows[] = $row;
$result->row_seek($ptr);
return $rows;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=38150&edit=1
Thread (4 messages)