Commits

Michael Manfre  committed 110433d

Implemented cache_key_culling_sql added by Django ticket 18330.

  • Participants
  • Parent commits 46d8d58

Comments (0)

Files changed (2)

File docs/changelog.txt

 - UPDATE statements will now return the number of rows affected, instead of -1. :issue:`19`
 - Apply fix for :djangoticket:`12192`. If QuerySet slicing would result in ``LIMIT 0``, then it shouldn't reach
   the database because there will be no response.
+- Implemented DatabaseOperation ``cache_key_culling_sql``. :djangoticket:`18330`
 
 v1.2
 ----

File sqlserver_ado/operations.py

 class DatabaseOperations(BaseDatabaseOperations):
     compiler_module = "sqlserver_ado.compiler"
     
+    def cache_key_culling_sql(self):
+        return """
+            SELECT [cache_key]
+              FROM (SELECT [cache_key], ROW_NUMBER() OVER (ORDER BY [cache_key]) AS [rank] FROM %s) AS [RankedCache]
+             WHERE [rank] = %%s + 1
+        """
+    
     def date_extract_sql(self, lookup_type, field_name):
         if lookup_type == 'week_day':
             lookup_type = 'weekday'