[CalendarServer-changes] [7008] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 16 06:40:31 PST 2011


Revision: 7008
          http://trac.macosforge.org/projects/calendarserver/changeset/7008
Author:   glyph at apple.com
Date:     2011-02-16 06:40:31 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify NotificationCollection._initSyncToken

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

Modified: CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py	2011-02-16 14:40:20 UTC (rev 7007)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py	2011-02-16 14:40:31 UTC (rev 7008)
@@ -2483,16 +2483,20 @@
         yield self._deleteRevision("%s.xml" % (uid,))
 
 
+    _initSyncTokenQuery = Insert(
+        {
+            _revisionsSchema.HOME_RESOURCE_ID : Parameter("resourceID"),
+            _revisionsSchema.RESOURCE_NAME    : None,
+            _revisionsSchema.REVISION         : schema.REVISION_SEQ,
+            _revisionsSchema.DELETED          : False
+        }, Return=_revisionsSchema.REVISION
+    )
+
+
     @inlineCallbacks
     def _initSyncToken(self):
-        self._syncTokenRevision = (yield self._txn.execSQL("""
-            insert into %(name)s
-            (%(column_HOME_RESOURCE_ID)s, %(column_RESOURCE_NAME)s, %(column_REVISION)s, %(column_DELETED)s)
-            values (%%s, null, nextval('%(sequence)s'), FALSE)
-            returning %(column_REVISION)s
-            """ % self._revisionsTable,
-            [self._resourceID,]
-        ))[0][0]
+        self._syncTokenRevision = (yield self._initSyncTokenQuery.on(
+            self._txn, resourceID=self._resourceID))[0][0]
 
 
     @inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/ba384e20/attachment.html>


More information about the calendarserver-changes mailing list