[CalendarServer-changes] [9588] CalendarServer/branches/users/glyph/q
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 11 01:54:32 PDT 2012
Revision: 9588
http://trac.macosforge.org/projects/calendarserver/changeset/9588
Author: glyph at apple.com
Date: 2012-08-11 01:54:32 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
Make the test pass!
Modified Paths:
--------------
CalendarServer/branches/users/glyph/q/twext/enterprise/dal/syntax.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/q/
Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/syntax.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/syntax.py 2012-08-11 08:54:31 UTC (rev 9587)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/syntax.py 2012-08-11 08:54:32 UTC (rev 9588)
@@ -27,7 +27,7 @@
from twisted.internet.defer import succeed
-from twext.enterprise.dal.model import Schema, Table, Column, Sequence
+from twext.enterprise.dal.model import Schema, Table, Column, Sequence, SQLType
from twext.enterprise.ienterprise import (
POSTGRES_DIALECT, ORACLE_DIALECT, SQLITE_DIALECT, IDerivedParameter
)
@@ -200,7 +200,6 @@
located somewhere in C{self}
@return: results from the database.
-
@rtype: a L{Deferred} firing a C{list} of records (C{tuple}s or
C{list}s)
"""
@@ -446,6 +445,7 @@
Len = Function("character_length", "length")
Upper = Function("upper")
Lower = Function("lower")
+_sqliteLastInsertRowID = Function("last_insert_rowid")
# Use a specific value here for "the convention for case-insensitive values in
# the database" so we don't need to keep remembering whether it's upper or
@@ -1336,7 +1336,26 @@
return self._returnAsList()
+ def on(self, txn, *a, **kw):
+ """
+ Override to provide potentially extra logic for insert/update/delete
+ that return values on databases that don't necessarily provide it.
+ """
+ result = super(_DMLStatement, self).on(txn, *a, **kw)
+ if txn.dialect == SQLITE_DIALECT:
+ table = self._returnAsList()[0].model.table
+ return Select(self._returnAsList(),
+ # TODO: error reporting when 'return' includes columns
+ # foreign to the primary table.
+ From=TableSyntax(table),
+ Where=ColumnSyntax(Column(table, "rowid",
+ SQLType("integer", None))) ==
+ _sqliteLastInsertRowID()
+ ).on(txn, *a, **kw)
+ return result
+
+
class _OracleOutParam(object):
"""
A parameter that will be populated using the cx_Oracle API for host
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/d8400574/attachment-0001.html>
More information about the calendarserver-changes
mailing list