[CalendarServer-changes] [6940] CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:27:22 PST 2011
Revision: 6940
http://trac.macosforge.org/projects/calendarserver/changeset/6940
Author: glyph at apple.com
Date: 2011-02-16 06:27:22 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify the rest of CalendarObject.updateDatabase
Modified Paths:
--------------
CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py
Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py 2011-02-16 14:27:12 UTC (rev 6939)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py 2011-02-16 14:27:22 UTC (rev 6940)
@@ -466,6 +466,8 @@
tr = schema.TIME_RANGE
co = schema.CALENDAR_OBJECT
+ tpy = schema.TRANSPARENCY
+
values = {
co.CALENDAR_RESOURCE_ID : self._calendar._resourceID,
co.RESOURCE_NAME : self._name,
@@ -521,19 +523,11 @@
}, Return=tr.INSTANCE_ID).on(self._txn))[0][0]
peruserdata = component.perUserTransparency(instance.rid)
for useruid, transp in peruserdata:
- yield self._txn.execSQL(
- """
- insert into TRANSPARENCY
- (TIME_RANGE_INSTANCE_ID, USER_ID, TRANSPARENT)
- values
- (%s, %s, %s)
- """,
- [
- instanceid,
- useruid,
- transp,
- ],
- )
+ (yield Insert({
+ tpy.TIME_RANGE_INSTANCE_ID : instanceid,
+ tpy.USER_ID : useruid,
+ tpy.TRANSPARENT : transp,
+ }).on(self._txn))
# Special - for unbounded recurrence we insert a value for "infinity"
# that will allow an open-ended time-range to always match it.
@@ -541,40 +535,24 @@
start = datetime.datetime(2100, 1, 1, 0, 0, 0, tzinfo=utc)
end = datetime.datetime(2100, 1, 1, 1, 0, 0, tzinfo=utc)
float = False
- instanceid = (yield self._txn.execSQL(
- """
- insert into TIME_RANGE
- (CALENDAR_RESOURCE_ID, CALENDAR_OBJECT_RESOURCE_ID, FLOATING, START_DATE, END_DATE, FBTYPE, TRANSPARENT)
- values
- (%s, %s, %s, %s, %s, %s, %s)
- returning
- INSTANCE_ID
- """,
- [
- self._calendar._resourceID,
- self._resourceID,
- float,
- start,
- end,
+ transp = True
+ instanceid = (yield Insert({
+ tr.CALENDAR_RESOURCE_ID : self._calendar._resourceID,
+ tr.CALENDAR_OBJECT_RESOURCE_ID : self._resourceID,
+ tr.FLOATING : float,
+ tr.START_DATE : start,
+ tr.END_DATE : end,
+ tr.FBTYPE :
icalfbtype_to_indexfbtype["UNKNOWN"],
- True,
- ],
- ))[0][0]
+ tr.TRANSPARENT : transp,
+ }, Return=tr.INSTANCE_ID).do(self._txn))[0][0]
peruserdata = component.perUserTransparency(None)
for useruid, transp in peruserdata:
- yield self._txn.execSQL(
- """
- insert into TRANSPARENCY
- (TIME_RANGE_INSTANCE_ID, USER_ID, TRANSPARENT)
- values
- (%s, %s, %s)
- """,
- [
- instanceid,
- useruid,
- transp,
- ],
- )
+ (yield Insert({
+ tpy.TIME_RANGE_INSTANCE_ID : instanceid,
+ tpy.USER_ID : useruid,
+ tpy.TRANSPARENT : transp,
+ }).on(self._txn))
@inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/9fce9580/attachment-0001.html>
More information about the calendarserver-changes
mailing list