From c84e16cb27a20fd7d0b554a06813480ce732b49a Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Fri, 17 Nov 2006 14:16:15 +0000 Subject: [PATCH] add a zsql method in order to immediatly update the catalog when we delete an object git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11353 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_mysql/z_delete_uid.catalog_keys.xml | 5 + .../erp5_mysql/z_delete_uid.xml | 167 ++++++++++++++++++ .../Base_zSearchRelatedObjectsByCategory.xml | 8 +- product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- .../bt/template_catalog_method_id_list | 1 + 5 files changed, 179 insertions(+), 4 deletions(-) create mode 100644 product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.catalog_keys.xml create mode 100644 product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.xml diff --git a/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.catalog_keys.xml b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.catalog_keys.xml new file mode 100644 index 0000000000..52ab2ff1f9 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.catalog_keys.xml @@ -0,0 +1,5 @@ +<catalog_method> + <item key="sql_catalog_delete_uid" type="int"> + <value>1</value> + </item> +</catalog_method> \ No newline at end of file diff --git a/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.xml b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.xml new file mode 100644 index 0000000000..b68b712b2b --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_delete_uid.xml @@ -0,0 +1,167 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.ZSQLMethods.SQL</string> + <string>SQL</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_arg</string> </key> + <value> + <object> + <klass> + <global name="Args" module="Shared.DC.ZRDB.Aqueduct"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_data</string> </key> + <value> + <dictionary> + <item> + <key> <string>uid</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>_keys</string> </key> + <value> + <list> +<string>uid</string> + </list> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>allow_simple_one_argument_traversal</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>arguments_src</string> </key> + <value> <string>uid</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> + <none/> + </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_delete_uid</string> </value> + </item> + <item> + <key> <string>max_cache_</string> </key> + <value> <int>0</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[ + +REPLACE INTO\n + catalog (uid, path,relative_url,security_uid,portal_type,parent_uid)\n +VALUES\n + (<dtml-sqlvar uid type="int">, \'deleted\',\'\',NULL,\'\',NULL)\n + + +]]></string> </value> + </item> + <item> + <key> <string>template</string> </key> + <value> + <object> + <klass> + <global name="SQL" module="Shared.DC.ZRDB.DA"/> + </klass> + <none/> + <state> + <dictionary> + <item> + <key> <string>__name__</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<string> + +]]></string> </value> + </item> + <item> + <key> <string>_vars</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>globals</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>raw</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +REPLACE INTO\n + catalog (uid, path,relative_url,security_uid,portal_type,parent_uid)\n +VALUES\n + (<dtml-sqlvar uid type="int">, \'deleted\',\'\',NULL,\'\',NULL)\n + + +]]></string> </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_zSearchRelatedObjectsByCategory.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_zSearchRelatedObjectsByCategory.xml index 462aad0fae..e791c65b5d 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_zSearchRelatedObjectsByCategory.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_zSearchRelatedObjectsByCategory.xml @@ -45,7 +45,7 @@ <key> <string>_keys</string> </key> <value> <list> - <string>category_uid</string> +<string>category_uid</string> </list> </value> </item> @@ -107,7 +107,8 @@ SELECT DISTINCT\n FROM\n catalog, category\n WHERE\n - catalog.uid = category.uid\n + catalog.path != \'deleted\'\n +AND catalog.uid = category.uid\n AND category.category_uid = <dtml-sqlvar category_uid type="int"> ]]></string> </value> @@ -151,7 +152,8 @@ SELECT DISTINCT\n FROM\n catalog, category\n WHERE\n - catalog.uid = category.uid\n + catalog.path != \'deleted\'\n +AND catalog.uid = category.uid\n AND category.category_uid = <dtml-sqlvar category_uid type="int"> ]]></string> </value> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index cd004727f2..4be28fd89c 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -182 \ No newline at end of file +194 \ No newline at end of file diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list b/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list index b3fda2adaf..4b79ff736b 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list +++ b/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list @@ -56,6 +56,7 @@ erp5_mysql/z_create_subject erp5_mysql/z_create_translation erp5_mysql/z_delete_recorded_object_list erp5_mysql/z_delete_translation_list +erp5_mysql/z_delete_uid erp5_mysql/z_getitem_by_path erp5_mysql/z_getitem_by_uid erp5_mysql/z_portal_ids_commit -- 2.30.9