On 2006-04-10 07:11:38 +0000, fayland wrote:
> when calling update_or_create, I want to know it's "create" or
> "update" since I want to do different thing according to different
> type. such as not + 1 if it's an "update" and +1 if it's a "create".

update_or_create is designed to be a black box in this respect.  Once
I finish my changes to find (so it searches constraints the same way
update_or_create does now), you'll be able to do your own checks:

my $row = $rs->find(...);
if (defined $row) {
  $row->set_columns(...);
  $row->update;
}
else {
  $row = $rs->create(...);
}

Making update_or_create work differently than other ResultSet methods
that return a Row doesn't seem conducive to a clean API.

-- 
Daniel Westermann-Clark

_______________________________________________
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/

Reply via email to