diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-02-25 21:46:03 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-07-21 23:17:37 +0200 |
commit | 1d5d23a1de5a490595d8bb7ea81b8bda48b8feeb (patch) | |
tree | bf383f4bcef6b1411bda6a9b83135fe4b72dc204 /lib/db | |
parent | a48e9c488b7ccf22a911a0fb33b69ef782f63a81 (diff) | |
download | nextcloud-server-1d5d23a1de5a490595d8bb7ea81b8bda48b8feeb.tar.gz nextcloud-server-1d5d23a1de5a490595d8bb7ea81b8bda48b8feeb.zip |
Move limit/offset handling to Connection wrapper
Diffstat (limited to 'lib/db')
-rw-r--r-- | lib/db/connection.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/db/connection.php b/lib/db/connection.php index 763251c1903..c8695b13190 100644 --- a/lib/db/connection.php +++ b/lib/db/connection.php @@ -50,8 +50,12 @@ class Connection extends \Doctrine\DBAL\Connection { */ public function prepare( $statement, $limit=null, $offset=null ) { $statement = $this->replaceTablePrefix($statement); - if (!is_null($limit) && $limit != -1) { - // TODO: limit & offset + if ($limit === -1) { + $limit = null; + } + if (!is_null($limit)) { + $platform = $this->getDatabasePlatform(); + $statement = $platform->modifyLimitQuery($statement, $limit, $offset); } else { if (isset($this->preparedQueries[$statement]) && $this->cachingQueryStatementEnabled) { return $this->preparedQueries[$statement]; @@ -59,7 +63,7 @@ class Connection extends \Doctrine\DBAL\Connection { } $rawQuery = $statement; $result = parent::prepare($statement); - if ((is_null($limit) || $limit == -1) && $this->cachingQueryStatementEnabled) { + if (is_null($limit) && $this->cachingQueryStatementEnabled) { $this->preparedQueries[$rawQuery] = $result; } return $result; |