On Fri, Sep 28, 2007 at 03:11:33PM +0400, dreel wrote:
> 
> As I know the query joining two or more tables automatically creates 
> accessors for main table columns  and other can be reached through 
> $rs->get_column('col_name'). 
> I'm using  get_column('col_name') for all columns even for main table columns 
> asn it's working fine.
> The question is why a part of columns get accessors automatially and other 
> must be accessed manualy?

If it's declared with add_columns an accessor is created for it. When you do
a join you should access columns in foreign tables through the relationships.

$cd->artist->name

and similar, rather than trying to force DBIC to bring the artist name in and
doing $cd->get_column('name')

> May be better to make automatic accessor creation for any column returned of 
> defined in query?

If you use DBIC properly you almost never need get_column.

Generating random methods on the fly is inefficient and can cause subtle bugs.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to