Bug->Req #57623 [Opn->Wfx]: PDO::FETCH_ORI_LAST & PDO::FETCH_ORI_PRIOR

From: Date: Mon, 12 Sep 2016 22:14:58 +0000
Subject: Bug->Req #57623 [Opn->Wfx]: PDO::FETCH_ORI_LAST & PDO::FETCH_ORI_PRIOR
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203985@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=57623&edit=1 ID: 57623 Updated by: adambaratz@php.net Reported by: danil dot megrabjan at gmail dot com Summary: PDO::FETCH_ORI_LAST & PDO::FETCH_ORI_PRIOR -Status: Open +Status: Wont fix -Type: Bug +Type: Feature/Change Request Package: PDO DBlib Operating System: sles 10 PHP Version: 5.2.1 Block user comment: N Private report: N New Comment: pdo_dblib doesn't support scrollable cursors, so this would be a feature request. DB-Library doesn't exactly support them either. The closest thing it offers are row buffers. It might be possible to approximate this functionality with them, but the API semantics are a little different. For one thing, you have to declare a buffer size. Since use cases likely vary, it might be better to handle this at a higher level. Previous Comments: ------------------------------------------------------------------------ [2012-02-10 11:15:27] shol_ at hotmail dot com I've a similar problem with PDO::FETCH_ORI_LAST as you have, in my case I only want the last entry from the resultset, but PDO::FETCH_ORI_LAST fetches the first one. If I fetch an x number of other entries with PDO::FETCH_ORI_PRIOR, after PDO::FETCH_ORI_LAST, then it spits out the same results as if I were doing an fetchAll(). Did you find an efficient workaround ? I use the same php version, but on ubuntu 9.1. This is the only post on internet AFAIK, about this bug. ------------------------------------------------------------------------ [2007-04-17 06:49:01] danil dot megrabjan at gmail dot com Description: ------------ I have a mssql table. Something like this: id | field1 ----------- 1 | a 2 | b 3 | c ----------- I want to move backward (from last to first), in my PDOStatment. But... Reproduce code: --------------- $db = new PDO('dblib:host=192.168.1.3:1433;dbname=db', 'user', 'password', array(PDO::ATTR_PERSISTENT => true)); $stmt = $db->prepare('select * from table', array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL)); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_BOTH, PDO::FETCH_ORI_LAST); while ($row = $stmt->fetch(PDO::FETCH_BOTH, PDO::FETCH_ORI_PRIOR)) { print $row[0] . "\t" . $row[1] . "\n"; } $stmt = null; ?> Expected result: ---------------- ------- 3 | c 2 | b 1 | a ------- Actual result: -------------- ------- 1 | a 2 | b 3 | c ------- ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=57623&edit=1

« previous php.bugs (#203985) next »