If you want, you can implement your own function and the corresponding criteria. Inherit from a dialect and register the function and using SqlFunctionCriteria it is possible. (not sure about the names and the like, because it's been more than 1 year)
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 10:43 AM, Mike Christensen <[email protected]>wrote: > So something like this? > > return (new Castle.ActiveRecord.Queries.SimpleQuery<User>("FROM User u > WHERE LOWER(u.Alias) = ?", a)).Execute().Length != 0; > > This seems to work, thanks!! > > Mike > > On Sat, Jun 12, 2010 at 8:15 PM, Gauthier Segay > <[email protected]> wrote: > > Hi, > > > > I don't have an answer for criteria API, but I'm pretty sure hql query > > would allow you to use any vendor specific function (lower being > > supported by most of the sql databases) > > > > from User u where u.Alias = lower(:alias) > > > > last sample on this post describe this: > > > > > http://ayende.com/Blog/archive/2006/10/01/UsingSQLFunctionsInNHibernate.aspx > > > > On Jun 12, 7:17 pm, Mike Christensen <[email protected]> wrote: > >> For the sake of the question, let's just assume my DB is > >> case-sensitive. FYI, I'm using Postgres 8.3.4 which is always > >> case-sensitive (as far as I know).. > >> > >> Mike > >> > >> On Sat, Jun 12, 2010 at 7:14 PM, Patrick Steele > >> > >> > >> > >> <[email protected]> wrote: > >> > It depends on the server. Well, in MS SQL Server 6 and I think up to > >> > 7 it was server-specific (you could define case sensitive or > >> > case-insensitive). Starting with SQL 2000, it could be done on a > >> > per-database setting. > >> > >> > --- > >> > Patrick Steele > >> >http://weblogs.asp.net/psteele > >> > >> > On Sat, Jun 12, 2010 at 8:41 PM, Tuna Toksoz <[email protected]> > wrote: > >> >> 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]<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]<castle-project-users%[email protected]> > . > >> > For more options, visit this group athttp:// > 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]<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]<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.
