On 2010-10-02 17:16:20 -0700, Bill Moseley wrote:
> I'm wondering if find_or_create should throw an exception if a unique
> constraint does not exist or if the values passed to find_or_create do not
> include ALL the columns in the constraint.

I wrote some code long ago that attempted to do this (see
_is_unique_query in ResultSet.pm), but it breaks down on any sort of
complex query.  Anything with a join, for example, is hard to analyze
against unique constraints.

I'm actually surprised that code still lives in ResultSet.pm.  :)

The compromise was to have single return a warning when more than one
row is returned, gently nudging people to be more careful.

-- 
Daniel Westermann-Clark

_______________________________________________
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