diff options
Diffstat (limited to 'program/include')
-rwxr-xr-x | program/include/rcube_db.inc | 11 | ||||
-rwxr-xr-x | program/include/rcube_mdb2.inc | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc index 2b0c01af9..f732da298 100755 --- a/program/include/rcube_db.inc +++ b/program/include/rcube_db.inc @@ -103,7 +103,7 @@ class rcube_db // Query database (read operations) - function query($query) + function query($query, $offset=0, $numrows=0) { // Read or write ? if (strtolower(trim(substr($query,0,6)))=='select') @@ -115,8 +115,13 @@ class rcube_db if ($this->db_provider == 'sqlite') $query = $this->_sqlite_prepare_query($query); - - $result = $this->db_handle->query($query); + + if ($numrows || $offset) + { + $result = $this->db_handle->limitQuery($query,$offset,$numrows); + } + else + $result = $this->db_handle->query($query); if (DB::isError($result)) raise_error(array('code' => 500, diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc index 77518e7ae..cd394a878 100755 --- a/program/include/rcube_mdb2.inc +++ b/program/include/rcube_mdb2.inc @@ -103,7 +103,7 @@ class rcube_db // Query database (read operations) - function query($query) + function query($query, $offset=0, $numrows=0) { // Read or write ? if (strtolower(trim(substr($query,0,6)))=='select') @@ -116,6 +116,9 @@ class rcube_db if ($this->db_provider == 'sqlite') $query = $this->_sqlite_prepare_query($query); + $this->db_handle->row_offset = $offset; + $this->db_handle->row_limit = $numrows; + $result = $this->db_handle->query($query); if (PEAR::isError($result)) |