[CalendarServer-changes] [6936] CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/ sql.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 16 06:26:39 PST 2011


Revision: 6936
          http://trac.macosforge.org/projects/calendarserver/changeset/6936
Author:   glyph at apple.com
Date:     2011-02-16 06:26:39 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify getAllDropboxIDs

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py

Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py	2011-02-16 14:26:28 UTC (rev 6935)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py	2011-02-16 14:26:39 UTC (rev 6936)
@@ -148,23 +148,18 @@
 
     @inlineCallbacks
     def getAllDropboxIDs(self):
-
-        rows = (yield self._txn.execSQL("""
-            select %(OBJECT:column_DROPBOX_ID)s
-            from %(OBJECT:name)s
-            left outer join %(BIND:name)s on (
-              %(OBJECT:name)s.%(OBJECT:column_PARENT_RESOURCE_ID)s = %(BIND:name)s.%(BIND:column_RESOURCE_ID)s
-            )
-            where
-             %(OBJECT:column_DROPBOX_ID)s is not null and
-             %(BIND:name)s.%(BIND:column_HOME_RESOURCE_ID)s = %%s
-            order by %(OBJECT:column_DROPBOX_ID)s
-            """ % CALENDAR_OBJECT_AND_BIND_TABLE,
-            [self._resourceID]
-        ))
-        
+        co = schema.CALENDAR_OBJECT
+        cb = schema.CALENDAR_BIND
+        rows = (yield Select(
+            [co.DROPBOX_ID],
+            From=co.join(cb, co.PARENT_RESOURCE_ID == cb.RESOURCE_ID),
+            Where=(co.DROPBOX_ID != None).And(
+                cb.HOME_RESOURCE_ID == self._resourceID),
+            OrderBy=co.DROPBOX_ID
+        ).on(self._txn))
         returnValue([row[0] for row in rows])
 
+
     @inlineCallbacks
     def createdHome(self):
         defaultCal = yield self.createCalendarWithName("calendar")
@@ -173,6 +168,8 @@
             Opaque())
         yield self.createCalendarWithName("inbox")
 
+
+
 class Calendar(CommonHomeChild):
     """
     File-based implementation of L{ICalendar}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/a49b6be7/attachment.html>


More information about the calendarserver-changes mailing list