[Catalyst] Class::DBI::Sweet search method error?

Matt S Trout dbix-class at trout.me.uk
Wed Apr 5 12:51:33 CEST 2006


Maxim Nechaev wrote:
> Hi.
> Maybe this wrong list for my question but SUPPORT section of `perldoc
> Class::DBI::Sweet` point on it.
> 
> I have some Class::DBI based module with own column accessor names:
> package UserAgent;
> use base 'Class::DBI';
> ....
> __PACKAGE__->columns
> (
>     'Essential', 
>     Class::DBI::Column->new(txtLog   => {accessor => 'log'  }),
>     Class::DBI::Column->new(intCount => {accessor => 'count'}),
>     Class::DBI::Column->new(lstType  => {accessor => 'type' }),
>     Class::DBI::Column->new(lstName  => {accessor => 'name' }),
> );
> 
> Search and access through modified accessors work fine:
> my @mobileAgents = UserAgent->search(type => 'mobile');
> print $mobileAgents[0]->name;
> 
> But if i try switch base module to Class::DBI::Sweet i get error message
> in search method: "DBD::mysql::st execute failed: Unknown column
> 'me.type' in 'where clause'" When i change to real column name "lstType"
> all works again. Look like "Class::DBI::Sweet" ignore customized columns
> accessors. Is there any work arounds for this? Can i have different
> column names in my table and in my "Class::DBI::Sweet" class?

Nope. Sweet doesn't support that, and new development on it is basically dead 
because the people who did develop on it shifted to DBIx::Class for the sake 
of what little sanity we have left.

If you'd be interested in adding this I'm sure we could sort you out with the 
ability to get a patch in though.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list