Fixed #30242 -- Removed extra space before LIMIT/OFFSET SQL.

This commit is contained in:
Hang Park 2019-03-10 05:32:20 +09:00 committed by Mariusz Felisiak
parent a35bf4af72
commit 142e1ead76
3 changed files with 9 additions and 8 deletions

View File

@ -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

View File

@ -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):
"""

View File

@ -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