Commit 23abd822 authored by Sebastien Robin's avatar Sebastien Robin

updated SQLQueue zsql methods in order to support more validation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1787 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 81a48125
...@@ -10,16 +10,20 @@ class_file: ...@@ -10,16 +10,20 @@ class_file:
<params></params> <params></params>
CREATE TABLE `message_queue` ( CREATE TABLE `message_queue` (
`uid` int(11) NOT NULL auto_increment, `uid` int(11) NOT NULL auto_increment,
`date` datetime,
`path` VARCHAR(255), `path` VARCHAR(255),
`method_id` VARCHAR(40), `method_id` VARCHAR(40),
`processing_node` INT DEFAULT -1, `processing_node` INT DEFAULT -1,
`processing` INT DEFAULT 0, `processing` INT DEFAULT 0,
`processing_date` datetime,
`priority` INT DEFAULT 0, `priority` INT DEFAULT 0,
`message` BLOB, `message` BLOB,
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `date` (`date`),
KEY `path` (`path`), KEY `path` (`path`),
KEY `method_id` (`method_id`), KEY `method_id` (`method_id`),
KEY `processing_node` (`processing_node`), KEY `processing_node` (`processing_node`),
KEY `processing` (`processing`), KEY `processing` (`processing`),
KEY `processing_date` (`processing_date`),
KEY `priority` (`priority`) KEY `priority` (`priority`)
) TYPE = InnoDB; ) TYPE = InnoDB;
...@@ -11,6 +11,7 @@ class_file: ...@@ -11,6 +11,7 @@ class_file:
UPDATE UPDATE
message_queue message_queue
SET SET
processing_date = <dtml-sqlvar "_.DateTime()" type="string">,
processing=1 processing=1
WHERE WHERE
uid = <dtml-sqlvar uid type="int"> uid = <dtml-sqlvar uid type="int">
...@@ -8,10 +8,15 @@ class_name: ...@@ -8,10 +8,15 @@ class_name:
class_file: class_file:
</dtml-comment> </dtml-comment>
<params>processing_node <params>processing_node
priority</params> priority
to_date</params>
SELECT * FROM SELECT * FROM
message_queue message_queue
WHERE WHERE
processing <> 1 processing <> 1
<dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"></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> <dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if>
<dtml-if to_date> AND date <= <dtml-sqlvar to_date type="string"> </dtml-if>
ORDER BY
priority, date
...@@ -9,10 +9,12 @@ class_file: ...@@ -9,10 +9,12 @@ class_file:
</dtml-comment> </dtml-comment>
<params>processing_node <params>processing_node
method_id method_id
path</params> path
to_date</params>
SELECT uid FROM SELECT uid FROM
message_queue message_queue
WHERE WHERE
processing <> 1 processing <> 1
<dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"></dtml-if> <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 path>AND path = <dtml-sqlvar path type="string"></dtml-if>
\ No newline at end of file <dtml-if to_date>AND date <= <dtml-sqlvar to_date type="string"> </dtml-if>
...@@ -8,11 +8,13 @@ class_name: ...@@ -8,11 +8,13 @@ class_name:
class_file: class_file:
</dtml-comment> </dtml-comment>
<params>uid <params>uid
priority</params> priority
date</params>
UPDATE UPDATE
message_queue message_queue
SET SET
priority = <dtml-sqlvar priority type="int">, priority = <dtml-sqlvar priority type="int">,
processing = 0 processing = 0,
date = <dtml-sqlvar date type="string">
WHERE WHERE
uid = <dtml-sqlvar uid type="int"> uid = <dtml-sqlvar uid type="int">
...@@ -10,10 +10,12 @@ class_file: ...@@ -10,10 +10,12 @@ class_file:
<params>path <params>path
method_id method_id
message message
priority</params> priority
date</params>
INSERT INTO message_queue INSERT INTO message_queue
SET SET
path = <dtml-sqlvar path type="string">, path = <dtml-sqlvar path type="string">,
<dtml-if date>date = <dtml-sqlvar date type="string">, <dtml-else>date = <dtml-sqlvar "_.DateTime()" type="string">, </dtml-if>
method_id = <dtml-sqlvar method_id type="string">, method_id = <dtml-sqlvar method_id type="string">,
processing_node = -1, processing_node = -1,
processing = -1, processing = -1,
......
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