Commit a97a2903 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Kazuhiko Shiozaki

WIP getCatalogEngine

parent 77ed8ea8
......@@ -894,6 +894,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
strict_string = 'strict_'
related_string = 'related_'
column_map = self.getSQLCatalog(sql_catalog_id).getColumnMap()
#if key_list == ["destination_title"]:
# import ipdb
# ipdb.set_trace()
for key in key_list:
prefix = ''
strict = 0
......
......@@ -266,6 +266,8 @@ class DB(TM):
def columns(self, table_name):
"""Returns a list of column descriptions for 'table_name'."""
import ipdb
ipdb.set_trace()
try:
c = self._query('SHOW COLUMNS FROM %s' % table_name)
except Exception:
......
......@@ -92,6 +92,8 @@ except ImportError:
def getTransactionalVariable():
return {}
show_table_engine_re = re.compile(r'^\)\sENGINE=(\S+)', re.MULTILINE)
def getInstanceID(instance):
# XXX: getPhysicalPath is overkill for a unique cache identifier.
# What I would like to use instead of it is:
......@@ -484,11 +486,6 @@ class Catalog(Folder,
'type' : 'selection',
'select_variable' : 'getCatalogMethodIds',
'mode' : 'w' },
{ 'id' : 'sql_catalog_table_description',
'description' : 'Method to get the main catalog table creation description',
'type' : 'selection',
'select_variable' : 'getCatalogMethodIds',
'mode' : 'w' },
{ 'id' : 'sql_catalog_schema',
'description' : 'Method to get the main catalog schema',
'type' : 'selection',
......@@ -1064,6 +1061,8 @@ class Catalog(Folder,
return self.sql_search_result_keys
def _getCatalogSchema(self, table=None):
#import ipdb
#ipdb.set_trace()
result_list = []
try:
method_name = self.sql_catalog_schema
......@@ -1078,6 +1077,22 @@ class Catalog(Folder,
pass
return tuple(result_list)
def _getSQLCatalogEngine(self, table=None):
"""
"""
result = ""
try:
method_name = self.sql_catalog_table_description
method = getattr(self, method_name)
search_result = method(table=table)
result = show_table_engine_re.search(getattr(search_result[0], "CREATE TABLE")).group(1)
except ConflictError:
raise
except:
LOG('SQLCatalog', WARNING, '_getCatalogEngine failed with the method %s' % method_name, error=sys.exc_info())
pass
return result
@caching_instance_method(id='SQLCatalog.getColumnIds',
cache_factory='erp5_content_long',
cache_id_generator=generateCatalogCacheId,
......@@ -1099,6 +1114,8 @@ class Catalog(Folder,
return sorted(keys)
def getColumnIds(self):
#import ipdb
#ipdb.set_trace()
"""
Calls the show column method and returns dictionnary of
Field Ids
......@@ -2436,6 +2453,8 @@ class Catalog(Folder,
if column in result:
LOG('SQLCatalog', WARNING, 'Ambiguous configuration: column %r is set to use %r key, but also to use %r key. Former takes precedence.' % (column, result[column], key))
else:
# if column in ("title", "description") and key == "FullTextKey":
# if mroonga: key = "MroongaFullTextKey"
result[column] = key
for line in self.sql_catalog_search_keys:
try:
......
......@@ -93,6 +93,7 @@ class FullTextKey(SearchKey):
append(SimpleQuery(search_key=self,
comparison_operator=comparison_operator,
group=group, **{column: ' '.join(value_list)}))
#raise RuntimeError("XXX Tristan FullTextKey.py 1")
return query_list
verifyClass(ISearchKey, FullTextKey)
......
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