Commit 69d01195 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_mysql_innodb_catalog: add safety LIMIT in z_getitem_by_path and...

erp5_mysql_innodb_catalog: add safety LIMIT in z_getitem_by_path and z_getitem_by_uid to avoid fetching all rows in case of empty argument.
parent 63d415ab
...@@ -3,8 +3,11 @@ WHERE ...@@ -3,8 +3,11 @@ WHERE
1 = 1 1 = 1
<dtml-if path> <dtml-if path>
AND <dtml-sqltest path op=eq type="string"> AND <dtml-sqltest path op=eq type="string">
</dtml-if> LIMIT 1
<dtml-if path_list> <dtml-elif path_list>
AND path IN (<dtml-in path_list><dtml-sqlvar sequence-item type="string"> AND path IN (<dtml-in path_list><dtml-sqlvar sequence-item type="string">
<dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>) <dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>)
LIMIT <dtml-sqlvar expr="len(path_list)" type="int">
<dtml-else>
LIMIT 0
</dtml-if> </dtml-if>
...@@ -3,8 +3,11 @@ WHERE ...@@ -3,8 +3,11 @@ WHERE
1 = 1 1 = 1
<dtml-if expr="uid is not None"> <dtml-if expr="uid is not None">
AND <dtml-sqltest uid op=eq type="int"> AND <dtml-sqltest uid op=eq type="int">
</dtml-if> LIMIT 1
<dtml-if uid_list> <dtml-elif uid_list>
AND uid IN (<dtml-in uid_list><dtml-sqlvar sequence-item type="int"> AND uid IN (<dtml-in uid_list><dtml-sqlvar sequence-item type="int">
<dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>) <dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>)
LIMIT <dtml-sqlvar expr="len(uid_list)" type="int">
<dtml-else>
LIMIT 0
</dtml-if> </dtml-if>
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