[CalendarServer-changes] [6782] CalendarServer/branches/users/glyph/dal/txdav/base/datastore
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jan 19 13:00:19 PST 2011
Revision: 6782
http://trac.macosforge.org/projects/calendarserver/changeset/6782
Author: glyph at apple.com
Date: 2011-01-19 13:00:19 -0800 (Wed, 19 Jan 2011)
Log Message:
-----------
column selection with JOIN
Modified Paths:
--------------
CalendarServer/branches/users/glyph/dal/txdav/base/datastore/sqlsyntax.py
CalendarServer/branches/users/glyph/dal/txdav/base/datastore/test/test_sqlsyntax.py
Modified: CalendarServer/branches/users/glyph/dal/txdav/base/datastore/sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/dal/txdav/base/datastore/sqlsyntax.py 2011-01-19 21:00:08 UTC (rev 6781)
+++ CalendarServer/branches/users/glyph/dal/txdav/base/datastore/sqlsyntax.py 2011-01-19 21:00:19 UTC (rev 6782)
@@ -130,7 +130,11 @@
return stmt
+ def tables(self):
+ return self.firstTable.tables() + self.secondTableOrJoin.tables()
+
+
def comparison(comparator):
def __(self, other):
if isinstance(other, ColumnSyntax):
Modified: CalendarServer/branches/users/glyph/dal/txdav/base/datastore/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/dal/txdav/base/datastore/test/test_sqlsyntax.py 2011-01-19 21:00:08 UTC (rev 6781)
+++ CalendarServer/branches/users/glyph/dal/txdav/base/datastore/test/test_sqlsyntax.py 2011-01-19 21:00:19 UTC (rev 6782)
@@ -141,6 +141,21 @@
)
+ def test_joinColumnSelection(self):
+ """
+ If multiple columns are specified by the argument to L{Select} that uses
+ a L{TableSyntax.join}, those will be output by the SQL statement.
+ """
+ self.assertEquals(
+ Select([self.schema.FOO.BAZ,
+ self.schema.BOZ.QUX],
+ From=self.schema.FOO.join(self.schema.BOZ,
+ self.schema.FOO.BAR ==
+ self.schema.BOZ.QUX)).toSQL(),
+ SQLStatement("select BAZ, QUX from FOO join BOZ on BAR = QUX")
+ )
+
+
def test_tableMismatch(self):
"""
When a column in the 'columns' argument does not match the table from
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110119/14564677/attachment-0001.html>
More information about the calendarserver-changes
mailing list