138 | | cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % table, [num / self._cull_frequency]) |
| 138 | cull_num = num / self._cull_frequency |
| 139 | if connections[db].vendor == 'oracle': |
| 140 | # Special case for Oracle because it doesn't support LIMIT + OFFSET |
| 141 | cursor.execute("SELECT cache_key FROM (SELECT ROW_NUMBER() OVER (ORDER BY cache_key) AS counter, cache_key FROM %s) WHERE counter > %%s AND COUNTER <= %%s" % table, [cull_num, cull_num + 1]) |
| 142 | else: |
| 143 | # This isn't standard SQL, it's likely to break with some non officially supported databases |
| 144 | cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % table, [cull_num]) |