On Behalf Of Matt S Trout > 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 ...
Yes, wrong terminology on my part. Ok, I'm still coming to grips with writing components. Specifically, I can't see how I can automatically add the checksum to each row that gets fetched. _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
