diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-24 02:05:26 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-24 02:05:26 +0200 |
commit | 2c35b64fc2b072ce873c56dde0f4bb1e5f404450 (patch) | |
tree | 516cc4bf32dba19eba93ce3be9770e414e957ae1 /system/database/DB_query_builder.php | |
parent | 473130a226219dac6ef5c59b625b0e1361b292b3 (diff) |
Add a default _limit() method to the Query Builder class
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r-- | system/database/DB_query_builder.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 4631b1b92..dad1df116 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1061,6 +1061,23 @@ abstract class CI_DB_query_builder extends CI_DB_driver { // -------------------------------------------------------------------- /** + * Limit string + * + * Generates a platform-specific LIMIT clause + * + * @param string the sql query string + * @param int the number of rows to limit the query to + * @param int the offset value + * @return string + */ + protected function _limit($sql, $limit, $offset) + { + return $sql.' LIMIT '.($offset ? $offset.', ' : '').$limit; + } + + // -------------------------------------------------------------------- + + /** * The "set" function. * * Allows key/value pairs to be set for inserting or updating |