[CalendarServer-changes] [7003] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:39:36 PST 2011
Revision: 7003
http://trac.macosforge.org/projects/calendarserver/changeset/7003
Author: glyph at apple.com
Date: 2011-02-16 06:39:36 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify one query in notificationsWithUID
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:39:23 UTC (rev 7002)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py 2011-02-16 14:39:36 UTC (rev 7003)
@@ -2312,7 +2312,10 @@
)
_revisionsTable = NOTIFICATION_OBJECT_REVISIONS_TABLE
+ _revisionsSchema = schema.NOTIFICATION_OBJECT_REVISIONS
+ _homeSchema = schema.NOTIFICATION_HOME
+
def __init__(self, txn, uid, resourceID):
self._txn = txn
@@ -2337,18 +2340,20 @@
notifiers = None
self._notifiers = notifiers
+
+ _resourceIDFromUIDQuery = Select(
+ [_homeSchema.RESOURCE_ID], From=_homeSchema,
+ Where=_homeSchema.OWNER_UID == Parameter("uid"))
+
@classmethod
@inlineCallbacks
def notificationsWithUID(cls, txn, uid):
"""
Implement notificationsWithUID.
"""
- rows = yield txn.execSQL(
- """
- select %(column_RESOURCE_ID)s from %(name)s where
- %(column_OWNER_UID)s = %%s
- """ % NOTIFICATION_HOME_TABLE, [uid]
- )
+
+ rows = yield cls._resourceIDFromUIDQuery.on(txn, uid=uid)
+
if rows:
resourceID = rows[0][0]
created = False
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/8e6a5414/attachment-0001.html>
More information about the calendarserver-changes
mailing list