[Dbix-class] discard_changes upgrade.

Vladimir Timofeev vovkasm at gmail.com
Sun Apr 13 12:32:57 BST 2008


On Sun, Apr 13, 2008 at 5:15 AM, Jonathan Rockway <jon at jrock.us> wrote:
> * On Sat, Apr 12 2008, Vladimir Timofeev wrote:
>
>  > +    my $hash_ref = $rs->find({
>
> > +        map { $_ => $self->get_column($_) } $self->primary_columns,
>  > +    }, $attrs);
>  > +
>  > +    $self->set_columns($hash_ref);
>  > +    delete $self->{_dirty_columns};
>
>  Is this the only way to do this?  There is an irritating race condition
>  where the record can go away between initially fetching it and then
>  refreshing it.  I don't know if much can be done about that (other than
>  caching the initial state in the row object), but it might be exception
>  worthy instead of the current code's strategy of just set_columns-ing
>  nothing (and then erasing the dirty bit).
May be simple set in_storage to false and don't touch any data?
Exception will thrown by near update method call.
Any suggestions?

>
>  Also, I object to a variable named $hash_ref :P
;-) thanks, this should be renamed in next patch

>
>  Regards,
>  Jonathan Rockway
>
>  --
>  print just => another => perl => hacker => if $,=$"
>
>
>
>  _______________________________________________
>  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/dbix-class@lists.rawmode.org
>



More information about the DBIx-Class mailing list