[CalendarServer-changes] [6777] CalendarServer/branches/users/glyph/dal/txdav/base/datastore
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jan 19 12:59:26 PST 2011
Revision: 6777
http://trac.macosforge.org/projects/calendarserver/changeset/6777
Author: glyph at apple.com
Date: 2011-01-19 12:59:26 -0800 (Wed, 19 Jan 2011)
Log Message:
-----------
Failing test for non-wildcard SELECTs.
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 20:59:16 UTC (rev 6776)
+++ CalendarServer/branches/users/glyph/dal/txdav/base/datastore/sqlsyntax.py 2011-01-19 20:59:26 UTC (rev 6777)
@@ -198,12 +198,19 @@
+class _AllColumns(object):
+ def toSQL(self, placeholder, quote):
+ return SQLStatement('*')
+
+ALL_COLUMNS = _AllColumns()
+
class Select(object):
"""
'select' statement.
"""
- def __init__(self, Where=None, From=None):
+ def __init__(self, columns=ALL_COLUMNS, Where=None, From=None):
+ self.columns = columns
self.From = From
self.Where = Where
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 20:59:16 UTC (rev 6776)
+++ CalendarServer/branches/users/glyph/dal/txdav/base/datastore/test/test_sqlsyntax.py 2011-01-19 20:59:26 UTC (rev 6777)
@@ -110,3 +110,15 @@
SQLStatement("select * from FOO join BOZ on BAR = QUX", [])
)
+
+ def test_columnSelection(self):
+ """
+ If columns are specified by the argument to L{Select}, those will be
+ output by the SQL statement rather than the all-columns wildcard.
+ """
+ self.assertEquals(
+ Select([self.schema.FOO.BAR],
+ From=self.schema.FOO),
+ SQLStatement("select BAR from FOO")
+ )
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110119/48f82f86/attachment-0001.html>
More information about the calendarserver-changes
mailing list