Commit ca4cd04a authored by Yoshinori Okuji's avatar Yoshinori Okuji

Table optimization. This removes several columns, in particular

from catalog and movement. So it might be necessary to write
related keys.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3695 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 08c9a9cd
......@@ -4,6 +4,8 @@ connection_id:erp5_sql_connection
max_rows:1
max_cache:0
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>count:int
thread_id
......
......@@ -4,16 +4,18 @@ connection_id:erp5_sql_connection
max_rows:0
max_cache:0
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>count:int
instance_id</params>
INSERT INTO
catalog (id, path, CreationDate)
catalog (id, path)
VALUES
<dtml-in "_.range(count - 1)">
( <dtml-sqlvar instance_id type="string"> , 'reserved', NOW() ) ,
( <dtml-sqlvar instance_id type="string"> , 'reserved' ) ,
</dtml-in>
( <dtml-sqlvar instance_id type="string"> , 'reserved', NOW() );
( <dtml-sqlvar instance_id type="string"> , 'reserved' );
<dtml-var "'\0'">
......
......@@ -4,9 +4,11 @@ connection_id:erp5_sql_connection
max_rows:0
max_cache:0
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>uid:int</params>
INSERT INTO
catalog (uid, id, path, CreationDate)
catalog (uid, id, path)
VALUES
( <dtml-sqlvar uid type="int">, 'dummy', 'reserved', NOW() )
( <dtml-sqlvar uid type="int">, 'dummy', 'reserved' )
......@@ -6,47 +6,39 @@
<property id="sql_catalog_reserve_uid" type="str">z_reserve_uid</property>
<property id="sql_catalog_object" type="tuple">
<item type="str">z_catalog_category</item>
<item type="str">z_catalog_compatibility</item>
<item type="str">z_catalog_item</item>
<item type="str">z_catalog_movement</item>
<item type="str">z_catalog_predicate</item>
<item type="str">z_catalog_predicate_category</item>
<item type="str">z_catalog_roles_and_users</item>
<item type="str">z_catalog_stock</item>
<item type="str">z_catalog_subject</item>
<item type="str">z_update_delivery</item>
<item type="str">z_update_object</item>
</property>
<property id="sql_uncatalog_object" type="tuple">
<item type="str">z0_uncatalog_category</item>
<item type="str">z0_uncatalog_compatibility</item>
<item type="str">z0_uncatalog_item</item>
<item type="str">z0_uncatalog_movement</item>
<item type="str">z0_uncatalog_predicate</item>
<item type="str">z0_uncatalog_predicate_category</item>
<item type="str">z0_uncatalog_stock</item>
<item type="str">z0_uncatalog_subject</item>
<item type="str">z_uncatalog_delivery</item>
<item type="str">z_uncatalog_object</item>
</property>
<property id="sql_update_object" type="tuple">
<item type="str">z0_uncatalog_category</item>
<item type="str">z0_uncatalog_compatibility</item>
<item type="str">z0_uncatalog_item</item>
<item type="str">z0_uncatalog_movement</item>
<item type="str">z0_uncatalog_predicate</item>
<item type="str">z0_uncatalog_predicate_category</item>
<item type="str">z0_uncatalog_stock</item>
<item type="str">z0_uncatalog_subject</item>
<item type="str">z_catalog_category</item>
<item type="str">z_catalog_compatibility</item>
<item type="str">z_catalog_item</item>
<item type="str">z_catalog_movement</item>
<item type="str">z_catalog_predicate</item>
<item type="str">z_catalog_predicate_category</item>
<item type="str">z_catalog_roles_and_users</item>
<item type="str">z_catalog_stock</item>
<item type="str">z_catalog_subject</item>
<item type="str">z_update_delivery</item>
<item type="str">z_update_object</item>
</property>
......@@ -77,14 +69,16 @@
<item type="str">z_create_subject</item>
</property>
<property id="sql_catalog_object_list" type="tuple">
<item type="str">z_catalog_category_list</item>
<item type="str">z_catalog_compatibility_list</item>
<item type="str">z_catalog_delivery_list</item>
<item type="str">z_catalog_item_list</item>
<item type="str">z_catalog_movement_category_list</item>
<item type="str">z_catalog_movement_list</item>
<item type="str">z_catalog_non_movement_category_list</item>
<item type="str">z_catalog_object_list</item>
<item type="str">z_catalog_predicate_category_list</item>
<item type="str">z_catalog_predicate_list</item>
<item type="str">z_catalog_roles_and_users_list</item>
<item type="str">z_catalog_stock_list</item>
<item type="str">z_catalog_subject_list</item>
</property>
<property id="sql_record_catalog_object" type="str">z_record_catalog_object</property>
<property id="sql_record_uncatalog_object" type="str">z_record_uncatalog_object</property>
......@@ -94,7 +88,6 @@
<property id="sql_search_tables" type="tuple">
<item type="str">catalog</item>
<item type="str">category</item>
<item type="str">compatibility</item>
<item type="str">delivery</item>
<item type="str">movement</item>
<item type="str">predicate</item>
......@@ -120,8 +113,6 @@
<item type="str">title</item>
</property>
<property id="sql_catalog_full_text_search_keys" type="tuple">
<item type="str">SearchableText</item>
<item type="str">compatibility.SearchableText</item>
</property>
<property id="sql_catalog_request_keys" type="tuple">
</property>
......@@ -140,5 +131,14 @@
<item type="str">stock_mirrorSectionCategory | category/category_uid/z_related_mirror_section_uid_from_stock</item>
<item type="str">variationCategory | category/category_uid/z_related_uid</item>
<item type="str">predicate_uid | predicate/uid/z_related_predicate</item>
<item type="str">base_category_id | category,catalog/id/z_related_base_category_id</item>
</property>
<filter id="z_catalog_movement_category_list" expression="python: isMovement" />
<filter id="z_catalog_item_list" expression="python: isMovement" />
<filter id="z_catalog_predicate_category_list" expression="python: isPredicate" />
<filter id="z_catalog_movement_list" expression="python: isMovement" />
<filter id="z_catalog_predicate_list" expression="python: isPredicate" />
<filter id="z_catalog_stock_list" expression="python: isMovement" />
<filter id="z_catalog_delivery_list" expression="python: isDelivery" />
<filter id="z_catalog_non_movement_category_list" expression="python: not isMovement" />
</SQLCatalogData>
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params></params>
DROP TABLE delivery
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params></params>
DROP TABLE item
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params>uid</params>
DELETE FROM item WHERE <dtml-sqltest uid op=eq type=int>
......@@ -11,6 +11,16 @@ class_file:
isMovement
getCategoryList
getAcquiredCategoryList</params>
DELETE FROM
category
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
INSERT INTO category VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if sequence-start><dtml-else>,</dtml-if>
......
......@@ -12,6 +12,7 @@ Creator
Date
PrincipiaSearchSource
SearchableText
CreationDate
EffectiveDate
ExpiresDate
ModificationDate
......@@ -32,6 +33,7 @@ INSERT INTO compatibility VALUES (
<dtml-sqlvar Date type="datetime" optional>,
<dtml-sqlvar PrincipiaSearchSource type="string" optional>,
<dtml-sqlvar SearchableText type="string" optional>,
<dtml-sqlvar CreationDate type="datetime" optional>,
<dtml-sqlvar EffectiveDate type="datetime" optional>,
<dtml-sqlvar ExpiresDate type="datetime" optional>,
<dtml-sqlvar ModificationDate type="datetime" optional>,
......
......@@ -12,6 +12,7 @@ Creator
Date
PrincipiaSearchSource
SearchableText
CreationDate
EffectiveDate
ExpiresDate
ModificationDate
......@@ -26,6 +27,16 @@ modified
review_state
summary
</params>
DELETE FROM
compatibility
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
INSERT INTO
compatibility
VALUES
......@@ -36,6 +47,7 @@ VALUES
<dtml-sqlvar expr="Date[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="PrincipiaSearchSource[loop_item]" type="string" optional>,
<dtml-sqlvar expr="SearchableText[loop_item]" type="string" optional>,
<dtml-sqlvar expr="CreationDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="EffectiveDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="ExpiresDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="ModificationDate[loop_item]" type="datetime" optional>,
......
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>isDelivery
uid
getSourceUid
getDestinationUid
getSourceSectionUid
getDestinationSectionUid
getResourceUid
getStartDate
getStartDateRangeMin
getStartDateRangeMax
getStopDate
getStopDateRangeMin
getStopDateRangeMax</params>
DELETE FROM
delivery
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
<dtml-let delivery_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if "isDelivery[loop_item]">
<dtml-call expr="delivery_list.append(loop_item)">
</dtml-if>
</dtml-in>
<dtml-if expr="_.len(delivery_list) > 0">
INSERT INTO
delivery
VALUES
<dtml-in prefix="loop" expr="delivery_list">
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
<dtml-sqlvar getSourceUid[loop_item] type="int" optional>,
<dtml-sqlvar getDestinationUid[loop_item] type="int" optional>,
<dtml-sqlvar getSourceSectionUid[loop_item] type="int" optional>,
<dtml-sqlvar getDestinationSectionUid[loop_item] type="int" optional>,
<dtml-sqlvar getResourceUid[loop_item] type="int" optional>,
<dtml-sqlvar getStartDate[loop_item] type="datetime" optional>,
<dtml-sqlvar getStartDateRangeMin[loop_item] type="datetime" optional>,
<dtml-sqlvar getStartDateRangeMax[loop_item] type="datetime" optional>,
<dtml-sqlvar getStopDate[loop_item] type="datetime" optional>,
<dtml-sqlvar getStopDateRangeMin[loop_item] type="datetime" optional>,
<dtml-sqlvar getStopDateRangeMax[loop_item] type="datetime" optional>
)
<dtml-if sequence-end><dtml-else>,</dtml-if>
</dtml-in>
</dtml-if>
</dtml-let>
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params>isMovement
uid
......
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params>isMovement
uid
......@@ -15,13 +15,23 @@ getDestinationSectionUid
getResourceUid
getVariationText
getAggregateUidList</params>
DELETE FROM
item
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
<dtml-let movement_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if "isMovement[loop_item]">
<dtml-call expr="movement_list.append(loop_item)">
</dtml-if>
</dtml-in>
<dtml-if expr="len(movement_list) > 0">
<dtml-if expr="_.len(movement_list) > 0">
INSERT INTO
item
VALUES
......@@ -34,7 +44,7 @@ VALUES
<dtml-sqlvar expr="getDestinationSectionUid[loop_item]" type="int" optional>,
<dtml-sqlvar expr="getResourceUid[loop_item]" type="int" optional>,
<dtml-sqlvar sequence-item type="int" optional>,
<dtml-sqlvar expr="getVariationText[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getVariationText[loop_item]" type="string" optional>
)
<dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in></dtml-if>
<dtml-if sequence-end><dtml-else>,</dtml-if>
......
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params>isMovement
uid
......@@ -13,16 +13,10 @@ getExplanationUid
getSourceUid
getDestinationUid
getResourceUid
getNetConvertedQuantity
getInventory
getInventoriatedQuantity
getStartDate
getStopDate
getNetConvertedTargetQuantity
getTargetStartDate
getTargetStopDate
getPrice
getTotalPrice
getTargetTotalPrice
isAccountable
isOrderable
isDeliverable
......@@ -35,16 +29,10 @@ INSERT INTO movement VALUES (
<dtml-if getSourceUid><dtml-sqlvar getSourceUid type="int"><dtml-else>NULL</dtml-if>,
<dtml-if getDestinationUid ><dtml-sqlvar getDestinationUid type="int"><dtml-else>NULL</dtml-if>,
<dtml-if getResourceUid><dtml-sqlvar getResourceUid type="int"><dtml-else>NULL</dtml-if>,
<dtml-if getNetConvertedQuantity><dtml-sqlvar getNetConvertedQuantity type="float"><dtml-else>NULL</dtml-if>,
<dtml-if getInventory><dtml-sqlvar getInventory type="float"><dtml-else>NULL</dtml-if>,
<dtml-if getInventoriatedQuantity><dtml-sqlvar getInventoriatedQuantity type="float"><dtml-else>NULL</dtml-if>,
<dtml-if getStartDate><dtml-sqlvar getStartDate type="datetime"><dtml-else>NULL</dtml-if>,
<dtml-if getStopDate><dtml-sqlvar getStopDate type="datetime"><dtml-else>NULL</dtml-if>,
<dtml-if getNetConvertedTargetQuantity><dtml-sqlvar getNetConvertedTargetQuantity type="float"><dtml-else>NULL</dtml-if>,
<dtml-if getTargetStartDate><dtml-sqlvar getTargetStartDate type="datetime"><dtml-else>NULL</dtml-if>,
<dtml-if getTargetStopDate><dtml-sqlvar getTargetStopDate type="datetime"><dtml-else>NULL</dtml-if>,
<dtml-if getPrice><dtml-sqlvar getPrice type="float"><dtml-else>NULL</dtml-if>,
<dtml-if getTotalPrice><dtml-sqlvar getTotalPrice type="float"><dtml-else>NULL</dtml-if>,
<dtml-if getTargetTotalPrice><dtml-sqlvar getTargetTotalPrice type="float"><dtml-else>NULL</dtml-if>,
<dtml-if "isAccountable is not None"><dtml-sqlvar isAccountable type="int"><dtml-else>NULL</dtml-if>,
<dtml-if "isOrderable is not None"><dtml-sqlvar isOrderable type="int"><dtml-else>NULL</dtml-if>,
<dtml-if "isDeliverable is not None"><dtml-sqlvar isDeliverable type="int"><dtml-else>NULL</dtml-if>,
......
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>uid
isMovement
getCategoryList</params>
DELETE FROM
category
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
INSERT INTO category VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if sequence-start><dtml-else>,</dtml-if>
<dtml-if expr="getCategoryList[loop_item]">
<dtml-let uid_list="portal_categories.getCategoryParentUidList(getCategoryList[loop_item])">
<dtml-if uid_list>
<dtml-in prefix="uid" expr="uid_list">
<dtml-if sequence-start><dtml-else>,</dtml-if>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
<dtml-sqlvar expr="uid_item[0]" type="int">,
<dtml-sqlvar expr="uid_item[1]" type="int">,
<dtml-sqlvar expr="uid_item[2]" type="int">
)
</dtml-in>
<dtml-else>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
NULL,
NULL,
1
)
</dtml-if>
</dtml-let>
<dtml-else>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
NULL,
NULL,
1
)
</dtml-if>
</dtml-in>
......@@ -13,29 +13,32 @@ getExplanationUid
getSourceUid
getDestinationUid
getResourceUid
getNetConvertedQuantity
getInventory
getInventoriatedStartDate
getInventoriatedStopDate
getNetConvertedTargetQuantity
getTargetStartDate
getTargetStopDate
getInventoriatedQuantity
getStartDate
getStopDate
getPrice
getTotalPrice
getTargetTotalPrice
hasCellContent
isAccountable
isOrderable
isDeliverable
isDivergent
getVariationText</params>
DELETE FROM
movement
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
<dtml-let movement_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if "isMovement[loop_item]">
<dtml-call expr="movement_list.append(loop_item)">
</dtml-if>
</dtml-in>
<dtml-if expr="len(movement_list) > 0">
<dtml-if expr="_.len(movement_list) > 0">
INSERT INTO
movement
VALUES
......@@ -46,17 +49,10 @@ VALUES
<dtml-sqlvar expr="getSourceUid[loop_item]" type="int" optional>,
<dtml-sqlvar expr="getDestinationUid[loop_item]" type="int" optional>,
<dtml-sqlvar expr="getResourceUid[loop_item]" type="int" optional>,
<dtml-sqlvar expr="getNetConvertedQuantity[loop_item]" type="float" optional>,
<dtml-sqlvar expr="getInventory[loop_item]" type="float" optional>,
<dtml-sqlvar expr="getInventoriatedStartDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getInventoriatedStopDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getNetConvertedTargetQuantity[loop_item]" type="float" optional>,
<dtml-sqlvar expr="getTargetStartDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getTargetStopDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getInventoriatedQuantity[loop_item]" type="float" optional>,
<dtml-sqlvar expr="getStartDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getStopDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getPrice[loop_item]" type="float" optional>,
<dtml-sqlvar expr="getTotalPrice[loop_item]" type="float" optional>,
<dtml-sqlvar expr="getTargetTotalPrice[loop_item]" type="float" optional>,
<dtml-sqlvar expr="hasCellContent[loop_item]" type="int" optional>,
<dtml-sqlvar expr="isAccountable[loop_item]" type="int" optional>,
<dtml-sqlvar expr="isOrderable[loop_item]" type="int" optional>,
<dtml-sqlvar expr="isDeliverable[loop_item]" type="int" optional>,
......
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>uid
getAcquiredCategoryList</params>
DELETE FROM
category
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
INSERT INTO category VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if sequence-start><dtml-else>,</dtml-if>
<dtml-if expr="getAcquiredCategoryList[loop_item]">
<dtml-let uid_list="portal_categories.getCategoryParentUidList(getAcquiredCategoryList[loop_item])">
<dtml-if uid_list>
<dtml-in prefix="uid" expr="uid_list">
<dtml-if sequence-start><dtml-else>,</dtml-if>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
<dtml-sqlvar expr="uid_item[0]" type="int">,
<dtml-sqlvar expr="uid_item[1]" type="int">,
<dtml-sqlvar expr="uid_item[2]" type="int">
)
</dtml-in>
<dtml-else>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
NULL,
NULL,
1
)
</dtml-if>
</dtml-let>
<dtml-else>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
NULL,
NULL,
1
)
</dtml-if>
</dtml-in>
......@@ -13,26 +13,16 @@ getPath
getRelativeUrl
getParentUid
id
CreationDate
getDescription
getTitle
meta_type
getPortalType
opportunity_state
getDefaultSourceReference
getDefaultDestinationReference
getDefaultSourceTitle
getDefaultDestinationTitle
getDefaultSourceSectionTitle
getDefaultDestinationSectionTitle
getDefaultCausalityId
getLocation
getCorporateRegistrationCode
getEan13Code
simulation_state
causality_state
discussion_state
invoice_state
getOrderId
validation_state
payment_state
event_state
......@@ -42,7 +32,18 @@ getSourceReference
getDestinationReference
getStringIndex
getIntIndex
getFloatIndex</params>
getFloatIndex
hasCellContent</params>
DELETE FROM
catalog
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
INSERT INTO
catalog
VALUES
......@@ -54,37 +55,27 @@ VALUES
<dtml-sqlvar expr="getRelativeUrl[loop_item]" type="string">,
<dtml-sqlvar expr="getParentUid[loop_item]" type="int">,
<dtml-sqlvar expr="id[loop_item]" type="string" optional>,
<dtml-sqlvar expr="CreationDate[loop_item]" type="datetime" optional>,
<dtml-sqlvar expr="getDescription[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getTitle[loop_item]" type="string" optional>,
<dtml-sqlvar expr="meta_type[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getPortalType[loop_item]" type="string" optional>,
<dtml-sqlvar expr="opportunity_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultSourceReference[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultDestinationReference[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultSourceTitle[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultDestinationTitle[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultSourceSectionTitle[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultDestinationSectionTitle[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDefaultCausalityId[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getLocation[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getCorporateRegistrationCode[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getEan13Code[loop_item]" type="string" optional>,
<dtml-sqlvar expr="validation_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="simulation_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="causality_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="discussion_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="invoice_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="payment_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="event_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="invoice_state[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getOrderId[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getReference[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getGroupingReference[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getSourceReference[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getDestinationReference[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getStringIndex[loop_item]" type="string" optional>,
<dtml-sqlvar expr="getIntIndex[loop_item]" type="int" optional>,
<dtml-sqlvar expr="getFloatIndex[loop_item]" type="float" optional>
<dtml-sqlvar expr="getFloatIndex[loop_item]" type="float" optional>,
<dtml-sqlvar expr="hasCellContent[loop_item]" type="int" optional>
)
<dtml-if sequence-end><dtml-else>,</dtml-if>
</dtml-in>
......@@ -8,25 +8,42 @@ class_name:
class_file:
</dtml-comment>
<params>uid
getMembershipCriterionCategoryList
predicate_property_dict
isPredicate</params>
INSERT INTO predicate_category VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if sequence-start><dtml-else>,</dtml-if>
<dtml-if isPredicate[loop_item]>
<dtml-if getMembershipCriterionCategoryList[loop_item]>
<dtml-let uid_list="portal_categories.getCategoryParentUidList(getMembershipCriterionCategoryList[loop_item])">
<dtml-if uid_list>
<dtml-in "uid_list">
(<dtml-sqlvar uid type="int">, <dtml-var "_['sequence-item'][0]" >, <dtml-var "_['sequence-item'][1]" >, <dtml-var "_['sequence-item'][2]" >)
<dtml-if sequence-end><dtml-else>,</dtml-if>
DELETE FROM
predicate_category
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
<dtml-else>
(<dtml-sqlvar uid[loop_item] type="int">, NULL, NULL,1),
</dtml-if>
;
<dtml-var "'\0'">
<dtml-let predicate_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if "isPredicate[loop_item]">
<dtml-call expr="predicate_list.append(loop_item)">
</dtml-if>
</dtml-in>
<dtml-if expr="_.len(predicate_list) > 0">
INSERT INTO predicate_category VALUES
<dtml-in prefix="loop" expr="predicate_list">
<dtml-if sequence-start><dtml-else>,</dtml-if>
<dtml-if "predicate_property_dict[loop_item].has_key('membership_criterion_category_list')">
<dtml-let uid_list="portal_categories.getCategoryParentUidList(predicate_property_dict[loop_item]['membership_criterion_category_list'])">
<dtml-if uid_list>
<dtml-in "uid_list">
(<dtml-sqlvar expr="uid[loop_item]" type="int">, <dtml-var "_['sequence-item'][0]" >, <dtml-var "_['sequence-item'][1]" >, <dtml-var "_['sequence-item'][2]" >)
<dtml-if sequence-end><dtml-else>,</dtml-if>
</dtml-in>
<dtml-else>
(<dtml-sqlvar expr="uid[loop_item]" type="int">, NULL, NULL,1)
</dtml-if>
</dtml-let>
<dtml-else>
(<dtml-sqlvar expr="uid[loop_item]" type="int">, NULL, NULL,1)
</dtml-if>
</dtml-in>
</dtml-if>
</dtml-let>
<dtml-else>
(<dtml-sqlvar uid[loop_item] type="int">, NULL, NULL,1),
</dtml-if>
</dtml-if>
</dtml-in>
......@@ -10,14 +10,35 @@ class_file:
<params>uid
isPredicate
predicate_property_dict</params>
INSERT INTO predicate VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if sequence-start><dtml-else>,</dtml-if>
<dtml-if isPredicate[loop_item]>(
<dtml-sqlvar uid[loop_item] type="int">,
<dtml-if expr="predicate_property_dict[loop_item].has_key('quantity')"><dtml-sqlvar expr="predicate_property_dict[loop_item]['quantity']" type="float"><dtml-else>NULL</dtml-if>,
<dtml-if expr="predicate_property_dict[loop_item].has_key('quantity_min')"><dtml-sqlvar expr="predicate_property_dict[loop_item]['quantity_min']" type="float"><dtml-else>NULL</dtml-if>,
<dtml-if expr="predicate_property_dict[loop_item].has_key('quantity_max')"><dtml-sqlvar expr="predicate_property_dict[loop_item]['quantity_max']" type="float"><dtml-else>NULL</dtml-if>
)
</dtml-if>
DELETE FROM
predicate
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
<dtml-let predicate_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if "isPredicate[loop_item]">
<dtml-call expr="predicate_list.append(loop_item)">
</dtml-if>
</dtml-in>
<dtml-if expr="_.len(predicate_list) > 0">
INSERT INTO predicate VALUES
<dtml-in prefix="loop" expr="predicate_list">
<dtml-if sequence-start><dtml-else>,</dtml-if>
(
<dtml-sqlvar expr="uid[loop_item]" type="int">,
<dtml-sqlvar expr="predicate_property_dict[loop_item].get('quantity', None)" type="float" optional>,
<dtml-sqlvar expr="predicate_property_dict[loop_item].get('quantity_range_min', None)" type="float" optional>,
<dtml-sqlvar expr="predicate_property_dict[loop_item].get('quantity_range_max', None)" type="float" optional>,
<dtml-sqlvar expr="predicate_property_dict[loop_item].get('start_date', None)" type="datetime" optional>,
<dtml-sqlvar expr="predicate_property_dict[loop_item].get('start_date_range_min', None)" type="datetime" optional>,
<dtml-sqlvar expr="predicate_property_dict[loop_item].get('start_date_range_max', None)" type="datetime" optional>
)
</dtml-in>
</dtml-if>
</dtml-let>
......@@ -17,7 +17,7 @@ optimised_roles_and_users</params>
</dtml-in>
</dtml-if>
</dtml-in>
<dtml-if expr="len(row_list) > 0">
<dtml-if expr="row_list">
INSERT INTO
roles_and_users
VALUES
......
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_rows:0
max_cache:100
cache_time:0
class_name:
......@@ -28,6 +28,16 @@ getStopDate
isAccountable
getPortalType
getVariationText</params>
DELETE FROM
stock
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
<dtml-let row_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if "isMovement[loop_item]">
......@@ -42,7 +52,7 @@ getVariationText</params>
</dtml-if>
</dtml-in>
<dtml-if "len(row_list) > 0">
<dtml-if "row_list">
INSERT INTO
stock
VALUES
......@@ -57,11 +67,11 @@ VALUES
<dtml-sqlvar expr="row_item[6]" type="int" optional>,
<dtml-sqlvar expr="row_item[7]" type="int">,
<dtml-sqlvar expr="row_item[8]" type="float" optional>,
<dtml-sqlvar expr="row_item[9]" type="datetime" optional>
<dtml-sqlvar expr="row_item[10]" type="float" optional>
<dtml-sqlvar expr="row_item[11]" type="int" optional>
<dtml-sqlvar expr="row_item[12]" type="string" optional>
<dtml-sqlvar expr="row_item[13]" type="string" optional>
<dtml-sqlvar expr="row_item[9]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[10]" type="float" optional>,
<dtml-sqlvar expr="row_item[11]" type="int" optional>,
<dtml-sqlvar expr="row_item[12]" type="string" optional>,
<dtml-sqlvar expr="row_item[13]" type="string" optional>,
<dtml-sqlvar expr="row_item[14]" type="string" optional>
)
<dtml-if sequence-end><dtml-else>,</dtml-if>
......
......@@ -9,6 +9,16 @@ class_file:
</dtml-comment>
<params>Subject
uid</params>
DELETE FROM
subject
WHERE
<dtml-in uid>
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
;
<dtml-var "'\0'">
INSERT INTO subject VALUES
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if sequence-start><dtml-else>,</dtml-if>
......
......@@ -19,37 +19,26 @@ CREATE TABLE `catalog` (
`relative_url` varchar(255) NOT NULL default '',
`parent_uid` BIGINT UNSIGNED default '0',
`id` varchar(255) default '',
`CreationDate` datetime default '0000-00-00 00:00:00',
`description` text,
`title` varchar(255) default '',
`meta_type` varchar(255) default '',
`portal_type` varchar(255) default '',
`opportunity_state` varchar(255) default '',
`default_source_reference` varchar(255) default '',
`default_destination_reference` varchar(255) default '',
`default_source_title` varchar(255) default '',
`default_destination_title` varchar(255) default '',
`default_source_section_title` varchar(255) default '',
`default_destination_section_title` varchar(255) default '',
`default_causality_id` varchar(255) default '',
`location` varchar(255),
`corporate_registration_code` varchar(255),
`ean13_code` varchar(255),
`validation_state` varchar(255) default '',
`simulation_state` varchar(255) default '',
`causality_state` varchar(255) default '',
`discussion_state` varchar(255) default '',
`invoice_state` varchar(255) default '',
`payment_state` varchar(255) default '',
`event_state` varchar(255) default '',
`order_id` varchar(255) default '',
`reference` varchar(255) default '',
`grouping_reference` varchar(30) default '',
`source_reference` varchar(255) default '',
`destination_reference` varchar(255) default '',
`string_index` varchar(255),
`int_index` INT,
`float_index` real,
`has_cell_content` tinyint(1) default '0',
`has_cell_content` bool,
PRIMARY KEY (`uid`),
KEY `security_uid` (`security_uid`),
KEY `Parent` (`parent_uid`),
......@@ -62,9 +51,7 @@ CREATE TABLE `catalog` (
KEY `validation_state` (`validation_state`),
KEY `simulation_state` (`simulation_state`),
KEY `causality_state` (`causality_state`),
KEY `discussion_state` (`discussion_state`),
KEY `invoice_state` (`invoice_state`),
KEY `order_id` (`order_id`),
KEY `payment_state` (`payment_state`),
KEY `event_state` (`event_state`)
) TYPE=InnoDB;
......@@ -18,6 +18,7 @@ CREATE TABLE `compatibility` (
`Date` datetime default '0000-00-00 00:00:00',
`PrincipiaSearchSource` text,
`SearchableText` text,
`CreationDate` datetime default '0000-00-00 00:00:00',
`EffectiveDate` datetime default '0000-00-00 00:00:00',
`ExpiresDate` datetime default '0000-00-00 00:00:00',
`ModificationDate` datetime default '0000-00-00 00:00:00',
......
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params></params>
CREATE TABLE `delivery` (
......@@ -16,7 +16,11 @@ CREATE TABLE `delivery` (
`destination_section_uid` BIGINT UNSIGNED default '0',
`resource_uid` BIGINT UNSIGNED default '0',
`start_date` datetime default NULL,
`start_date_range_min` datetime default NULL,
`start_date_range_max` datetime default NULL,
`stop_date` datetime default NULL,
`stop_date_range_min` datetime default NULL,
`stop_date_range_max` datetime default NULL,
KEY `uid` (`uid`),
KEY `source_uid` (`source_uid`),
KEY `destination_uid` (`destination_uid`),
......
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params></params>
# Host:
......
......@@ -19,15 +19,9 @@ CREATE TABLE `movement` (
`destination_uid` BIGINT UNSIGNED default '0',
`resource_uid` BIGINT UNSIGNED default '0',
`quantity` real default '0.0',
`inventory` real default '0.0',
`start_date` datetime,
`stop_date` datetime,
`target_quantity` real default '0.0',
`target_start_date` datetime,
`target_stop_date` datetime,
`price` real,
`total_price` real,
`target_total_price` real,
`is_accountable` bool,
`is_orderable` bool,
`is_deliverable` bool,
......
......@@ -13,7 +13,7 @@ CREATE TABLE predicate (
`quantity` real ,
`quantity_range_min` real ,
`quantity_range_max` real ,
`start_date` datetime ,
`start_date` datetime,
`start_date_range_min` datetime ,
`start_date_range_max` datetime ,
KEY `uid` (`uid`)
......
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>table_0
table_1</params>
<dtml-var table_1>.portal_type = 'Base Category' AND
<dtml-var table_1>.uid = <dtml-var table_0>.base_category_uid AND
<dtml-var table_0>.category_strict_membership = 1 AND
<dtml-var table_0>.uid = catalog.uid
\ No newline at end of file
......@@ -40,4 +40,6 @@ ORDER BY
</dtml-if>
<dtml-if limit_expression>
LIMIT <dtml-var "limit_expression">
<dtml-else>
LIMIT 1000
</dtml-if>
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params>uid</params>
DELETE FROM delivery WHERE <dtml-sqltest uid op=eq type=int>
......@@ -5,7 +5,7 @@ max_rows:1000
max_cache:100
cache_time:0
class_name:
class_
class_file:
</dtml-comment>
<params>isDelivery
uid
......@@ -15,7 +15,11 @@ getSourceSectionUid
getDestinationSectionUid
getResourceUid
getStartDate
getStartDateRangeMin
getStartDateRangeMax
getStopDate
getStopDateRangeMin
getStopDateRangeMax
insert_line</params>
<dtml-if insert_line>
INSERT INTO delivery(uid) VALUES (<dtml-sqlvar uid type="int">);
......@@ -32,6 +36,10 @@ UPDATE delivery SET
destination_section_uid=<dtml-sqlvar getDestinationSectionUid type="int" optional>,
resource_uid=<dtml-sqlvar getResourceUid type="int" optional>,
start_date=<dtml-sqlvar getStartDate type="datetime" optional>,
stop_date=<dtml-sqlvar getStopDate type="datetime" optional>
start_date_range_min=<dtml-sqlvar getStartDateRangeMin type="datetime" optional>,
start_date_range_max=<dtml-sqlvar getStartDateRangeMax type="datetime" optional>,
stop_date=<dtml-sqlvar getStopDate type="datetime" optional>,
stop_date_range_min=<dtml-sqlvar getStopDateRangeMin type="datetime" optional>,
stop_date_range_max=<dtml-sqlvar getStopDateRangeMax type="datetime" optional>
WHERE <dtml-sqltest uid op=eq type=int>
</dtml-if>
......@@ -13,26 +13,15 @@ getPath
getRelativeUrl
getParentUid
id
CreationDate
getDescription
getTitle
meta_type
getPortalType
opportunity_state
getDefaultSourceReference
getDefaultDestinationReference
getDefaultSourceTitle
getDefaultDestinationTitle
getDefaultSourceSectionTitle
getDefaultDestinationSectionTitle
getDefaultCausalityId
getLocation
getEan13Code
getSimulationState
causality_state
discussion_state
invoice_state
getOrderId
validation_state
payment_state
event_state
......@@ -43,6 +32,7 @@ getDestinationReference
getStringIndex
getIntIndex
getFloatIndex
getCorporateRegistrationCode
insert_catalog_line
hasCellContent</params>
<dtml-if insert_catalog_line>
......@@ -57,29 +47,19 @@ UPDATE catalog SET uid=<dtml-sqlvar uid type="int">,
relative_url=<dtml-sqlvar getRelativeUrl type="string">,
parent_uid=<dtml-sqlvar getParentUid type="int" optional>,
id=<dtml-sqlvar id type="string" optional>,
CreationDate=<dtml-sqlvar CreationDate type="datetime" optional>,
description=<dtml-sqlvar getDescription type="string" optional>,
title=<dtml-sqlvar getTitle type="string" optional>,
meta_type=<dtml-sqlvar meta_type type="string" optional>,
portal_type=<dtml-sqlvar getPortalType type="string" optional>,
opportunity_state=<dtml-sqlvar opportunity_state type="string" optional>,
default_source_reference=<dtml-sqlvar getDefaultSourceReference type="string" optional>,
default_destination_reference=<dtml-sqlvar getDefaultDestinationReference type="string" optional>,
default_source_title=<dtml-sqlvar getDefaultSourceTitle type="string" optional>,
default_destination_title=<dtml-sqlvar getDefaultDestinationTitle type="string" optional>,
default_source_section_title=<dtml-sqlvar getDefaultSourceSectionTitle type="string" optional>,
default_destination_section_title=<dtml-sqlvar getDefaultDestinationSectionTitle type="string" optional>,
default_causality_id=<dtml-sqlvar getDefaultCausalityId type="string" optional>,
location=<dtml-sqlvar getLocation type="string" optional>,
corporate_registration_code=<dtml-sqlvar getCorporateRegistrationCode type="string" optional>,
ean13_code=<dtml-sqlvar getEan13Code type="string" optional>,
validation_state=<dtml-sqlvar validation_state type="string" optional>,
simulation_state=<dtml-sqlvar getSimulationState type="string" optional>,
causality_state=<dtml-sqlvar causality_state type="string" optional>,
discussion_state=<dtml-sqlvar discussion_state type="string" optional>,
payment_state=<dtml-sqlvar payment_state type="string" optional>,
event_state=<dtml-sqlvar event_state type="string" optional>,
invoice_state=<dtml-sqlvar invoice_state type="string" optional>,
order_id=<dtml-sqlvar getOrderId type="string" optional>,
reference=<dtml-sqlvar getReference type="string" optional>,
grouping_reference=<dtml-sqlvar getGroupingReference type="string" optional>,
source_reference=<dtml-sqlvar getSourceReference type="string" optional>,
......
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