Re: abstract class with Class::DBI

[prev] [thread] [next] [Date index for 2004/10/21]

From: William McKee
Subject: Re: abstract class with Class::DBI
Date: 18:54 on 21 Oct 2004
On Thu, Oct 21, 2004 at 03:41:38PM +0100, Tony Bowden wrote:
> On Thu, Oct 21, 2004 at 09:00:45AM -0400, William McKee wrote:
> >   *NOTE* You should not attempt to make your primary key column inflate
> >   using has_a() as bad things will happen. If you have two tables which
> >   share a primary key, consider using might_have() instead.
> > 
> > I was hoping that one of the developers would say something about your
> > statement. I don't think that setting a has_a relationship on a primary
> > key is the same as inflating it. I use this setup all the time and have
> > not seen problems.
> 
> It is the same. That's what the docs mean. 

But the docs also say that the purpose of the has_a relationship is to
link a foreign key to a primary key. You even have an example of this
use in the Synopsis. If using has_a causes inflation then I'd suggest
that the warning needs to be reworded so as to be more specific about
what to avoid.


> In general it shouldn't cause a problem if the resulting inflated object
> stringifies to the value you want to appear in the database. If,
> however, you're inflating something like a date, which usually won't
> stringify the way you want, you'll have problems.

That answers the problem which Tom demonstrated in some test code that
he sent to me. He had changed the Stringify column of a class which had
a has_a relation. This causes bad things to happen as he reported.


> There were also problems with DBD::Pg not working correctly in some
> cases, but I believe this may be fixed now.

If the patch that Tim supplied is in place, these problems will go away.


William

        -- 
        Knowmad Services Inc.
http://www.knowmad.com

(message missing)

abstract class with Class::DBI
Edward Betts 15:09 on 20 Oct 2004

Re: abstract class with Class::DBI
Tom Hukins 16:40 on 20 Oct 2004

Re: abstract class with Class::DBI
William McKee 13:00 on 21 Oct 2004

Re: abstract class with Class::DBI
Tom Hukins 14:17 on 21 Oct 2004

Re: abstract class with Class::DBI
Perrin Harkins 16:09 on 22 Oct 2004

Re: abstract class with Class::DBI
Tony Bowden 14:41 on 21 Oct 2004

Re: abstract class with Class::DBI
William McKee 18:54 on 21 Oct 2004

Re: abstract class with Class::DBI
Michael 19:17 on 21 Oct 2004

Re: abstract class with Class::DBI
Andreas Fromm 07:00 on 21 Oct 2004

Re: abstract class with Class::DBI
William McKee 19:42 on 21 Oct 2004

Re: abstract class with Class::DBI
Kingsley Kerce 20:01 on 21 Oct 2004

Re: abstract class with Class::DBI
Perrin Harkins 16:14 on 22 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52