diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2017-10-04 20:24:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-04 20:24:38 +0200 |
| commit | 03da070f5cfda592a174f8c19349638656a521b2 (patch) | |
| tree | 673f34268ee0162df5aaf8b6624b8a8fb5c78652 /django/db/models/sql | |
| parent | 39eba25f476f5f9b9f5242bcc87686006f9b389f (diff) | |
Refs #28670 -- Moved LIMIT/OFFSET SQL to DatabaseOperations.limit_offset_sql().
Thanks Tim Graham for the review.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 6e1c2a9aaa..6d063c4a05 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -532,14 +532,9 @@ class SQLCompiler: result.append('ORDER BY %s' % ', '.join(ordering)) if with_limits: - if self.query.high_mark is not None: - result.append('LIMIT %d' % (self.query.high_mark - self.query.low_mark)) - if self.query.low_mark: - if self.query.high_mark is None: - val = self.connection.ops.no_limit_value() - if val: - result.append('LIMIT %d' % val) - result.append('OFFSET %d' % self.query.low_mark) + limit_offset_sql = self.connection.ops.limit_offset_sql(self.query.low_mark, self.query.high_mark) + if limit_offset_sql: + result.append(limit_offset_sql) if for_update_part and not self.connection.features.for_update_after_from: result.append(for_update_part) |
