Commit dcbb8ba6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Eteri

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