Predicate Case

Posts   
 
    
Posts: 11
Joined: 29-Mar-2005
# Posted on: 14-Jun-2005 17:30:48   

I'm trying to do a search on a name in Oracle. Is there a way to force the predicates to search on upper or lower case of the db field?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Jun-2005 18:05:20   

With LIKE? Yes, see: Using the generated code -> Adapter/selfservicing -> Filtering and sorting -> FieldLikePredicate

Frans Bouma | Lead developer LLBLGen Pro
Posts: 11
Joined: 29-Mar-2005
# Posted on: 14-Jun-2005 19:41:06   

Even the LIKE in oracle is case sensitive. I can't figure out a case insensitive search.

The documentation states the following, but I don't see the CaseSensitiveCollation property:

FieldLikePredicate Description compares the entity field specified with the pattern specified, using the LIKE operator. The pattern should contain the wildcard, which is '%' (also for MS Access). FieldLikePredicate performs a LIKE compare using the case sensitivity setting of the database system the query is executed on: the SQL generated does not contain any collation information nor any case insensitive setting if the database is using case sensitive comparison operations by default (Oracle, some SqlServer installations). You can perform case insensitive compares however, if the database is case sensitive, by setting the CaseSensitiveCollation property to true prior to passing the predicate to a fetch method like GetMulti(). This will perform the UPPERCASE variant of the field with the pattern specified.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Jun-2005 20:21:54   

crazylittlemonkeys wrote:

Even the LIKE in oracle is case sensitive. I can't figure out a case insensitive search.

The documentation states the following, but I don't see the CaseSensitiveCollation property:

FieldLikePredicate Description compares the entity field specified with the pattern specified, using the LIKE operator. The pattern should contain the wildcard, which is '%' (also for MS Access). FieldLikePredicate performs a LIKE compare using the case sensitivity setting of the database system the query is executed on: the SQL generated does not contain any collation information nor any case insensitive setting if the database is using case sensitive comparison operations by default (Oracle, some SqlServer installations). You can perform case insensitive compares however, if the database is case sensitive, by setting the CaseSensitiveCollation property to true prior to passing the predicate to a fetch method like GetMulti(). This will perform the UPPERCASE variant of the field with the pattern specified.


FieldLikePredicate likeFilter=PredicateFactory.Like(OrderFieldIndex.CustomerID, "CH%");
likeFilter.CaseSensitiveCollation = true;

Frans Bouma | Lead developer LLBLGen Pro