From ff4fa2a4edc22189c3db6bea3c6d852becd82fa8 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Thu, 22 Jan 2009 13:06:45 +0000 Subject: [PATCH] Revert commit 25259. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25260 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../skins/activity/SQLDict_assignMessage.zsql | 9 ++++++++- .../skins/activity/SQLDict_hasMessage.zsql | 7 ++++--- .../skins/activity/SQLDict_readMessageList.zsql | 2 ++ .../skins/activity/SQLDict_readUidList.zsql | 8 ++++++-- .../activity/SQLDict_reserveMessageList.zsql | 3 ++- .../SQLDict_selectReservedMessageList.zsql | 2 +- .../skins/activity/SQLDict_setPriority.zsql | 17 +++++++++++++++-- .../skins/activity/SQLDict_timeShift.zsql | 2 +- .../activity/SQLDict_validateMessageList.zsql | 12 ++++++------ .../activity/SQLDict_writeMessageList.zsql | 4 ++-- .../skins/activity/SQLQueue_assignMessage.zsql | 7 ++++++- .../skins/activity/SQLQueue_hasMessage.zsql | 7 ++++--- .../activity/SQLQueue_readMessageList.zsql | 2 ++ .../activity/SQLQueue_reserveMessageList.zsql | 4 +++- .../SQLQueue_selectReservedMessageList.zsql | 2 +- .../skins/activity/SQLQueue_setPriority.zsql | 4 +++- .../skins/activity/SQLQueue_timeShift.zsql | 4 ++-- .../activity/SQLQueue_validateMessageList.zsql | 12 ++++++------ .../activity/SQLQueue_writeMessageList.zsql | 4 ++-- 19 files changed, 76 insertions(+), 36 deletions(-) diff --git a/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql index 001dde5fda..083b0c7333 100644 --- a/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql @@ -7,8 +7,9 @@ cache_time:0 class_name: class_file: </dtml-comment> -<params> +<params>path processing_node +method_id uid </params> UPDATE message @@ -16,8 +17,14 @@ SET processing_node=<dtml-sqlvar processing_node type="int">, processing=0 WHERE +<dtml-if uid> uid IN ( <dtml-in uid><dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) +<dtml-else> + processing_node = -1 + AND path = <dtml-sqlvar path type="string"> +<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> +</dtml-if> <dtml-var sql_delimiter> COMMIT diff --git a/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql index eed5e4e63a..87f9da9d4a 100644 --- a/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql @@ -13,7 +13,8 @@ only_valid</params> SELECT count(path) as message_count FROM message WHERE -path = <dtml-sqlvar path type="string"> -<dtml-if expr="method_id is not None">AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> -<dtml-if expr="only_valid">AND processing_node > -2</dtml-if> +1 = 1 +<dtml-if path> AND path = <dtml-sqlvar path type="string"></dtml-if> +<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> +<dtml-if only_valid>AND processing_node > -2</dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql index 2c9c886f38..1e4f857a3a 100644 --- a/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql @@ -10,6 +10,7 @@ class_file: <params>path method_id processing_node +priority include_processing to_date offset:int=0 @@ -23,6 +24,7 @@ WHERE AND processing = 0 </dtml-if> <dtml-if expr="processing_node is not None"> AND processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if> +<dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if> <dtml-if path>AND path = <dtml-sqlvar path type="string"> </dtml-if> <dtml-if method_id> AND method_id = <dtml-sqlvar method_id type="string"> </dtml-if> <dtml-if to_date> AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql index 8b93235542..e62799daf6 100644 --- a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql @@ -7,15 +7,19 @@ cache_time:0 class_name: class_file: </dtml-comment> -<params> +<params>processing_node method_id path +to_date order_validation_text -</params> +group_method_id</params> SELECT uid FROM message WHERE processing = 0 +<dtml-if expr="processing_node is not None"> AND processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if> <dtml-if method_id> AND method_id = <dtml-sqlvar method_id type="string"> </dtml-if> <dtml-if path> AND path = <dtml-sqlvar path type="string"> </dtml-if> +<dtml-if to_date> AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if> <dtml-if order_validation_text> AND order_validation_text = <dtml-sqlvar order_validation_text type="string"> </dtml-if> +<dtml-if group_method_id> AND group_method_id = <dtml-sqlvar group_method_id type="string"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLDict_reserveMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_reserveMessageList.zsql index b9240606ea..8f2f4674ad 100644 --- a/product/CMFActivity/skins/activity/SQLDict_reserveMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_reserveMessageList.zsql @@ -11,7 +11,7 @@ class_file: to_date count group_method_id -</params> +order_validation_text</params> UPDATE message SET @@ -20,6 +20,7 @@ WHERE processing_node=0 AND date <= <dtml-sqlvar to_date type="datetime"> <dtml-if group_method_id> AND group_method_id = <dtml-sqlvar group_method_id type="string"> </dtml-if> + <dtml-if order_validation_text> AND order_validation_text = <dtml-sqlvar order_validation_text type="string"> </dtml-if> ORDER BY priority, date, uid <dtml-if count> diff --git a/product/CMFActivity/skins/activity/SQLDict_selectReservedMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_selectReservedMessageList.zsql index 393e7d9f48..3a50fe8c32 100644 --- a/product/CMFActivity/skins/activity/SQLDict_selectReservedMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_selectReservedMessageList.zsql @@ -16,6 +16,6 @@ FROM WHERE processing_node = <dtml-sqlvar processing_node type="int"> AND processing = 0 -<dtml-if expr="count is not None"> +<dtml-if count> LIMIT <dtml-sqlvar count type="int"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql b/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql index 776b33105c..90053a4e36 100644 --- a/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql @@ -9,9 +9,11 @@ class_file: </dtml-comment> <params>uid:list priority +date retry delay -</params> +processing_node +order_validation_text</params> UPDATE message SET @@ -21,11 +23,22 @@ SET </dtml-if> <dtml-if delay> , date = DATE_ADD(UTC_TIMESTAMP(), INTERVAL <dtml-sqlvar delay type="int"> * (retry + 1) SECOND) +<dtml-elif date> + , date = <dtml-sqlvar date type="datetime"> </dtml-if> <dtml-if retry> , retry = retry + <dtml-sqlvar retry type="int"> </dtml-if> WHERE - uid IN ( + 1 = 1 +<dtml-if uid> + AND uid IN ( <dtml-in uid><dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) +</dtml-if> +<dtml-if expr="_.getattr(_, 'processing_node', None) is not None"> + AND processing_node = <dtml-sqlvar processing_node type="int"> +</dtml-if> +<dtml-if order_validation_text> + AND order_validation_text = <dtml-sqlvar order_validation_text type="string"> +</dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLDict_timeShift.zsql b/product/CMFActivity/skins/activity/SQLDict_timeShift.zsql index d2ba77bc6c..05ad831a4d 100644 --- a/product/CMFActivity/skins/activity/SQLDict_timeShift.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_timeShift.zsql @@ -15,7 +15,7 @@ UPDATE SET date = DATE_SUB(date, INTERVAL <dtml-sqlvar delay type="int"> SECOND), processing_date = DATE_SUB(processing_date, INTERVAL <dtml-sqlvar delay type="int"> SECOND) -<dtml-if expr="retry is not None"> +<dtml-if retry> ,retry = GREATEST(retry,<dtml-sqlvar retry type="int">) - <dtml-sqlvar retry type="int"> </dtml-if> WHERE diff --git a/product/CMFActivity/skins/activity/SQLDict_validateMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_validateMessageList.zsql index 850a10e545..4fdd349e24 100644 --- a/product/CMFActivity/skins/activity/SQLDict_validateMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_validateMessageList.zsql @@ -15,7 +15,7 @@ count serialization_tag </params> SELECT -<dtml-if expr="count"> +<dtml-if count> COUNT(*) AS uid_count <dtml-else> * @@ -24,23 +24,23 @@ FROM message WHERE processing_node >= -2 -<dtml-if expr="method_id is not None"> +<dtml-if method_id> AND method_id IN ( <dtml-in method_id><dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) </dtml-if> -<dtml-if expr="message_uid is not None">AND uid = <dtml-sqlvar message_uid type="int"> </dtml-if> -<dtml-if expr="path is not None"> +<dtml-if message_uid>AND uid = <dtml-sqlvar message_uid type="int"> </dtml-if> +<dtml-if path> AND path IN ( <dtml-in path><dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) </dtml-if> -<dtml-if expr="tag is not None"> +<dtml-if tag> AND tag IN ( <dtml-in tag><dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) </dtml-if> -<dtml-if expr="serialization_tag is not None"> +<dtml-if serialization_tag> AND processing_node > -1 AND serialization_tag = <dtml-sqlvar serialization_tag type="string"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql index 3c9e51d5d7..a402c7e5d4 100644 --- a/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql @@ -26,9 +26,9 @@ VALUES ( <dtml-sqlvar expr="uid_list[loop_item]" type="int">, <dtml-sqlvar expr="path_list[loop_item]" type="string">, - <dtml-if expr="date_list is not None"><dtml-if expr="date_list[loop_item] is not None"><dtml-sqlvar expr="date_list[loop_item]" type="datetime"><dtml-else>UTC_TIMESTAMP()</dtml-if><dtml-else>UTC_TIMESTAMP()</dtml-if>, + <dtml-if date_list><dtml-if expr="date_list[loop_item] is not None"><dtml-sqlvar expr="date_list[loop_item]" type="datetime"><dtml-else>UTC_TIMESTAMP()</dtml-if><dtml-else>UTC_TIMESTAMP()</dtml-if>, <dtml-sqlvar expr="method_id_list[loop_item]" type="string">, - <dtml-if expr="processing_node_list is not None"><dtml-sqlvar expr="processing_node_list[loop_item]" type="int"><dtml-else>-1</dtml-if>, + <dtml-if processing_node_list><dtml-sqlvar expr="processing_node_list[loop_item]" type="int"><dtml-else>-1</dtml-if>, 0, <dtml-sqlvar expr="priority_list[loop_item]" type="int">, <dtml-sqlvar expr="group_method_id_list[loop_item]" type="string">, diff --git a/product/CMFActivity/skins/activity/SQLQueue_assignMessage.zsql b/product/CMFActivity/skins/activity/SQLQueue_assignMessage.zsql index 15bed18414..04f851149b 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_assignMessage.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_assignMessage.zsql @@ -7,16 +7,21 @@ cache_time:0 class_name: class_file: </dtml-comment> -<params> +<params>path processing_node +method_id uid</params> UPDATE message_queue SET processing_node=<dtml-sqlvar processing_node type="int">, processing=0 WHERE +<dtml-if path> path = <dtml-sqlvar path type="string"> +<dtml-else> uid IN ( <dtml-in uid><dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) +</dtml-if> +<dtml-if method_id> AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> <dtml-var sql_delimiter> COMMIT diff --git a/product/CMFActivity/skins/activity/SQLQueue_hasMessage.zsql b/product/CMFActivity/skins/activity/SQLQueue_hasMessage.zsql index 79d9f06ed7..8302bd328c 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_hasMessage.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_hasMessage.zsql @@ -13,7 +13,8 @@ only_valid</params> SELECT count(path) as message_count FROM message_queue WHERE -path = <dtml-sqlvar path type="string"> -<dtml-if expr="method_id is not None">AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> -<dtml-if expr="only_valid">AND processing_node > -2</dtml-if> +1 = 1 +<dtml-if path>AND path = <dtml-sqlvar path type="string"></dtml-if> +<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> +<dtml-if only_valid>AND processing_node > -2</dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql b/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql index 679b7538a9..85231dd260 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql @@ -10,6 +10,7 @@ class_file: <params>path method_id processing_node +priority to_date offset:int=0 count:int=1000 @@ -19,6 +20,7 @@ SELECT * FROM WHERE processing = 0 <dtml-if expr="processing_node is not None"> AND processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if> +<dtml-if priority>AND priority = <dtml-sqlvar priority type="int"> </dtml-if> <dtml-if path>AND path = <dtml-sqlvar path type="string"></dtml-if> <dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> <dtml-if to_date> AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLQueue_reserveMessageList.zsql b/product/CMFActivity/skins/activity/SQLQueue_reserveMessageList.zsql index 56e1968c5a..468644b017 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_reserveMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_reserveMessageList.zsql @@ -20,6 +20,8 @@ WHERE AND date <= <dtml-sqlvar to_date type="datetime"> ORDER BY priority, date, uid -LIMIT <dtml-sqlvar count type="int"> +<dtml-if count> + LIMIT <dtml-sqlvar count type="int"> +</dtml-if> <dtml-var sql_delimiter> COMMIT diff --git a/product/CMFActivity/skins/activity/SQLQueue_selectReservedMessageList.zsql b/product/CMFActivity/skins/activity/SQLQueue_selectReservedMessageList.zsql index f2e2d22162..3840addd87 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_selectReservedMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_selectReservedMessageList.zsql @@ -16,6 +16,6 @@ FROM WHERE processing_node = <dtml-sqlvar processing_node type="int"> AND processing = 0 -<dtml-if expr="count is not None"> +<dtml-if count> LIMIT <dtml-sqlvar count type="int"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLQueue_setPriority.zsql b/product/CMFActivity/skins/activity/SQLQueue_setPriority.zsql index 69e8d9958b..1b817b9841 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_setPriority.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_setPriority.zsql @@ -10,7 +10,7 @@ class_file: <params>uid priority delay -</params> +date</params> UPDATE message_queue SET @@ -20,6 +20,8 @@ SET </dtml-if> <dtml-if delay> , date = DATE_ADD(UTC_TIMESTAMP(), INTERVAL <dtml-sqlvar delay type="int"> SECOND) + <dtml-elif date> + , date = <dtml-sqlvar date type="datetime"> </dtml-if> WHERE uid IN ( diff --git a/product/CMFActivity/skins/activity/SQLQueue_timeShift.zsql b/product/CMFActivity/skins/activity/SQLQueue_timeShift.zsql index c10b7c45b0..db3c8aa6b4 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_timeShift.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_timeShift.zsql @@ -12,8 +12,8 @@ processing_node</params> UPDATE message_queue SET - date = DATE_SUB(date, INTERVAL <dtml-sqlvar delay type="int"> SECOND), - processing_date = DATE_SUB(processing_date, INTERVAL <dtml-sqlvar delay type="int"> SECOND) + date = date - <dtml-sqlvar delay type="int">, + processing_date = processing_date - <dtml-sqlvar delay type="int"> WHERE 1 = 1 <dtml-if expr="processing_node is not None"> diff --git a/product/CMFActivity/skins/activity/SQLQueue_validateMessageList.zsql b/product/CMFActivity/skins/activity/SQLQueue_validateMessageList.zsql index b8b456f470..874192c1ce 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_validateMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_validateMessageList.zsql @@ -15,7 +15,7 @@ count serialization_tag </params> SELECT -<dtml-if expr="count"> +<dtml-if count> COUNT(*) AS uid_count <dtml-else> * @@ -24,23 +24,23 @@ FROM message_queue WHERE processing_node >= -2 -<dtml-if expr="method_id is not None"> +<dtml-if method_id> AND method_id IN ( <dtml-in method_id><dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) </dtml-if> -<dtml-if expr="message_uid is not None">AND uid = <dtml-sqlvar message_uid type="int"> </dtml-if> -<dtml-if expr="path is not None"> +<dtml-if message_uid>AND uid = <dtml-sqlvar message_uid type="int"> </dtml-if> +<dtml-if path> AND path IN ( <dtml-in path><dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) </dtml-if> -<dtml-if expr="tag is not None"> +<dtml-if tag> AND tag IN ( <dtml-in tag><dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> ) </dtml-if> -<dtml-if expr="serialization_tag is not None"> +<dtml-if serialization_tag> AND processing_node > -1 AND serialization_tag = <dtml-sqlvar serialization_tag type="string"> </dtml-if> diff --git a/product/CMFActivity/skins/activity/SQLQueue_writeMessageList.zsql b/product/CMFActivity/skins/activity/SQLQueue_writeMessageList.zsql index 44f87bf893..1c5fb377ce 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_writeMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_writeMessageList.zsql @@ -25,9 +25,9 @@ VALUES ( <dtml-sqlvar expr="uid_list[loop_item]" type="int">, <dtml-sqlvar expr="path_list[loop_item]" type="string">, - <dtml-if expr="date_list is not None"><dtml-if expr="date_list[loop_item] is not None"><dtml-sqlvar expr="date_list[loop_item]" type="datetime"><dtml-else>UTC_TIMESTAMP()</dtml-if><dtml-else>UTC_TIMESTAMP()</dtml-if>, + <dtml-if date_list><dtml-if expr="date_list[loop_item] is not None"><dtml-sqlvar expr="date_list[loop_item]" type="datetime"><dtml-else>UTC_TIMESTAMP()</dtml-if><dtml-else>UTC_TIMESTAMP()</dtml-if>, <dtml-sqlvar expr="method_id_list[loop_item]" type="string">, - <dtml-if expr="processing_node_list is not None"><dtml-sqlvar expr="processing_node_list[loop_item]" type="int"><dtml-else>-1</dtml-if>, + <dtml-if processing_node_list><dtml-sqlvar expr="processing_node_list[loop_item]" type="int"><dtml-else>-1</dtml-if>, 0, <dtml-sqlvar expr="priority_list[loop_item]" type="int">, <dtml-sqlvar expr="tag_list[loop_item]" type="string">, -- 2.30.9