[Dbix-class] possible bug in DBIx::Class::Row
Matt S Trout
dbix-class at trout.me.uk
Wed May 13 16:25:56 GMT 2009
On Wed, May 13, 2009 at 02:18:15PM +0400, Oleg Pronin wrote:
> in DBIx::Class::Row::insert
>
> if(!$self->{_rel_in_storage}) {
> #heavy code
> }
>
> #insert code
>
>
> Example:
>
> $obj1 = $rs->new({...});
> $obj2 = $obj1->new_related('abc', {..});
>
> $obj1->insert; #ok
>
> #this cause 'heavy code' to execute because $self->{_rel_in_storage}
> is undefined although $obj1 has been inserted in previous line
> $obj2->insert;
>
>
> I think _rel_in_storage should be updated when related object is
> inserted or should be evaluated at insert
I'd call this a performance pessimisation rather than a bug, but I do see
what you mean. If you modify the code to set _rel_in_storage there, do any
of the tests fail?
--
Matt S Trout Catalyst and DBIx::Class consultancy with a clue
Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
mst (@) shadowcat.co.uk http://shadowcat.co.uk/blog/matt-s-trout/
More information about the DBIx-Class
mailing list