Commit 12b4b75f authored by Jérome Perrin's avatar Jérome Perrin

Remove implicit table mapping by passing tablename.key='' along with key='something'.

This feature broke changing page in listbox since listbox search columns are prefixed with field id.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45764 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7fa03be0
......@@ -67,15 +67,11 @@ class ComplexQuery(Query):
This value will be passed through to SQLExpression. If it is
provided, this ComplexQuery must have no subquery (regular
SQLExpression limitation)
implicit_table_list (list of strings)
Each entry in this list will be registered to column map. This is
used to make column mapper choose tables differently.
"""
self.logical_operator = kw.pop('logical_operator', kw.pop('operator', 'and')).lower()
assert self.logical_operator in ('and', 'or', 'not'), self.logical_operator
unknown_column_dict = kw.pop('unknown_column_dict', {})
self.from_expression = unknown_column_dict.pop('from_expression', None)
self.implicit_table_list = kw.pop('implicit_table_list', [])
query_list = []
append = query_list.append
extend = query_list.extend
......@@ -203,8 +199,6 @@ class ComplexQuery(Query):
@profiler_decorator
def registerColumnMap(self, sql_catalog, column_map):
for implicit_table_column in self.implicit_table_list:
column_map.registerColumn(implicit_table_column)
for query in self.query_list:
query.registerColumnMap(sql_catalog, column_map)
......
......@@ -2165,10 +2165,6 @@ class Catalog(Folder,
# buildSQLQuery level, we must store them into final ComplexQuery, which
# will handle them.
unknown_column_dict = {}
# implicit_table_list: contains all tables explicitely given as par of
# column names with empty values. This is for backward compatibility. See
# comment about empty values.
implicit_table_list = []
# empty_value_dict: contains all keys whose value causes them to be
# discarded.
empty_value_dict = {}
......@@ -2185,14 +2181,7 @@ class Catalog(Folder,
or value['query'] == ''
or (isinstance(value['query'], (list, tuple))
and len(value['query']) == 0)))):
# We have an empty value:
# - do not create a query from it
# - if key has a dot, add its left part to the list of "hint" tables
# This is for backward compatibility, when giving a mapped column
# with an empty value caused a join with catalog to appear in
# resulting where-expression)
if '.' in key:
implicit_table_list.append(key)
# We have an empty value, do not create a query from it
empty_value_dict[key] = value
else:
script = self.getScriptableKeyScript(key)
......@@ -2235,7 +2224,8 @@ class Catalog(Folder,
LOG('SQLCatalog', WARNING, 'Discarding columns with empty values: %r' % (empty_value_dict, ))
if len(unknown_column_dict):
LOG('SQLCatalog', WARNING, 'Unknown columns %r, skipped.' % (unknown_column_dict.keys(), ))
return ComplexQuery(query_list, logical_operator=operator, unknown_column_dict=unknown_column_dict, implicit_table_list=implicit_table_list)
return ComplexQuery(query_list, logical_operator=operator,
unknown_column_dict=unknown_column_dict)
@profiler_decorator
def buildOrderByList(self, sort_on=None, sort_order=None, order_by_expression=None):
......
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