function &SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $arg3 = false, $secs2cache = 0) { if (!preg_match('/ORDER[ \\t\\r\\n]+BY/i', $sql)) { $sql .= ' ORDER BY 1'; } return ADODBConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $arg3, $secs2cache); }
function &SelectLimit($sql, $nrows = -1, $offset = -1, $arg3 = false) { if ($offset <= 0) { // could also use " OPTIMIZE FOR $nrows ROWS " $sql .= " FETCH FIRST {$nrows} ROWS ONLY "; return $this->Execute($sql, false, $arg3); } else { return ADODBConnection::SelectLimit($sql, $nrows, $offset, $arg3); } }