[jifty-devel] Using LIKE with ::Record ?

Ruslan Zakirov ruslan.zakirov at gmail.com
Tue Mar 6 11:22:15 EST 2007


On 3/6/07, mraptor <mraptor at gmail.com> wrote:
> I was hopping that ::Record will have something ;(, thanx
The record class represents a record in a DB, not a collection. All
load* methods in it are expecting that you would clever enough and use
unique groups of columns to load things, otherwise these methods don't
guaranty that you'll get always the same result using the same
arguments, for example you can shoot in your own leg by using
load_by_cols with "x = y" when x column is not unique. LIKE operator
allows multiple matches in a column it's applied to which makes
situation worser, that's why it's not implemented.

To do the right thing you have to use a collection with limit and most
probably order_by even if you need only a first record from a set that
matches your conditions.

>
> > Use RecordCollection and the limit method.  See
> >
> >      perldoc Jifty::DBI::Collection
> >
> > for more information.
> >
> > mraptor wrote:
> > > hi,
> > >
> > > Is there a way I can use LIKE when I search for a record instead of
> > > exact match used in ->load_by_cols()
> > >
> > > 10x
>
> --
> Gee I don't have signature
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>


-- 
Best regards, Ruslan.


More information about the jifty-devel mailing list