[Dbix-class] DBIx::Class::ResultSet::RecursiveUpdate - announcement and RFC

Zbigniew Lukasiak zzbbyy at gmail.com
Sun Sep 28 16:17:33 BST 2008


On Sun, Sep 28, 2008 at 3:20 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Sat, Sep 27, 2008 at 07:52:35PM +0200, Zbigniew Lukasiak wrote:
>> Hi Matt,
>>
>> On Sat, Sep 27, 2008 at 6:50 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
>> > On Tue, Sep 23, 2008 at 01:35:03PM +0200, Zbigniew Lukasiak wrote:
>> >> Unlike the original update_or_create - recursive_update works for
>> >> tables with auto_increment primary keys
>> >
>> > Please stop referring to "doesn't accept undef for auto-inc like MySQL does"
>> > as broken.
>>
>> I understand your sensitivity - I only wanted to express the fact that
>> you cannot use update_or_create with tables with auto_increment
>> primary keys.
>
> I do so fine. I just don't pass the PK if I don't have one.

update_or_create relies on find - if you don't pass the PK - then find
will issue an unrestricted search and return a random row (and issue
the warning), then that random row will be updated, create will never
be called.  This is assuming you add { key => primary} - if you don't
do that then find will fall back to the old behaviour and also return
a random row.

>
> Just because your code is buggy and passes undef doesn't mean it doesn't work
> if you do it properly.

No comment


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



More information about the DBIx-Class mailing list