Hi Massimo,
it should be similar to the .contain() method. It allows to pass the 
"all=True" parameter. for checking more than a contains condition.

It could be something like (in dal.py):

In the class Expression(object):
        def like(self, value, caseInsensitive=True):
if caseInsensitive and self.db._adapter.__class__.__name__ == 
"PostgreSQLAdapter":
return Query(self.db, self.db._adapter.ILIKE, self, value)
else:
return Query(self.db, self.db._adapter.LIKE, self, value)

In the class PostgreSQLAdapter(BaseAdapter):
    def LIKE(self,first,second):
        return '(%s LIKE %s)' % 
(self.expand(first),self.expand(second,'string'))
    def ILIKE(self,first,second):
        return '(%s ILIKE %s)' % 
(self.expand(first),self.expand(second,'string'))

It would affect only the PostgreSQL Adapter and could be easily extended to 
the .startswith() and .endswith() methods for PostgreSQL that have the same 
behaviour.

I open an issue to track this propose as you suggested.

Bye,
Giovanni

Reply via email to