Commit 2c05c656 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 816473bb
SELECT <dtml-if uid_only>uid<dtml-else>uid,path</dtml-if> from catalog SELECT <dtml-if uid_only>uid<dtml-else>uid,path</dtml-if> from catalog
WHERE WHERE
1 = 1
<dtml-if path>
AND <dtml-sqltest path op=eq type="string">
</dtml-if>
<dtml-if path_list> <dtml-if path_list>
AND path IN (<dtml-in path_list><dtml-sqlvar sequence-item type="string"> 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>
<dtml-sqltest path op=eq type="string">
LIMIT 1
</dtml-if> </dtml-if>
SELECT <dtml-if path_only>path<dtml-else>uid,path</dtml-if> from catalog SELECT <dtml-if path_only>path<dtml-else>uid,path</dtml-if> from catalog
WHERE WHERE
1 = 1
<dtml-if expr="uid is not None">
AND <dtml-sqltest uid op=eq type="int">
</dtml-if>
<dtml-if uid_list> <dtml-if uid_list>
AND uid IN (<dtml-in uid_list><dtml-sqlvar sequence-item type="int"> 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>
<dtml-sqltest uid op=eq type="int">
LIMIT 1
</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