Commit ee7c10dd authored by Sebastien Robin's avatar Sebastien Robin

allow to give query strings with ComplexQuery instead of only Query instances


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14079 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 29979ca7
......@@ -440,6 +440,7 @@ class ComplexQuery(QueryMixin):
def getRelatedTableMapDict(self):
result = {}
for query in self.getQueryList():
if not(isinstance(query, basestring)):
result.update(query.getRelatedTableMapDict())
return result
......@@ -454,6 +455,9 @@ class ComplexQuery(QueryMixin):
sql_expression_list = []
select_expression_list = []
for query in self.getQueryList():
if isinstance(query, basestring):
sql_expression_list.append(query)
else:
query_result = query.asSQLExpression( key_alias_dict=key_alias_dict,
ignore_empty_string=ignore_empty_string,
keyword_search_keys=keyword_search_keys,
......@@ -463,7 +467,7 @@ class ComplexQuery(QueryMixin):
select_expression_list.extend(query_result['select_expression_list'])
operator = self.getOperator()
result = {'where_expression':('(%s)' % \
(' %s ' % operator).join(sql_expression_list)),
(' %s ' % operator).join(['(%s)' % x for x in sql_expression_list])),
'select_expression_list':select_expression_list}
return result
......@@ -474,6 +478,7 @@ class ComplexQuery(QueryMixin):
"""
key_list=[]
for query in self.getQueryList():
if not(isinstance(query, basestring)):
key_list.extend(query.getSQLKeyList())
return key_list
......
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