Commit ab0f9b4e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

remove 'DISTINCT ' etc. in ColumnMap.registerColumn().


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25749 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c273279f
...@@ -3808,6 +3808,14 @@ VALUES ...@@ -3808,6 +3808,14 @@ VALUES
delattr(portal, 'foo') delattr(portal, 'foo')
delattr(portal, 'bar') delattr(portal, 'bar')
def test_distinct_select_expression(self, quiet=quiet, run=run_all_test):
if not run: return
portal_catalog = self.getCatalogTool()
res = portal_catalog.searchResults(
select_expression='count(DISTINCT catalog.reference) AS count_reference',
)
self.assertEquals(1, len(res))
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Catalog)) suite.addTest(unittest.makeSuite(TestERP5Catalog))
......
...@@ -98,6 +98,8 @@ class ColumnMap(object): ...@@ -98,6 +98,8 @@ class ColumnMap(object):
else: else:
function = None function = None
column = raw_column column = raw_column
# Remove 'DISTINCT ' etc. from column.
column = column.split()[-1]
# Remove '`' from column. # Remove '`' from column.
column = column.replace('`', '') column = column.replace('`', '')
# Extract table name from column, if any. # Extract table name from column, if any.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment