Commit 3bf252f4 authored by Vincent Pelletier's avatar Vincent Pelletier

Commit again r22153 with fixes:

  Do not generate a from_expression if no from_expression was passed by parameter.
  Fix a swap between table and alias in new code.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22162 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc10bdc6
......@@ -2113,8 +2113,16 @@ class Catalog(Folder,
table_with_index = "%s use index(%s)" %(related_table, index_list_string)
from_table_dict[table_with_index] = table
from_expression = kw.get('from_expression', None)
if from_expression is not None:
final_from_expression = ', '.join(
[from_expression.get(table, '`%s` AS `%s`' % (table, alias))
for alias, table in from_table_dict.iteritems()])
else:
final_from_expression = None
# Use a dictionary at the moment.
return { 'from_table_list' : from_table_dict.items(),
'from_expression' : final_from_expression,
'order_by_expression' : sort_on,
'where_expression' : where_expression,
'limit_expression' : limit_expression,
......@@ -2132,6 +2140,7 @@ class Catalog(Folder,
kw['where_expression'] = query['where_expression']
kw['sort_on'] = query['order_by_expression']
kw['from_table_list'] = query['from_table_list']
kw['from_expression'] = query.get('from_expression')
kw['limit_expression'] = query['limit_expression']
kw['select_expression'] = query['select_expression']
kw['group_by_expression'] = query['group_by_expression']
......
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