about Rev cgi and MySQL

Rick Harrison harrison at all-auctions.com
Tue Nov 3 10:10:41 EST 2009


Hi,

There are some other compromising approaches to consider as well.

Don't have the record open long at all in your processing.
If it is a form, don't use the database field for your entry, use
a variable for the entry, so the record isn't actually open.
Once the user actually submits the information, then open
your record, copy the information from the variables into
the record, and perform your update.  In this way you will
use the least amount of time for your record locking technique.

Use a record locking strategy where you can use a
Date/Time stamp along with a session ID, or IP-Address,
when the record was opened for updating.
If the record isn't updated within a specified amount of time,
let it time out, send a message to the user that the update
timed out, and direct them to do it over. Close the record
so someone else can update it.

If someone else is trying to update the same record at the same
time, have the program wait for a couple of seconds and try
the update again. (You can loop this for several tries before
giving up.  If it still fails at this point you can send that user a
record busy message, ask them to wait, or ask them to try
again in a minute, or to cancel their update for later.)

I hope this helps!

Rick

On Nov 3, 2009, at 8:28 AM, Jan Schenkel wrote:

> This problem isn't unique to cgi-scripting - you have the same  
> issues with a desktop application where concurrent updates need to  
> be handled.
>
> There are 3 approaches to concurrent changes:
> - pessimistic locking (no one can change the record while somebody  
> has it locked)
> - optimistic locking (essentially no locking, whoever makes the last  
> update wins)
> - optimistic locking + versioning (again no locking, byut we use a  
> version number to see if anyone else made a change)
> ...
> Hope this helped,
>
> Jan Schenkel.
> =====
> Quartam Reports & PDF Library for Revolution
> <http://www.quartam.com>
>
> =====
> "As we grow older, we grow both wiser and more foolish at the same  
> time."  (La Rochefoucauld)
>




More information about the use-livecode mailing list