Gerald Richter wrote:
> 
> >   I need to solve the "lost update problem" (when two users are editing
> > the same database record, one's changes are lost when they both save
> > it). I'm thinking about putting original version of the record in the
> > hidden field (serialied by Storable) and upon saving do SELECT ... FOR
> > UPDATE, compare freshly SELECTed data with original data from the hidden
> > field and UPDATE&COMMIT if it corresponds or ROLLBACK otherwise. How
> > reasonable is it?
> 
> Another idea would be to have a sequence field, which is automaticly
> incremented for every update. (You can do this without modifying your code
> with a DBIx::Recordset filter) and only passing this sequence number around
> and comparing it before updating the record.


  This definitely saves the overhead of passing around another version
of data, but requires a modification of all table structures. I don't
see how it can be done with a Recordset filter, could you give me a
clue?

 
> >   I'd expect a lot of people have the same problem, what do you do? Can
> > you think of any way how to make this generaly usable, maybe as some
> > general Perl modul? Or perhaps integrate it into Recordset? I happen to
> > use Recorset in this project: Gerald, how hard would it be to extend
> > Recordset with this feature?
> >
> 
> Shouldn't be to hard to get this into Recordset, maybe it's enough to just
> define some filters


  I guess one would add !Version parameter to tell Recordset the name of
the version field... what's next? Reread its value before update and die
if it differs? One still needs to add SELECT FOR UPDATE or lock the
record some other way.

  - Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to