Commit 8c5657a9 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a new parameter controling the index increment.

Add default values on parameters to make the query backward-compatible (provided that arguments are not passed by position).
Wrap query line to make it more readable.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13734 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cf5fbcfe
......@@ -36,6 +36,25 @@
<key> <string>default</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>int</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id_count</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>int</string> </value>
......@@ -56,8 +75,9 @@
<key> <string>_keys</string> </key>
<value>
<list>
<string>id_group</string>
<string>default</string>
<string>id_group</string>
<string>id_count</string>
<string>default</string>
</list>
</value>
</item>
......@@ -69,7 +89,8 @@
<item>
<key> <string>arguments_src</string> </key>
<value> <string>id_group\r\n
default:int</string> </value>
id_count:int=1\r\n
default:int=1</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
......@@ -88,7 +109,12 @@ default:int</string> </value>
\n
BEGIN\n
<dtml-var sql_delimiter>\n
INSERT INTO portal_ids (`id_group`, `last_id`) VALUES (<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar default type="int">)) ON DUPLICATE KEY UPDATE `last_id` = LAST_INSERT_ID(`last_id` + 1)\n
INSERT INTO\n
portal_ids (`id_group`, `last_id`)\n
VALUES\n
(<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar default type="int">))\n
ON DUPLICATE KEY UPDATE\n
`last_id` = LAST_INSERT_ID(`last_id` + <dtml-sqlvar id_count type="int">)\n
<dtml-var sql_delimiter>\n
SELECT LAST_INSERT_ID()
......@@ -133,7 +159,12 @@ SELECT LAST_INSERT_ID()
\n
BEGIN\n
<dtml-var sql_delimiter>\n
INSERT INTO portal_ids (`id_group`, `last_id`) VALUES (<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar default type="int">)) ON DUPLICATE KEY UPDATE `last_id` = LAST_INSERT_ID(`last_id` + 1)\n
INSERT INTO\n
portal_ids (`id_group`, `last_id`)\n
VALUES\n
(<dtml-sqlvar id_group type="string">, LAST_INSERT_ID(<dtml-sqlvar default type="int">))\n
ON DUPLICATE KEY UPDATE\n
`last_id` = LAST_INSERT_ID(`last_id` + <dtml-sqlvar id_count type="int">)\n
<dtml-var sql_delimiter>\n
SELECT LAST_INSERT_ID()
......
35
\ No newline at end of file
36
\ No newline at end of file
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