Commit 0267e440 authored by Vincent Pelletier's avatar Vincent Pelletier

ZSQLCatalog.SQLCatalog: Add support for scriptable keys in getColumnSearchKey.

parent 3f079e49
...@@ -1819,15 +1819,20 @@ class Catalog(Folder, ...@@ -1819,15 +1819,20 @@ class Catalog(Folder,
If both a related key and a real column are found, the related key If both a related key and a real column are found, the related key
is used. is used.
""" """
# Is key a related key or a "real" column ? # Is key a scriptable key, a related key or a "real" column ?
related_key_definition = self.getRelatedKeyDefinition(key) script = self.getScriptableKeyScript(key)
if related_key_definition is None: if script is None:
if key in self.getColumnMap(): related_key_definition = self.getRelatedKeyDefinition(key)
search_key = self.getSearchKey(key, search_key_name) if related_key_definition is None:
if key in self.getColumnMap():
search_key = self.getSearchKey(key, search_key_name)
else:
search_key = None
else: else:
search_key = None search_key = self.getSearchKey(key, 'RelatedKey')
else: else:
search_key = self.getSearchKey(key, 'RelatedKey') search_key = SearchKeyWrapperForScriptableKey(key, script)
related_key_definition = None
return search_key, related_key_definition return search_key, related_key_definition
security.declarePrivate('hasColumn') security.declarePrivate('hasColumn')
...@@ -1960,12 +1965,7 @@ class Catalog(Folder, ...@@ -1960,12 +1965,7 @@ class Catalog(Folder,
""" """
Determine the SearchKey to use to generate a Query, and call buildQueryFromSearchKey with it. Determine the SearchKey to use to generate a Query, and call buildQueryFromSearchKey with it.
""" """
script = self.getScriptableKeyScript(key) search_key, related_key_definition = self.getColumnSearchKey(key, search_key_name)
if script is None:
search_key, related_key_definition = self.getColumnSearchKey(key, search_key_name)
else:
search_key = SearchKeyWrapperForScriptableKey(key, script)
related_key_definition = None
if search_key is None: if search_key is None:
message = 'Unknown column ' + repr(key) message = 'Unknown column ' + repr(key)
if not ignore_unknown_columns: if not ignore_unknown_columns:
......
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