Michael Manfre avatar Michael Manfre committed 110433d

Implemented cache_key_culling_sql added by Django ticket 18330.

Comments (0)

Files changed (2)

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
 ----

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'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.