note 107765 deleted from function.db2-prepare by danbrown

From: Date: Thu, 10 May 2012 17:54:19 +0000
Subject: note 107765 deleted from function.db2-prepare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187685@lists.php.net to get a copy of this message
Note Submitter: gjarrige at six-axe dot fr ---- 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 ; }

« previous php.notes (#187685) next »