David
David

Reputation: 16130

Help with Dialect file in NHibernate

I have begun creating a dialect for Interbase 7 in NHibernate.

Interbase SQL includes an operator CONTAINING 'foo' which is the equivalent of LIKE '%' + 'foo' + '%' in other flavours of SQL. LIKE is case sensitive in Interbase whereas CONTAINING is not, so I would like the dialect to translate LIKE situations to use CONTAINING instead.

I've had a really good look at example dialect files but I can't find anything relevant there. Can anyone provide any pointers?

Upvotes: 1

Views: 177

Answers (2)

Diego Mijelshon
Diego Mijelshon

Reputation: 52745

There's no way to replace internal uses of LIKE with CONTAINING (except patching NH).

You need to call CONTAINING explicitly. Once you've registered it, it's available as just another function in HQL, using Projections.SQLFunction in Criteria, and by writing the corresponding generator in LINQ (see http://fabiomaulo.blogspot.com/2010/07/nhibernate-linq-provider-extension.html)

Upvotes: 1

Yogee
Yogee

Reputation: 1462

You can use 'UPPER' to convert both side of the strings to Upper Case.

http://www.ibprovider.com/forum/site/viewtopic.php?f=3&t=24

Upvotes: 1

Related Questions