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:
Adrian Holovaty 2007-08-19 23:24:59 +00:00
parent 5ce050a5f5
commit d3e69c3a47
10 changed files with 30 additions and 44 deletions

View file

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