Skip Menu |

This queue is for tickets about the DBIx-Class-ResultSet-RecursiveUpdate CPAN distribution.

Report information
The Basics
Id: 57553
Status: resolved
Priority: 0/
Queue: DBIx-Class-ResultSet-RecursiveUpdate

People
Owner: Nobody in particular
Requestors: martin.rusko [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Changes between 0.12 and 0.13
Date: Mon, 17 May 2010 14:50:36 +0200
To: bug-DBIx-Class-ResultSet-RecursiveUpdate [...] rt.cpan.org
From: Martin Rusko <martin.rusko [...] gmail.com>
Hi, I've noticed that since upgrade from 0.12 version to 0.13 version database is not being updated if column referencing another table is set to null. I'm using HTML-FormHandler module together with HTML-FormHandler-Model-DBIC which uses RecursiveUpdate to update database rows. There is table 'sites' which can refer to table 'contacts', but not necessarily (is_nullable) ... "contact_id", { data_type => "integer", default_value => undef, is_foreign_key => 1, is_nullable => 1, }, __PACKAGE__->belongs_to( "contact", "ZoneDB::Schema::Result::Contact", { contact_id => "contact_id" }, { join_type => "LEFT" }, ); If I choose in form "empty_value", in object values contact is null. But it looks like RecursiveUpdate don't consider object being changed or what, and with recent change the row won't get updated ... @@ -107,8 +107,7 @@ # don't allow insert to recurse to related objects - we do the recursion ourselves # $object->{_rel_in_storage} = 1; - $object->update_or_insert; - + $object->update_or_insert if $object->is_changed; # updating many_to_many for my $name ( keys %$updates ) { Is it really a bug or is it expected behavior, please? I'm bit lost. Thanks and Best Regards, Martin
RT-Send-CC: jjn1056 [...] yahoo.com
Hi there, On Mon May 17 08:58:20 2010, martin.rusko@gmail.com wrote: Show quoted text
> Hi, > > I've noticed that since upgrade from 0.12 version to 0.13 version
database Show quoted text
> is not being updated if column referencing another table is set to
null. I have to admit I did not put enough attention into these changes, but I hope John will follow with a more thorough answer. In general I think that setting relation => undef should 'unlink' the objects. So I added this: is( $might_have_cd_row->single_track, undef, 'Might have deleted' ); to check that that does indeed happen at the end of http://github.com/zby/DBIx--Class--ResultSet-- RecursiveUpdate/blob/master/t/96multi_create.t It would be great if you could provide us with a self contained test case. Cheers, Zbigniew
On Thu May 20 10:52:17 2010, ZBY wrote: Show quoted text
> Hi there, > > On Mon May 17 08:58:20 2010, martin.rusko@gmail.com wrote:
> > Hi, > > > > I've noticed that since upgrade from 0.12 version to 0.13 version
> database
> > is not being updated if column referencing another table is set to
> null. > > I have to admit I did not put enough attention into these changes, but I > hope John will follow with a more thorough answer.
Hey, I made this change originally to support optional relationships; I guess I was assuming if there was no value that meant the optional was missing. Myself I never use nullable columns so this wasn't a case I'd think of. If you can put a failing test into the repo and message me on #formhandler (irc.perl.org) I'll be happy to take a look Show quoted text
> > In general I think that setting relation => undef should 'unlink' the > objects. So I added this: > > is( $might_have_cd_row->single_track, undef, 'Might have deleted' ); > > to check that that does indeed happen at the end of > http://github.com/zby/DBIx--Class--ResultSet-- > RecursiveUpdate/blob/master/t/96multi_create.t > > It would be great if you could provide us with a self contained test > case. > > Cheers, > Zbigniew > >
Please test again with version 0.20 and report back if it still fails.
closing this ticket after not getting a response for over three month.