Ticket #7532: no_limit_offset_sql_r7732.diff

File no_limit_offset_sql_r7732.diff, 2.7 KB (added by ramiro, 7 years ago)
  • django/db/backends/__init__.py

    diff -r 88e20e0e1871 django/db/backends/__init__.py
    a b  
    164164        """
    165165        return cursor.lastrowid
    166166
    167     def limit_offset_sql(self, limit, offset=None):
    168         """
    169         Returns a LIMIT/OFFSET SQL clause, given a limit and optional offset.
    170         """
    171         # 'LIMIT 40 OFFSET 20'
    172         sql = "LIMIT %s" % limit
    173         if offset and offset != 0:
    174             sql += " OFFSET %s" % offset
    175         return sql
    176 
    177167    def lookup_cast(self, lookup_type):
    178168        """
    179169        Returns the string to use in a query when performing lookups
  • django/db/backends/mysql/base.py

    diff -r 88e20e0e1871 django/db/backends/mysql/base.py
    a b  
    8989
    9090    def fulltext_search_sql(self, field_name):
    9191        return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
    92 
    93     def limit_offset_sql(self, limit, offset=None):
    94         # 'LIMIT 20,40'
    95         sql = "LIMIT "
    96         if offset and offset != 0:
    97             sql += "%s," % offset
    98         return sql + str(limit)
    9992
    10093    def no_limit_value(self):
    10194        # 2**64 - 1, as recommended by the MySQL documentation
  • django/db/backends/mysql_old/base.py

    diff -r 88e20e0e1871 django/db/backends/mysql_old/base.py
    a b  
    9393
    9494    def fulltext_search_sql(self, field_name):
    9595        return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
    96 
    97     def limit_offset_sql(self, limit, offset=None):
    98         # 'LIMIT 20,40'
    99         sql = "LIMIT "
    100         if offset and offset != 0:
    101             sql += "%s," % offset
    102         return sql + str(limit)
    10396
    10497    def no_limit_value(self):
    10598        # 2**64 - 1, as recommended by the MySQL documentation
  • django/db/backends/oracle/base.py

    diff -r 88e20e0e1871 django/db/backends/oracle/base.py
    a b  
    8888        sq_name = util.truncate_name(table_name, self.max_name_length() - 3)
    8989        cursor.execute('SELECT %s_sq.currval FROM dual' % sq_name)
    9090        return cursor.fetchone()[0]
    91 
    92     def limit_offset_sql(self, limit, offset=None):
    93         # Limits and offset are too complicated to be handled here.
    94         # Instead, they are handled in django/db/backends/oracle/query.py.
    95         return ""
    9691
    9792    def lookup_cast(self, lookup_type):
    9893        if lookup_type in ('iexact', 'icontains', 'istartswith', 'iendswith'):
Back to Top