Re: Search for specific field rather than primary key

[prev] [thread] [next] [Date index for 2004/08/13]

From: Dana Hudes
Subject: Re: Search for specific field rather than primary key
Date: 14:21 on 13 Aug 2004

On Fri, 13 Aug 2004, Caroline Johnston wrote:

> On Thu, 12 Aug 2004, Perrin Harkins wrote:
> 
> > On Thu, 2004-08-12 at 15:54, Kevin Old wrote:
> > > I'd still be interested in knowing if there's a way I can edit the
> > > Essentail column group even though I use C::DBI::AutoLoader.
> > 
> > I don't use C::DBI::AutoLoader, but I think you can just call the
> > columns() method on your class normally after AutoLoader creates it for
> > you.


Watch out -- the column groups are hashes. columns doesn't append to those 
hashes, it *assigns* to them. The result is that whatever was there before 
gets clobbered. Therefore even when you have manually specified the table 
class and its column groups you may not have more than one invocation of 
columns for a particular group.

__PACKAGE__->columns(Essential =>qw/foo bar/);
__PACKAGE__->columns(Essential =>qw/baz/);

results in no column group registration at all for foo and bar -- and 
therefore they don't ever get retrieved from the dbms nor do values 
in foo or bar get written to the dbms. If you have NOT NULL in your 
modifiers for foo or bar then you will get a backend error objecting to 
your not providing a value for the NOT NULL column.

This also results in your inability to inherit columns from a parent class 
-- you get the methods but the relevant parent class metadata gets 
clobbered in the child.
 
> > > > On a similar note - how would I go about adding extra methods to
> AutoLoader generated classes?

that at least is the same as any other package. There is no requirement 
that all code for a package is in an unbroken block.

	package foo


	package bar

	package foo

works.


> 
> Cheers,
> 
> Cass.
> 
> 

(message missing)

Re: Search for specific field rather than primary key
Dana Hudes 14:21 on 13 Aug 2004

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