mirror of
https://github.com/django/django.git
synced 2025-09-12 05:26:27 +00:00
Refactored get_limit_offset_sql() to DatabaseOperations.limit_offset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5ce050a5f5
commit
d3e69c3a47
10 changed files with 30 additions and 44 deletions
|
@ -77,6 +77,13 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|||
def fulltext_search_sql(self, field_name):
|
||||
return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
|
||||
|
||||
def limit_offset_sql(self, limit, offset=None):
|
||||
# 'LIMIT 20,40'
|
||||
sql = "LIMIT "
|
||||
if offset and offset != 0:
|
||||
sql += "%s," % offset
|
||||
return sql + str(limit)
|
||||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
ops = DatabaseOperations()
|
||||
|
||||
|
@ -155,12 +162,6 @@ dictfetchone = util.dictfetchone
|
|||
dictfetchmany = util.dictfetchmany
|
||||
dictfetchall = util.dictfetchall
|
||||
|
||||
def get_limit_offset_sql(limit, offset=None):
|
||||
sql = "LIMIT "
|
||||
if offset and offset != 0:
|
||||
sql += "%s," % offset
|
||||
return sql + str(limit)
|
||||
|
||||
def get_random_function_sql():
|
||||
return "RAND()"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue