[CalendarServer-changes] [7354] CalendarServer/trunk/twext/enterprise/dal
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 22 03:34:23 PDT 2011
Revision: 7354
http://trac.macosforge.org/projects/calendarserver/changeset/7354
Author: glyph at apple.com
Date: 2011-04-22 03:34:21 -0700 (Fri, 22 Apr 2011)
Log Message:
-----------
bugfix for 'select *' behavior
Modified Paths:
--------------
CalendarServer/trunk/twext/enterprise/dal/syntax.py
CalendarServer/trunk/twext/enterprise/dal/test/test_sqlsyntax.py
Modified: CalendarServer/trunk/twext/enterprise/dal/syntax.py
===================================================================
--- CalendarServer/trunk/twext/enterprise/dal/syntax.py 2011-04-22 02:00:30 UTC (rev 7353)
+++ CalendarServer/trunk/twext/enterprise/dal/syntax.py 2011-04-22 10:34:21 UTC (rev 7354)
@@ -708,7 +708,6 @@
-
class Select(_Statement):
"""
'select' statement.
@@ -810,8 +809,22 @@
def _resultColumns(self):
- # FIXME: ALL_COLUMNS
- return self.columns.columns
+ """
+ Determine the list of L{ColumnSyntax} objects that will represent the
+ result. Normally just the list of selected columns; if wildcard syntax
+ is used though, determine the ordering from the database.
+ """
+ if self.columns is ALL_COLUMNS:
+ # TODO: Possibly this rewriting should always be done, before even
+ # executing the query, so that if we develop a schema mismatch with
+ # the database (additional columns), the application will still see
+ # the right rows.
+ for table in self.From.tables():
+ for column in table:
+ yield column
+ else:
+ for column in self.columns.columns:
+ yield column
def _commaJoined(stmts):
Modified: CalendarServer/trunk/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/trunk/twext/enterprise/dal/test/test_sqlsyntax.py 2011-04-22 02:00:30 UTC (rev 7353)
+++ CalendarServer/trunk/twext/enterprise/dal/test/test_sqlsyntax.py 2011-04-22 10:34:21 UTC (rev 7354)
@@ -878,10 +878,22 @@
self.assertEquals(rows, [['', None]])
+ def test_rewriteOracleNULLs_SelectAllColumns(self):
+ """
+ Same as L{test_rewriteOracleNULLs_Select}, but with the L{ALL_COLUMNS}
+ shortcut.
+ """
+ rows = resultOf(
+ Select(From=self.schema.NULLCHECK).on(NullTestingOracleTxn())
+ )[0]
+ self.assertEquals(rows, [['', None]])
+
+
def test_rewriteOracleNULLs_Insert(self):
"""
- The behavior described in the previous test applies to other statement
- types as well, specifically those with 'returning' clauses.
+ The behavior described in L{test_rewriteOracleNULLs_Select} applies to
+ other statement types as well, specifically those with 'returning'
+ clauses.
"""
conn, pool, factory = self.simulateOracleConnection()
# Add 2 cursor variable values so that these will be used by
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110422/d30e683f/attachment-0001.html>
More information about the calendarserver-changes
mailing list