What happens if a row.update_record(lock=1) fails because of multi-
access collision on the table?

I want to provide out document numbers to users as they enter new
documents. My first thought is to keep a leading docNum value as a
field in a table and have the first request for docNum lock the access
to the record by updating the record to set the 'lock' field to 1,
then have it increment the docNum, and then update_record to reset the
lock field. But it is still possible that two users have read the
record at the very same time and are trying to update_record at the
same time to lock it. If this collision happens in my controller code,
what happens? Is an exception thrown or what is the return value/
status from the record_update fiunction?

I need to catch this error to allow a retry.

---
Rb

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to