You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Arturo Perez <pe...@gsicommerce.com> on 2011/09/15 14:10:27 UTC
case insensitive =?
Hi all,
Using Postgresql 9.0 and Cayenne 3.0.2.
I've googled and googled but can't find the right search to answer this
question.
I would like to perform a query that has the equivalent of a case
insensitive search. Outside of configuring collation etc I've always
done it by doing something like
select col,a,b,c from x where upper(col) = upper($parm)
Any way of doing the equivalent using Expression? Or would I have to
use SQLTemplate?
Alternatively, are there any dangers to using likeIgnoreCase if I can be
100% certain that $parm will never contain any SQL wildcards? Seems
that query runtime is a little slower that =.
Another idea is to write my own Expression for that. Would that be hard?
tia,
arturo
Re: case insensitive =?
Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 15/09/11 10:10 PM, Arturo Perez wrote:
> Alternatively, are there any dangers to using likeIgnoreCase if I can be
> 100% certain that $parm will never contain any SQL wildcards? Seems
> that query runtime is a little slower that =.
I can't imagine that there would be any measurable difference in the database speed of a LIKE query (with no wildcards) and an = query. You may be over-optimising this bit of code. Perhaps you could run some tests and report back here on the difference.
--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
Re: case insensitive =?
Posted by Arturo Perez <pe...@gsicommerce.com>.
In article
<CA...@mail.gmail.com>,
Michael Gentry <mg...@masslight.net> wrote:
> Hi Arturo,
>
> Look at using Expression.fromString() with the likeIgnoreCase operator:
>
> http://cayenne.apache.org/doc30/building-expressions.html
>
> mrg
Yes, I did mention the likeIgnoreCase in my post ;-) But I want equals
not like.
Besides the wildcard issue, am I wrong in thinking that like is slower?
>
>
> On Thu, Sep 15, 2011 at 8:10 AM, Arturo Perez <pe...@gsicommerce.com> wrote:
> > Hi all,
> >
> > Using Postgresql 9.0 and Cayenne 3.0.2.
> >
> > I've googled and googled but can't find the right search to answer this
> > question.
> >
> > I would like to perform a query that has the equivalent of a case
> > insensitive search. �Outside of configuring collation etc I've always
> > done it by doing something like
> >
> > � � � select col,a,b,c from x where upper(col) = upper($parm)
> >
> > Any way of doing the equivalent using Expression? �Or would I have to
> > use SQLTemplate?
> >
> > Alternatively, are there any dangers to using likeIgnoreCase if I can be
> > 100% certain that $parm will never contain any SQL wildcards? �Seems
> > that query runtime is a little slower that =.
> >
> > Another idea is to write my own Expression for that. �Would that be hard?
> >
> > tia,
> > arturo
> >
> >
Re: case insensitive =?
Posted by Michael Gentry <mg...@masslight.net>.
Hi Arturo,
Look at using Expression.fromString() with the likeIgnoreCase operator:
http://cayenne.apache.org/doc30/building-expressions.html
mrg
On Thu, Sep 15, 2011 at 8:10 AM, Arturo Perez <pe...@gsicommerce.com> wrote:
> Hi all,
>
> Using Postgresql 9.0 and Cayenne 3.0.2.
>
> I've googled and googled but can't find the right search to answer this
> question.
>
> I would like to perform a query that has the equivalent of a case
> insensitive search. Outside of configuring collation etc I've always
> done it by doing something like
>
> select col,a,b,c from x where upper(col) = upper($parm)
>
> Any way of doing the equivalent using Expression? Or would I have to
> use SQLTemplate?
>
> Alternatively, are there any dangers to using likeIgnoreCase if I can be
> 100% certain that $parm will never contain any SQL wildcards? Seems
> that query runtime is a little slower that =.
>
> Another idea is to write my own Expression for that. Would that be hard?
>
> tia,
> arturo
>
>