Re: [CDBI] Simple join

[prev] [thread] [next] [Date index for 2005/12/30]

From: Peter Speltz
Subject: Re: [CDBI] Simple join
Date: 20:13 on 30 Dec 2005
On 12/30/05, Jon Molin <jon.molin@xxxxx.xxx> wrote:
>
>
> On 12/30/05, Peter Speltz <peterspeltz@xxxxx.xxx> wrote:
> > On 12/29/05, Jon Molin <jon.molin@xxxxx.xxx> wrote:
> > > Hi list,
> > >
> > >  I've just started looking at Class:DBI after only using DBI directly
> with
> > > own written sql. I've read through the beginners guide and there's on=
e
> thing
> > > I wonder about:
> > >
> > >  In the search_like example:
> > >  my @cd =3D Music::CD->search_like(title =3D> 'Hits%', artist =3D>
> 'Various%');
> > >
> > >  It searches for "cd.title like 'Hits%' or artist.name like 'Varios%'=
"?
> I
> > > can't really understand how to make a  relationship that makes such a
> join.
> > > I need one of them with a similar db but can't find examples except t=
his
> in
> > > the documentation.
> >
> >
> > Why did you pick the 'name' column from artist?   I think artist is  a
> > field in CD. The above searches  CD  "WHERE cd.artist LIKE  'Various%'
> > AND cd.title LIKE 'Hits%'.     If it does as you thought  that would
> > be pretty magical and downright amazing as how would it know to look
> > in artist.name or artist.id or whatever. I guess it could look in all
> > fields of artist however I think the search method is intended to be
> > more exact than that. At least you tell it exactly what fields to
> > search on.
>
>
>  Yes I know it'd be magical if it was the artist.name field it was lookin=
g
> in, but looking at the table def cd has no text field which would match
> 'Various%' and the only text field in Artist is name, that's why I assume=
d
> that's the field they are using.
>
>
> > From right above your example in the docs it says ;
> >
> > "This is a simple search for all objects where the columns specified
> > are like the values specified."
>
>  Yes I know of that and it confuses me :) There is no column artist in th=
e
> database the examples are using. I guess this example isn't at all relate=
d
> to the database.
>

Ahh, so you were paying to close attention . I did not mean to accuse
you of the opposite.

> > I'm glad to see I am not the only one who misses things right on the
> > screen in front of them Today was one of those days for me where I
> > swore I read something one way but it turned out I did not. It cost me
> > several hours of messing around. Finally someone else had a look and
> > saw my typo right away.  I'm going to increase the size of my text on
> > my screen :)
>
>  I know that feeling :)

Thanks for sympathizing. I feel better.

> > Oh yeah. Check out Class;;DBI::Sweet for joins and search functionality=
 .
>

Come to think of it , it would be pretty cool to have it Magical like
you were thinking.  Maybe it would search artist table where the
stringified version of of the object was like 'Various'.  I bet Sweet
does something like this.  I may try it soon.




--
pjs

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

[CDBI] Simple join
Jon Molin 00:16 on 30 Dec 2005

Re: [CDBI] Simple join
Peter Speltz 20:13 on 30 Dec 2005

Generated at 01:21 on 10 Jan 2006 by mariachi v0.52