[CalendarServer-changes] [6963] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:31:58 PST 2011
Revision: 6963
http://trac.macosforge.org/projects/calendarserver/changeset/6963
Author: glyph at apple.com
Date: 2011-02-16 06:31:58 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify CommonHomeChild.listObjects
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:31:44 UTC (rev 6962)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py 2011-02-16 14:31:58 UTC (rev 6963)
@@ -976,6 +976,16 @@
bind.BIND_MODE == _BIND_MODE_OWN))
+ @classproperty
+ def _sharedChildListQuery(cls):
+ bind = cls._bindSchema
+ return Select([bind.RESOURCE_NAME], From=bind,
+ Where=(bind.HOME_RESOURCE_ID ==
+ Parameter("resourceID")).And(
+ bind.BIND_MODE != _BIND_MODE_OWN).And(
+ bind.RESOURCE_NAME != None))
+
+
@classmethod
@inlineCallbacks
def listObjects(cls, home, owned):
@@ -989,19 +999,12 @@
rows = yield cls._ownedChildListQuery.on(
home._txn, resourceID=home._resourceID)
else:
- rows = yield home._txn.execSQL("""
- select %(column_RESOURCE_NAME)s from %(name)s
- where
- %(column_HOME_RESOURCE_ID)s = %%s and
- %(column_BIND_MODE)s != %%s and
- %(column_RESOURCE_NAME)s is not null
- """ % cls._bindTable,
- [home._resourceID, _BIND_MODE_OWN]
- )
-
+ rows = yield cls._sharedChildListQuery.on(
+ home._txn, resourceID=home._resourceID)
names = [row[0] for row in rows]
returnValue(names)
+
@classmethod
@inlineCallbacks
def loadAllObjects(cls, home, owned):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/8fcbdc15/attachment.html>
More information about the calendarserver-changes
mailing list