I don't mind to write the patch, Matt. Do you have something like http://search.cpan.org/~timb/DBI-1.48/DBI.pm#How_to_create_a_patch_without_S ubversion to get me started?
Cheers, John (Zhuang) Li -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt S Trout Sent: Tuesday, May 23, 2006 3:50 PM To: [email protected] Subject: Re: [Dbix-class] update_or_insert from hash reference John Li wrote: >> Will it use the primary key as declared in Users.pm? Or >> should I have to pass it as an extra attribute to the search >> call? (i.e. as in ->search( hashRef, { key => user_id } ) ) >> I've already tried this and it didn't work ... but maybe I'm >> doing something wrong (again). >> > my $user = $dbix->resultset('Users')->update_or_create($hashref); > > :) > > Just curious, Matt, why delete doesn't work the same way? > i.e. $dbix->resultset('Users')->delete($hashref) instead of > $dbix->resultset('Users')->search($hashref)->delete? update_or_create is a row-level operation that gets performed in the context of a resultset; $rs->delete is a resultset-level operation. I don't see any particular reason not to support ->delete($cond) though (probably by just expanding it internally to ->search($cond)->delete), but somebody else gets to write up the test cases and patch :) _______________________________________________ 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/ _______________________________________________ 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/
