Github user rafaelweingartner commented on the pull request:

    https://github.com/apache/cloudstack/pull/775#issuecomment-138383672
  
    Tested on 4.3.2, and in that version this problem happens.
    I would say that calling a domain “%” sees odd, but in some cases I 
guess that might be needed. I tested the solution you proposed with squirrel 
SQL client, and that did not work out.
    
    Have you tested on your environment?
    
    In my database I created a domain called % and a subdomain called test, 
being /%/ the path of the parent domain and /%/test/ the path of the subdomain. 
Your change would generate an SQL such as this one (if I try to forcefully 
delete the domain %): 
    select * from domain where path like "%replace('/%/','%','[%]')%"
    
    I have not tested on my environment, but just by looking how the SQLs are 
generated and how the filter values are set (using prepared statements), that 
does not seem to work. I think the best way would be to use \, to escape the % 
character.
    
    Something like this I think would work:
    sc1.addAnd("path", SearchCriteria.Op.LIKE, "%" + 
StringUtils.replace(domainHandle.getPath(), "%", "\\%") + "%");  



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to