isn't sql case insensitie most of the time? Tuna Toksöz Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Sun, Jun 13, 2010 at 2:39 AM, Mike Christensen <[email protected]>wrote: > I need to lookup a user by Alias, however I need this to be case > insensitive. Basically I just need to know if the row exists or not. > Here's what I'm doing now: > > return (User.FindFirst(new > NHibernate.Criterion.InsensitiveLikeExpression("Alias", alias)) != > null); > > However, I don't like this because it's not gonna use any indexes. > I've created an index on LOWER(Alias), thus I want the query generated > to be: > > SELECT COUNT(*) FROM Users WHERE LOWER(Alias) = 'myvalue'; --This will > be very very fast. > > Any ideas on how to generate this query with ActiveRecord? Thanks!! > > Mike > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]<castle-project-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
