diff --git a/product/ERP5/Tool/DomainTool.py b/product/ERP5/Tool/DomainTool.py index b5134f7a8c895a80f5e1d77ee1221fb3857d661f..8c53310e557a7fdb2a06eb1937a6a5fab57eab2d 100644 --- a/product/ERP5/Tool/DomainTool.py +++ b/product/ERP5/Tool/DomainTool.py @@ -112,9 +112,7 @@ class DomainTool(BaseTool): if x.startswith('predicate.')] expression_list = [] checked_column_list = [] - # XXX-Leo: Please remove implicit_join below, while making sure - # testDomainTool.py still passes - sql_kw = dict(implicit_join=True) + sql_kw = {} query_list = [] if query is not None: query_list = [query] diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index 213a2a05f560a80623310314a1d755e0b7c30912..5bcfed58c567e3ef2e7401b211f0a3b58639a214 100644 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -562,9 +562,6 @@ class SimulationTool(BaseTool): new_kw.pop('ignore_group_by', None) new_kw.pop('movement_list_mode', None) - # block use of explicit join - new_kw['implicit_join'] = True - sql_kw.update(ctool.buildSQLQuery(**new_kw)) return sql_kw @@ -801,8 +798,7 @@ class SimulationTool(BaseTool): where_expression = self.getPortalObject().portal_categories\ .buildSQLSelector( category_list = variation_category, - query_table = 'predicate_category', - implicit_join=True) + query_table = 'predicate_category') if where_expression != '': add_kw['where_expression'] = where_expression add_kw['predicate_category.uid'] = '!=NULL' @@ -1312,7 +1308,6 @@ class SimulationTool(BaseTool): 'range': column_value_dict.get('date', {}).get('range', []) }, 'query_table': None, - 'implicit_join': True, }) if date_query_result['where_expression'] not in ('',None): where_expression = date_query_result['where_expression'] @@ -1399,8 +1394,8 @@ class SimulationTool(BaseTool): assert len(equal_date_query_list) == \ len(greater_than_date_query_list) assert len(equal_date_query_list) > 0 - equal_date_query = buildSQLQuery(query=ComplexQuery(operator='OR', *equal_date_query_list), query_table=None, implicit_join=True)['where_expression'] - greater_than_date_query = buildSQLQuery(query=ComplexQuery(operator='OR', *greater_than_date_query_list), query_table=None, implicit_join=True)['where_expression'] + equal_date_query = buildSQLQuery(query=ComplexQuery(operator='OR', *equal_date_query_list), query_table=None)['where_expression'] + greater_than_date_query = buildSQLQuery(query=ComplexQuery(operator='OR', *greater_than_date_query_list), query_table=None)['where_expression'] inventory_stock_sql_kw = \ self._generateSQLKeywordDictFromKeywordDict( table=EQUAL_DATE_TABLE_ID, sql_kw=sql_kw, new_kw=new_kw) diff --git a/product/ZSQLCatalog/SearchKey/RelatedKey.py b/product/ZSQLCatalog/SearchKey/RelatedKey.py index cf6ed5ff3983610fcdbb929783a43c4a3f61f2f2..c91e89820ffb5e0bfc2dc3e797135e55d04a39a0 100644 --- a/product/ZSQLCatalog/SearchKey/RelatedKey.py +++ b/product/ZSQLCatalog/SearchKey/RelatedKey.py @@ -53,6 +53,10 @@ RELATED_QUERY_SEPARATOR. \n\ Offending related key: %r, for column %r, table_alias_list: %r, \ rendered_related_key: \n%s" +RELATED_KEY_ALIASED_MESSAGE = "\ +Support for explicit joins of aliased related keys is not yet implemented. \ +Offending related key: %r, for column %r, table_alias_list: %r" + class RelatedKey(SearchKey): """ This SearchKey handles searches on virtual columns of RelatedKey type. @@ -128,13 +132,23 @@ class RelatedKey(SearchKey): def registerColumnMap(self, column_map, table_alias_list=None): related_column = self.getColumn() group = column_map.registerRelatedKey(related_column, self.real_column) - # Each table except last one must be registered to their own group, so that - # the same table can be used multiple time (and aliased multiple times) - # in the same related key. The last one must be register to the related key - # "main" group (ie, the value of the "group" variable) to be the same as - # the table used in join_condition. + # Each table except last one must be registered to their own + # group, so that the same table can be used multiple times (and + # aliased multiple times) in the same related key. The last one + # must be registered to the related key "main" group (ie, the + # value of the "group" variable) to be the same as the table used + # in join_condition. if table_alias_list is not None: assert len(self.table_list) == len(table_alias_list) + # XXX-Leo: remove the rest of this 'if' branch after making sure + # that ColumnMap.addRelatedKeyJoin() can handle collapsing + # chains of inner-joins that are subsets of one another based on + # having the same aliases: + msg = RELATED_KEY_ALIASED_MESSAGE % (self.related_key_id, + self.column, + table_alias_list,) + log.warning(msg + "\n\nForcing implicit join...") + column_map.implicit_join = True for table_position in xrange(len(self.table_list) - 1): table_name = self.table_list[table_position] local_group = column_map.registerRelatedKeyColumn(related_column, table_position, group)