Voting

: max(eight, three)?
(Example: nine)

The Note You're Voting On

shawn at frozen-o dot com
19 years ago
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):

<?php
$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.

<< Back to user notes page

To Top