[CalendarServer-changes] [6974] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:34:05 PST 2011
Revision: 6974
http://trac.macosforge.org/projects/calendarserver/changeset/6974
Author: glyph at apple.com
Date: 2011-02-16 06:34:05 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify CommonHomeChild.listObjectResources
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:33:53 UTC (rev 6973)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py 2011-02-16 14:34:05 UTC (rev 6974)
@@ -1414,15 +1414,22 @@
returnValue(results)
+ @classproperty
+ def _objectResourceNamesQuery(cls):
+ """
+ DAL query to load all object resource names for a home child.
+ """
+ obj = cls._objectSchema
+ return Select([obj.RESOURCE_NAME], From=obj,
+ Where=obj.PARENT_RESOURCE_ID == Parameter('resourceID'))
+
+
@inlineCallbacks
def listObjectResources(self):
if self._objectNames is None:
- rows = yield self._txn.execSQL(
- "select %(column_RESOURCE_NAME)s from %(name)s "
- "where %(column_PARENT_RESOURCE_ID)s = %%s" % self._objectTable,
- [self._resourceID])
+ rows = yield self._objectResourceNamesQuery.on(
+ self._txn, resourceID=self._resourceID)
self._objectNames = sorted([row[0] for row in rows])
-
returnValue(self._objectNames)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/e08de8ce/attachment.html>
More information about the calendarserver-changes
mailing list