}
/**
- * Appends +LIMIT+ and +OFFSET+ options to a SQL statement.
+ * Appends LIMIT and OFFSET options to a SQL statement.
*
* @param string $sql SQL statement.
- * @param array $options TODO
+ * @param array $options Hash with 'limit' and (optional) 'offset' values.
*
* @return string
*/
}
}
+ /**
+ * Appends LIMIT and OFFSET options to a SQL statement.
+ *
+ * @param string $sql SQL statement.
+ * @param array $options Hash with 'limit' and (optional) 'offset' values.
+ *
+ * @return string
+ */
+ public function addLimitOffset($sql, $options)
+ {
+ if (isset($options['limit']) && $limit = $options['limit']) {
+ $sql .= " LIMIT $limit";
+ }
+ if (isset($options['offset']) && $offset = $options['offset']) {
+ $sql .= " OFFSET $offset";
+ }
+ return $sql;
+ }
+
/*##########################################################################
# Protected