[CalendarServer-changes] [8659] CalendarServer/branches/users/glyph/table-alias

source_changes at macosforge.org source_changes at macosforge.org
Mon Feb 13 10:03:49 PST 2012


Revision: 8659
          http://trac.macosforge.org/projects/calendarserver/changeset/8659
Author:   glyph at apple.com
Date:     2012-02-13 10:03:49 -0800 (Mon, 13 Feb 2012)
Log Message:
-----------
add a test for unique alias names

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/table-alias/

Modified: CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py	2012-02-13 18:03:46 UTC (rev 8658)
+++ CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py	2012-02-13 18:03:49 UTC (rev 8659)
@@ -370,6 +370,22 @@
         )
 
 
+    def test_multipleTableAliases(self):
+        """
+        When multiple aliases are used for the same table, they will be unique
+        within the query.
+        """
+        foo = self.schema.FOO
+        fooPrime = foo.alias()
+        fooPrimePrime = foo.alias()
+        self.assertEquals(
+            Select([fooPrime.BAR, fooPrimePrime.BAR],
+                   From=fooPrime.join(fooPrimePrime)).toSQL(),
+            SQLFragment("select alias1.BAR, alias2.BAR "
+                        "from FOO alias1 cross join FOO alias2")
+        )
+
+
     def test_columnSelection(self):
         """
         If a column is specified by the argument to L{Select}, those will be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120213/3011e31c/attachment.html>


More information about the calendarserver-changes mailing list