Commit 38053180 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Add Sql compatible method aliases to ease upgrade (SQL is now the standard).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12062 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3df19891
...@@ -1632,6 +1632,9 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1632,6 +1632,9 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
full_list = list(dynamic_list) + list(self.sql_catalog_related_keys) full_list = list(dynamic_list) + list(self.sql_catalog_related_keys)
return full_list return full_list
# Compatibililty SQL Sql
getSqlCatalogRelatedKeyList = getSQLCatalogRelatedKeyList
def buildSQLQuery(self, query_table='catalog', REQUEST=None, def buildSQLQuery(self, query_table='catalog', REQUEST=None,
ignore_empty_string=1, query=None,stat__=0,**kw): ignore_empty_string=1, query=None,stat__=0,**kw):
""" Builds a complex SQL query to simulate ZCalatog behaviour """ """ Builds a complex SQL query to simulate ZCalatog behaviour """
...@@ -1860,7 +1863,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1860,7 +1863,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
elif len(sort) == 3: elif len(sort) == 3:
new_sort_index.append(sort) new_sort_index.append(sort)
sort_index = new_sort_index sort_index = new_sort_index
try: try:
new_sort_index = [] new_sort_index = []
for (key , so, as_type) in sort_index: for (key , so, as_type) in sort_index:
...@@ -1897,7 +1900,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1897,7 +1900,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
if query_result['where_expression'] not in ('',None): if query_result['where_expression'] not in ('',None):
where_expression_list.append(query_result['where_expression']) where_expression_list.append(query_result['where_expression'])
select_expression_list.extend(query_result['select_expression_list']) select_expression_list.extend(query_result['select_expression_list'])
# Calculate extra where_expression based on required joins # Calculate extra where_expression based on required joins
for k, tid in from_table_dict.items(): for k, tid in from_table_dict.items():
if k != query_table: if k != query_table:
...@@ -1936,6 +1939,9 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1936,6 +1939,9 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
'select_expression': select_expression, 'select_expression': select_expression,
'group_by_expression' : group_by_expression} 'group_by_expression' : group_by_expression}
# Compatibililty SQL Sql
buildSqlQuery = buildSQLQuery
def queryResults(self, sql_method, REQUEST=None, used=None, src__=0, build_sql_query_method=None, **kw): def queryResults(self, sql_method, REQUEST=None, used=None, src__=0, build_sql_query_method=None, **kw):
""" Returns a list of brains from a set of constraints on variables """ """ Returns a list of brains from a set of constraints on variables """
if build_sql_query_method is None: if build_sql_query_method is None:
...@@ -1952,7 +1958,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1952,7 +1958,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
#LOG('acceptable_keys',0,'acceptable_keys: %s' % str(acceptable_keys)) #LOG('acceptable_keys',0,'acceptable_keys: %s' % str(acceptable_keys))
#LOG('acceptable_key_map',0,'acceptable_key_map: %s' % str(acceptable_key_map)) #LOG('acceptable_key_map',0,'acceptable_key_map: %s' % str(acceptable_key_map))
#LOG('queryResults',0,'kw: %s' % str(kw)) #LOG('queryResults',0,'kw: %s' % str(kw))
#LOG('queryResults',0,'from_table_list: %s' % str(from_table_dict.keys())) #LOG('queryResults',0,'from_table_list: %s' % str(query['from_table_list']))
return sql_method(src__=src__, **kw) return sql_method(src__=src__, **kw)
def searchResults(self, REQUEST=None, used=None, **kw): def searchResults(self, REQUEST=None, used=None, **kw):
......
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