php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55152 Mysql relative seek
Submitted: 2011-07-06 15:01 UTC Modified: 2011-07-20 09:32 UTC
From: lenzai2004-dev at yahoo dot fr Assigned: mysql (profile)
Status: Not a bug Package: MySQL related
PHP Version: trunk-SVN-2011-07-06 (SVN) OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lenzai2004-dev at yahoo dot fr
New email:
PHP Version: OS:

 

 [2011-07-06 15:01 UTC] 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.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-08 18:12 UTC] kalle@php.net
Hi, don't the mysqli module support this already, or with the MySQLi result iterator from 5.4?
 [2011-07-08 23:47 UTC] 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-09 16:25 UTC] Kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mysql
 [2011-07-09 16:25 UTC] Kalle@php.net
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.
 [2011-07-20 09:32 UTC] uw@php.net
-Status: Assigned +Status: Bogus
 [2011-07-20 09:32 UTC] uw@php.net
Yes, that's the case. From our perspective ext/mysql should be "maintenance only". No feature additions as small as they may be. The recent initiative on the internals lists has backed up our position. 

Closing, won't add call to ext/mysql. Use mysqli or PDO_MySQL.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC