[Dbix-class] Optimistic locking
Matt S Trout
dbix-class at trout.me.uk
Fri Aug 4 19:23:27 CEST 2006
Dan Horne wrote:
> Hi
>
> I'd like to implement a form of optimistic locking in one of my apps. Rather
> than handle this manually in the app itself, I'm hoping to reduce the coding
> overhead by incorporating the logic in a DBIC component. The basic steps
> are:
>
> 1. Generate a pseudocolumn that contains a hash of the current row (or
> allrows if $rs->all).
> 2. At some point in the future, a user will try to save the record via a
> webform. The overridden update method will query the original row and
> recompute the hash. If the two hashes don't match, an exception will be
> thrown.
>
> So, my question is: Is there any way to create such a pseudocolumn that can
> be populated as a result of the values of the other columns?
Why do you need a "pseudocolumn" ?
It's just a perl object. Add an accessor ...
More information about the Dbix-class
mailing list