diff options
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/db/backends/base/operations.py | 8 | ||||
| -rw-r--r-- | django/db/backends/oracle/operations.py | 8 |
3 files changed, 9 insertions, 8 deletions
@@ -325,6 +325,7 @@ answer newbie questions, and generally made Django that much better: Guillaume Pannatier <guillaume.pannatier@gmail.com> Gustavo Picon hambaloney + Hang Park <hangpark@kaist.ac.kr> Hannes Struß <x@hannesstruss.de> Hasan Ramezani <hasan.r67@gmail.com> Hawkeye diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index b4c2250dfa..892527873a 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -218,10 +218,10 @@ class BaseDatabaseOperations: def limit_offset_sql(self, low_mark, high_mark): """Return LIMIT/OFFSET SQL clause.""" limit, offset = self._get_limit_offset_params(low_mark, high_mark) - return '%s%s' % ( - (' LIMIT %d' % limit) if limit else '', - (' OFFSET %d' % offset) if offset else '', - ) + return ' '.join(sql for sql in ( + ('LIMIT %d' % limit) if limit else None, + ('OFFSET %d' % offset) if offset else None, + ) if sql) def last_executed_query(self, cursor, sql, params): """ diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 84c6bcc75f..6ac6b29737 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -249,10 +249,10 @@ END; def limit_offset_sql(self, low_mark, high_mark): fetch, offset = self._get_limit_offset_params(low_mark, high_mark) - return '%s%s' % ( - (' OFFSET %d ROWS' % offset) if offset else '', - (' FETCH FIRST %d ROWS ONLY' % fetch) if fetch else '', - ) + return ' '.join(sql for sql in ( + ('OFFSET %d ROWS' % offset) if offset else None, + ('FETCH FIRST %d ROWS ONLY' % fetch) if fetch else None, + ) if sql) def last_executed_query(self, cursor, sql, params): # https://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.statement |
