[CalendarServer-changes] [6982] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:35:38 PST 2011
Revision: 6982
http://trac.macosforge.org/projects/calendarserver/changeset/6982
Author: glyph at apple.com
Date: 2011-02-16 06:35:38 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify CommonHomeChild.syncToken
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:35:27 UTC (rev 6981)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py 2011-02-16 14:35:38 UTC (rev 6982)
@@ -1611,16 +1611,22 @@
self.notifyChanged()
+ @classproperty
+ def _childSyncTokenQuery(cls):
+ """
+ DAL query for retrieving the sync token of a L{CommonHomeChild} based on
+ its resource ID.
+ """
+ rev = cls._revisionsSchema
+ return Select([Max(rev.REVISION)], From=rev,
+ Where=rev.RESOURCE_ID == Parameter("resourceID"))
+
+
@inlineCallbacks
def syncToken(self):
if self._syncTokenRevision is None:
- self._syncTokenRevision = (yield self._txn.execSQL(
- """
- select max(%(column_REVISION)s) from %(name)s
- where %(column_RESOURCE_ID)s = %%s
- """ % self._revisionsTable,
- [self._resourceID,]
- ))[0][0]
+ self._syncTokenRevision = (yield self._childSyncTokenQuery.on(
+ self._txn, resourceID=self._resourceID))[0][0]
returnValue(("%s#%s" % (self._resourceID, self._syncTokenRevision,)))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/98802333/attachment.html>
More information about the calendarserver-changes
mailing list