[Dbix-class] Refreshing object's data from database && row-level locking

Matt S Trout dbix-class at trout.me.uk
Sat May 12 02:52:37 GMT 2007


On Sat, May 12, 2007 at 05:14:35AM +0400, Oleg Pronin wrote:
> Greetings!
> 
> 1. Reloading
> 
> I thought it would be great if DBIx::Class had this feature:
> 
> sub reload {
>    my ($self, $attrs) = @_;
> 
>    my $fresh_me = $self->result_source->resultset->find({
>        map { $_ => $self->get_column($_) } $self->primary_columns,
>    }, $attrs);
>    $self->set_columns({$fresh_me->get_columns});
>    1;
> }
> 
> That is to be able for row object to reload its data from database.
> 
> If this feature is already in DBIC please ignore this part (i didn't find it
> in docs).

$row->discard_changes;

Doc patches welcome :)

> 2. Locking (PostgreSQL)
> 
> the optional $attrs parameter could be very usefull if DBIx::Class supports
> row level locking for PostgreSQL.
> (SELECT .... WHERE ... FOR UPDATE).

I'd be interested in a proposal for how to implement this elegantly with
SQL::Abstract. Nobody's even tried to come up with one so far, so I'm assuming
they don't really care about the feature.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list