Req #55152 [Opn->Asn]: Mysql relative seek
| From: | Kalle@php.net | Date: | Sat, 09 Jul 2011 20:25:40 +0000 |
| Subject: | Req #55152 [Opn->Asn]: Mysql relative seek | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161729@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55152&edit=1
ID: 55152
Updated by: Kalle@php.net
Reported by: lenzai2004-dev at yahoo dot fr
Summary: Mysql relative seek
-Status: Open
+Status: Assigned
Type: Feature/Change Request
Package: MySQL related
Operating System: all
PHP Version: trunk-SVN-2011-07-06 (SVN)
-Assigned To:
+Assigned To: mysql
Block user comment: N
Private report: N
New Comment:
Hi
I believe the MySQL guys (namely Andrey, Ulf and Johannes) wants to only fix bugs in the mysql
module as the mysqli module was originally written to deprecate the original mysql module one day.
I'll assign it to them so they can evaluate this report.
Previous Comments:
------------------------------------------------------------------------
[2011-07-08 23:47:03] lenzai2004-dev at yahoo dot com
Yes Indeed.
Well if mysql API is considered deprecated in PHP 5 the I should drop my request.
If not, I believe it is a nice a simple addition.
------------------------------------------------------------------------
[2011-07-08 18:12:17] kalle@php.net
Hi, don't the mysqli module support this already, or with the MySQLi result iterator from 5.4?
------------------------------------------------------------------------
[2011-07-06 15:01:55] lenzai2004-dev at yahoo dot fr
Description:
------------
There is currently a function to do absolute seek in Mysql API.
When you need to to relative seek , you have to implement integer counter to keep track of the
current cursor position. Then call seek
here is a sample code:
//iterating over rows
for/while....{
mysql_fetch_xxxx(....);
$current_row++;
[...]
// call relative seek
$current_row+= $seek_offset;
mysql_data_seek($id, $current_row);
This quite simple but when the code gets complicated, it s easy to miss on $current_row update. The
only only solution is to encapsulate php mysql function in additional abstraction layer to handle
counter updates safely.
I suppose the internal counter is already available in mysql module.
What I am suggesting, is to expose this internal counter by adding a new function to mysql API.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55152&edit=1