[CalendarServer-changes] [7117] CalendarServer/branches/users/glyph/oracle/txdav/common/datastore/ sql_legacy.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 7 19:00:17 PST 2011


Revision: 7117
          http://trac.macosforge.org/projects/calendarserver/changeset/7117
Author:   glyph at apple.com
Date:     2011-03-07 19:00:17 -0800 (Mon, 07 Mar 2011)
Log Message:
-----------
dalify notExpandedBeyond

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/oracle/txdav/common/datastore/sql_legacy.py

Modified: CalendarServer/branches/users/glyph/oracle/txdav/common/datastore/sql_legacy.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle/txdav/common/datastore/sql_legacy.py	2011-03-08 03:00:05 UTC (rev 7116)
+++ CalendarServer/branches/users/glyph/oracle/txdav/common/datastore/sql_legacy.py	2011-03-08 03:00:17 UTC (rev 7117)
@@ -1001,17 +1001,28 @@
         returnValue(name)
 
 
+    @classproperty
+    def _notExpandedBeyondQuery(self):
+        """
+        DAL query to satisfy L{PostgresLegacyIndexEmulator.notExpandedBeyond}.
+        """
+        co = schema.CALENDAR_OBJECT
+        return Select([co.RESOURCE_NAME], From=co,
+                      Where=(co.RECURRANCE_MAX < Parameter("minDate"))
+                      .And(co.CALENDAR_RESOURCE_ID == Parameter("resourceID")))
+
+
     @inlineCallbacks
     def notExpandedBeyond(self, minDate):
         """
         Gives all resources which have not been expanded beyond a given date
         in the database.  (Unused; see above L{postgresqlgenerator}.
         """
-        returnValue([row[0] for row in (yield self._txn.execSQL(
-            "select RESOURCE_NAME from CALENDAR_OBJECT "
-            "where RECURRANCE_MAX < %s and CALENDAR_RESOURCE_ID = %s",
-            [normalizeForIndex(minDate), self.calendar._resourceID]
-        ))])
+        returnValue([row[0] for row in (
+            yield self._notExpandedBeyondQuery.on(
+                self._txn, minDate=normalizeForIndex(minDate),
+                resourceID=self.calendar._resourceID))]
+        )
 
 
     @inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110307/f3d52b82/attachment.html>


More information about the calendarserver-changes mailing list