Commit 069c122e authored by Aurel's avatar Aurel

implement a new table that will index data by gid

parent 764a0d97
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Utils import UpperCase\n
from ZODB.POSException import ConflictError\n
\n
method = context.z_catalog_syncml_signature_list\n
property_list = method.arguments_src.split()\n
parameter_dict = {}\n
failed_path_list = []\n
restrictedTraverse = context.getPortalObject().restrictedTraverse\n
subscription = restrictedTraverse(subscription_path)\n
for path in path_list:\n
obj = restrictedTraverse(path, None)\n
try:\n
tmp_dict = {}\n
for property in property_list:\n
if property == "validation_state":\n
try:\n
value = getattr(obj, \'get%s\' % UpperCase(property))()\n
except AttributeError:\n
# Data from source has no state\n
value = ""\n
elif property == "gid" and subscription_path: \n
# Call specific method to compute GID on source data\n
value = subscription.getGidFromObject(obj)\n
elif property == "gid":\n
# Signature GID is defined as its ID\n
value = getattr(obj, \'getId\')()\n
else:\n
value = getattr(obj, \'get%s\' % UpperCase(property))()\n
tmp_dict[property] = value\n
except ConflictError:\n
raise\n
except Exception, e:\n
raise\n
exception = e\n
failed_path_list.append(path)\n
else:\n
for property, value in tmp_dict.items():\n
parameter_dict.setdefault(property, []).append(value)\n
\n
if len(failed_path_list):\n
if len(parameter_dict):\n
# reregister activity for failed objects only\n
activate_kw.update(activity=\'SQLQueue\', priority=5)\n
context.activate(**activate_kw).SQLCatalog_indexSyncMLSignatureList(path_list=failed_path_list)\n
else:\n
# if all objects are failed one, just raise an exception to avoid infinite loop.\n
raise AttributeError, \'exception %r raised in indexing %r\' % (exception, failed_path_list)\n
\n
if parameter_dict:\n
return method(**parameter_dict)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>path_list, subscription_path=None, activate_kw=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SQLCatalog_indexSyncMLSignatureList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>gid\r\n
path\r\n
validation_state\r\n
</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_catalog_syncml_signature_list</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
DELETE FROM\n
syncml\n
WHERE\n
<dtml-in path>\n
path=<dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>\n
;\n
<dtml-var "\'\\0\'">\n
INSERT INTO\n
syncml\n
VALUES\n
<dtml-in prefix="loop" expr="_.range(_.len(path))">\n
(\n
<dtml-sqlvar expr="gid[loop_item]" type="string">,\n
<dtml-sqlvar expr="path[loop_item]" type="string">,\n
<dtml-sqlvar expr="validation_state[loop_item]" type="string">\n
)<dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_col</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_create_syncml</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string>CREATE TABLE `syncml` (\n
`gid` varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\',\n
`path` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT \'\',\n
`validation_state` varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\',\n
PRIMARY KEY (`path`),\n
KEY `gid` (`gid`,`path`)\n
)\n
</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>min_gid\r\n
max_gid\r\n
path\r\n
first_call\r\n
last_call\r\n
</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_get_signature</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
SELECT \n
gid\n
FROM syncml\n
WHERE\n
path like <dtml-sqlvar path type="string">\n
<dtml-if first_call>\n
/* Do nothing here */\n
<dtml-else>\n
AND gid >= <dtml-sqlvar min_gid type="string">\n
</dtml-if>\n
<dtml-if last_call>\n
/* Do nothing here */\n
<dtml-else>\n
AND gid <= <dtml-sqlvar max_gid type="string">\n
</dtml-if>\n
ORDER BY gid\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>path\r\n
limit</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_get_syncml_data</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
SELECT \n
gid\n
FROM syncml\n
WHERE\n
path like <dtml-sqlvar path type="string">\n
ORDER BY gid\n
<dtml-if limit>\n
LIMIT <dtml-var limit>\n
</dtml-if>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>gid_list\r\n
path</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_get_syncml_path</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
SELECT path \n
FROM syncml\n
WHERE\n
gid in (<dtml-in gid_list><dtml-sqlvar sequence-item type="string">\n
<dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>)\n
AND\n
path like <dtml-sqlvar path type="string">
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>cmf_activity_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_unindex_data</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
DELETE FROM syncml\n
WHERE\n
path like <dtml-sqlvar path type="string">
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
91
\ No newline at end of file
92
\ No newline at end of file
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