In the attachments you'll find  DBIx::Class::ResultSet::RecursivePUT -
it is a base class for ResultSets and it provides just one method:
recursive_PUT which works just like update_or_create - but can update
a whole tree of related records.  I wrote it as a method for REST PUT
operations, i.e. creating and updating complex objects.  There is one
more difference from update_or_create - it will work on tables with
auto_increment primary keys - you just need to set the key to 'undef'
- then it will be deleted from the INSERT sent to the database (this
will only happen for auto_increment keys - other columns will be set
to 'NULL' just as usual).  This is additional complexity of the
semantics - but with the benefit of more universal and uniform usage.

I am waiting for comments - especially about the names - and also
about the interface.  I am thinking that perhaps the object oriented
interface creates too much hassle for the programmer as it requires to
explicitly set up the ResultSet classes - while normally they can be
omitted.  So maybe I should change the interface to a simple
procedural interface and change $rs->recursive_PUT( $update_hash ) to
recursive_PUT( $rs, $update_hash).  What do you think?  Any other
comments are welcome as well.

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

Attachment: DBIx-Class-ResultSet-RecursivePUT-0.0.1.tar.gz
Description: GNU Zip compressed data

_______________________________________________
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