Commit d966bf52 authored by Vincent Pelletier's avatar Vincent Pelletier

Provide a way to replace table alias ("AS" inclued) by an arbitrary string....

Provide a way to replace table alias ("AS" inclued) by an arbitrary string. Given value must be a dictionary, with impacted table as a key and the arbitrary string as a value.
This allows, for example, to generate queries with LEFT JOINs.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22153 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 28bba303
......@@ -2114,7 +2114,12 @@ class Catalog(Folder,
from_table_dict[table_with_index] = table
# Use a dictionary at the moment.
from_expression = kw.get('from_expression', {})
final_from_expression = ', '.join(
[from_expression.get(table, '`%s` AS `%s`' % (table, alias))
for table, alias in from_table_dict.iteritems()])
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 +2137,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['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