John Napiorkowski wrote:
> Looks like I was having some sort of mental block the
> other night. I got the following to work properly:
>
> my $video_rs = $self->find({video_id=>$video_id});
> return ( defined($video_rs) ? 1 : 0 );
>
> and it did what I wanted.
>
> I have to specify the key name in find since my table
> has multiple primary keys. I've also found that since
> ->find works for any column marked as unique it has
> really improved my thinking about my table designs,
> since I am more careful to normalize properly to get
> more truly unique columns. So in this way I am sure
> DBIx has improved my table designs.
Note that find is always a 0 or 1 record query (or should be), so it returns a
row object of the appropriate class, not a resultset.
--
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/ +
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/