note 66351 added to function.db2-exec

From: Date: Fri, 19 May 2006 17:34:36 +0000
Subject: note 66351 added to function.db2-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-111699@lists.php.net to get a copy of this message
If you need to "emulate" offset/limit (as PEAR::DB puts it) for db2 queries, you will definitely need to add array('cursor' => DB2_SCROLLABLE) to your db2_exec() call. Otherwise, you will get nothing useful from db2_fetch_{whatever}() when you try to (see following hack for example): $limit = 10; $offset = 20; for ($i = 0; $i < $limit && $row = db2_fetch_array($result, $offset + $i); $i++) { // stuff goes here } You can accomplish the same time of thing using sub-selects, "with" statements and other things new to me in the world of DB2, but the more dynamically generated the queries, the more difficult it gets to implement limit/offset behavior on the fly. ---- Server IP: 66.163.161.117 Probable Submitter: 64.128.31.20 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.db2-exec.php Edit -- http://master.php.net/note/edit/66351 Del: integrated -- http://master.php.net/note/delete/66351/integrated Del: useless -- http://master.php.net/note/delete/66351/useless Del: bad code -- http://master.php.net/note/delete/66351/bad+code Del: spam -- http://master.php.net/note/delete/66351/spam Del: non-english -- http://master.php.net/note/delete/66351/non-english Del: in docs -- http://master.php.net/note/delete/66351/in+docs Del: other reasons-- http://master.php.net/note/delete/66351 Reject -- http://master.php.net/note/reject/66351 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#111699) next »