note 107765 added to function.db2-prepare
| From: | gjarrige at six-axe dot fr | Date: | Fri, 02 Mar 2012 15:20:42 +0000 |
| Subject: | note 107765 added to function.db2-prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186469@lists.php.net to get a copy of this message | ||
This technique enables to paginate into a DB2 for i5 (or IBM i) platform :
public static function getScrollCursor($db, $sql, $args, $offset, $nblines_by_page ) {
$rows = array() ;
$st = db2_prepare ( $db, $sql, array('cursor' => DB2_SCROLLABLE) );
if (! $st) {
// place your error message here
$rows = null;
} else {
if (! db2_execute ( $st, $args )) {
// place your error message here
$rows = null;
} else {
$max_offset = $offset + $nblines_by_page - 1 ;
for (
$tofetch = $nbl_par_page,
$row = db2_fetch_assoc ( $st, $max_offset);
$row !== false && $tofetch-- > 0;
$row = db2_fetch_assoc ( $st )
) {
$rows [] = $row;
}
}
db2_free_stmt($st);
}
return $rows ;
}
----
Server IP: 89.31.146.176
Probable Submitter: 212.155.199.228
----
Manual Page -- http://www.php.net/manual/en/function.db2-prepare.php
Edit -- https://master.php.net/note/edit/107765
Del: integrated -- https://master.php.net/note/delete/107765/integrated
Del: useless -- https://master.php.net/note/delete/107765/useless
Del: bad code -- https://master.php.net/note/delete/107765/bad+code
Del: spam -- https://master.php.net/note/delete/107765/spam
Del: non-english -- https://master.php.net/note/delete/107765/non-english
Del: in docs -- https://master.php.net/note/delete/107765/in+docs
Del: other reasons-- https://master.php.net/note/delete/107765
Reject -- https://master.php.net/note/reject/107765
Search -- https://master.php.net/manage/user-notes.php