From: nowelium at gmail dot com Operating system: SuSE Linux 10.0 PHP version: 5.1.4 PHP Bug Type: PDO related Bug description: can't fetch cursor position in PDOStatement::fetch
Description: ------------ When using PDO for simple query for PostgreSQL(8.0.3) and MySQL(5.0.18) cannot acquire it though I want to acquire the offset of the specified cursor. and, fetch() is next offset acquired when acquiring it. The referred sample is manual://function.pdostatement-fetch.php in DB empno | ename | job | mgr | hiredate | sal | comm | deptno -------+--------+-----------+------+------------+---------+---------+-------- 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 | | 20 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 7521 | WARD | SALESMAN | 7698 | 1981-02-22 | 1250.00 | 500.00 | 30 7566 | JONES | MANAGER | 7839 | 1981-04-02 | 2975.00 | | 20 7654 | MARTIN | SALESMAN | 7698 | 1981-09-28 | 1250.00 | 1400.00 | 30 Reproduce code: --------------- // mysql:host=localhost; dbname=foodb $dbh = new PDO("pgsql:host=localhost; dbname=foodb", $user, $pass); $stmt = $dbh->prepare("SELECT * FROM EMP ORDER BY EMPNO", array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL)); $stmt->execute(); var_dump($stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_ABS, 3)); var_dump($stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_REL, 1)); Expected result: ---------------- array(8) { ["empno"]=> int(7369) ["ename"]=> string(5) "SMITH" ["job"]=> string(5) "CLERK" ["mgr"]=> int(7902) ["hiredate"]=> string(10) "1980-12-17" ["sal"]=> string(6) "800.00" ["comm"]=> NULL ["deptno"]=> int(20) } array(8) { ["empno"]=> int(7499) ["ename"]=> string(5) "ALLEN" ["job"]=> string(8) "SALESMAN" ["mgr"]=> int(7698) ["hiredate"]=> string(10) "1981-02-20" ["sal"]=> string(7) "1600.00" ["comm"]=> string(6) "300.00" ["deptno"]=> int(30) } Actual result: -------------- array(8) { ["empno"]=> int(7566) ["ename"]=> string(5) "JONES" ["job"]=> string(7) "MANAGER" ["mgr"]=> int(7839) ["hiredate"]=> string(10) "1981-04-02" ["sal"]=> string(7) "2975.00" ["comm"]=> NULL ["deptno"]=> int(20) } array(8) { ["empno"]=> int(7654) ["ename"]=> string(6) "MARTIN" ["job"]=> string(8) "SALESMAN" ["mgr"]=> int(7698) ["hiredate"]=> string(10) "1981-09-28" ["sal"]=> string(7) "1250.00" ["comm"]=> string(7) "1400.00" ["deptno"]=> int(30) } -- Edit bug report at http://bugs.php.net/?id=37340&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37340&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37340&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37340&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37340&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37340&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37340&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37340&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37340&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37340&r=support Expected behavior: http://bugs.php.net/fix.php?id=37340&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37340&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37340&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37340&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37340&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37340&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37340&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37340&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37340&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37340&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37340&r=mysqlcfg