From fabbe1b5a952c6c0a6a4263fb3d1dc6e037b40c0 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 9 Nov 2007 13:23:24 +0000
Subject: [PATCH] Do not use -1 value in "processing" column (it duplicates the
 information already provided by "processing_node=-1"). This allows to check
 this column for equality instead of inequality, thus making a better use of
 indexes.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17490 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFActivity/skins/activity/SQLDict_readMessage.zsql   | 2 +-
 .../CMFActivity/skins/activity/SQLDict_readMessageList.zsql   | 2 +-
 product/CMFActivity/skins/activity/SQLDict_readUidList.zsql   | 4 ++--
 product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql  | 2 +-
 .../CMFActivity/skins/activity/SQLDict_writeMessageList.zsql  | 2 +-
 product/CMFActivity/skins/activity/SQLQueue_readMessage.zsql  | 2 +-
 .../CMFActivity/skins/activity/SQLQueue_readMessageList.zsql  | 2 +-
 product/CMFActivity/skins/activity/SQLQueue_readUidList.zsql  | 2 +-
 product/CMFActivity/skins/activity/SQLQueue_writeMessage.zsql | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql
index 29254e6433..07d275ac4e 100644
--- a/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql
@@ -16,7 +16,7 @@ order_validation_text</params>
 SELECT * FROM
     message
 WHERE
-    processing <> 1
+    processing = 0
 <dtml-if processing_node> 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 to_date>AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if>
diff --git a/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql
index 72ed310f45..3c58a2e720 100644
--- a/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql
@@ -18,7 +18,7 @@ SELECT * FROM
 WHERE
 1 = 1
 <dtml-if expr="not(include_processing)">
-    AND processing <> 1
+    AND processing = 0
 </dtml-if>
 <dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if>
 <dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if>
diff --git a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql
index d21b10b1b7..56e67c3c58 100644
--- a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql
@@ -16,10 +16,10 @@ group_method_id</params>
 SELECT uid FROM
     message
 WHERE
-    processing <> 1
+    processing = 0
 <dtml-if processing_node> 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>
\ No newline at end of file
+<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_writeMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql
index 08eb0f24ca..e0cea30820 100644
--- a/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql
@@ -25,7 +25,7 @@ SET
   <dtml-if date>date = <dtml-sqlvar date type="datetime">, <dtml-else>date = <dtml-sqlvar "_.DateTime()" type="datetime">, </dtml-if> 
   method_id = <dtml-sqlvar method_id type="string">,
   processing_node = <dtml-sqlvar processing_node type="int">,
-  processing = -1,
+  processing = 0,
   priority = <dtml-sqlvar priority type="int">,
   broadcast = <dtml-sqlvar broadcast type="int">,
   group_method_id = <dtml-sqlvar group_method_id type="string">,
diff --git a/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql
index 8c308f6d41..b50e069d39 100644
--- a/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_writeMessageList.zsql
@@ -29,7 +29,7 @@ VALUES
   <dtml-if date_list><dtml-sqlvar expr="date_list[loop_item]" type="datetime"><dtml-else><dtml-sqlvar "_.DateTime()" type="datetime"></dtml-if>, 
   <dtml-sqlvar expr="method_id_list[loop_item]" type="string">,
   <dtml-if processing_node_list><dtml-sqlvar expr="processing_node_list[loop_item]" type="int"><dtml-else>-1</dtml-if>,
-  -1,
+  0,
   <dtml-sqlvar expr="priority_list[loop_item]" type="int">,
   <dtml-sqlvar expr="broadcast_list[loop_item]" type="int">,
   <dtml-sqlvar expr="group_method_id_list[loop_item]" type="string">,
diff --git a/product/CMFActivity/skins/activity/SQLQueue_readMessage.zsql b/product/CMFActivity/skins/activity/SQLQueue_readMessage.zsql
index 01685bb346..587134fc03 100644
--- a/product/CMFActivity/skins/activity/SQLQueue_readMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLQueue_readMessage.zsql
@@ -13,7 +13,7 @@ to_date</params>
 SELECT * FROM
     message_queue
 WHERE
-    processing <> 1
+    processing = 0
 <dtml-if processing_node> 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 to_date> AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if>
diff --git a/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql b/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql
index d13fc826f9..87c0beb817 100644
--- a/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql
+++ b/product/CMFActivity/skins/activity/SQLQueue_readMessageList.zsql
@@ -15,7 +15,7 @@ to_date</params>
 SELECT * FROM
     message_queue
 WHERE
-    processing <> 1
+    processing = 0
 <dtml-if processing_node>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>
diff --git a/product/CMFActivity/skins/activity/SQLQueue_readUidList.zsql b/product/CMFActivity/skins/activity/SQLQueue_readUidList.zsql
index c12099e116..03bc775891 100644
--- a/product/CMFActivity/skins/activity/SQLQueue_readUidList.zsql
+++ b/product/CMFActivity/skins/activity/SQLQueue_readUidList.zsql
@@ -14,7 +14,7 @@ to_date</params>
 SELECT uid FROM
     message_queue
 WHERE
-    processing <> 1
+    processing = 0
 <dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"></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>
diff --git a/product/CMFActivity/skins/activity/SQLQueue_writeMessage.zsql b/product/CMFActivity/skins/activity/SQLQueue_writeMessage.zsql
index 6872c897f4..2b0c7791a0 100644
--- a/product/CMFActivity/skins/activity/SQLQueue_writeMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLQueue_writeMessage.zsql
@@ -26,7 +26,7 @@ SET
   processing_node = <dtml-sqlvar processing_node type="int">,
 </dtml-if>
   broadcast = <dtml-sqlvar broadcast type="int">,
-  processing = -1,
+  processing = 0,
   priority = <dtml-sqlvar priority type="int">,
   tag = <dtml-sqlvar tag type="string">,
   message = <dtml-sqlvar message type="string">
-- 
2.30.9