Would recommend to use a PHP or LC server-side front-end script to a MySQL or
PostgreSQL SQL insert/update instruction instead. The SQL servers would manage
this for you in a cleanest way than what can be done in using direct writes to
flat files.
HTH,
Le 22 août 2011 à 17:05, Gregory Lypny a écrit :
Hello everyone,
I would appreciate your thoughts on how to avoid collisions on a server on
those presumably rare occasions when two or more visitors attempt to write to
a file at exactly the same time. In my case, it’s students writing via FTP
to a text log file, but the same situation can occur if visitors to a web
site, for example, submitting an entry to a guest book, do it at the same
time. I don’t know what the consequences of this are.
My crude and imperfect attempt to minimize this possibility is to have a Busy
file that acts as a flag when the log file is being written to. It contains
just one line of data:
False, the seconds
If the first item is False, it means that the log file is not currently being
written to. A user about to write to the file invokes a handler that changes
this first item to True, and inserts a timestamp in the form of the seconds.
When they are finished writing to the file, the same handler sets the Busy
file to False and inserts a new timestamp. The purpose of the timestamp is
to cover for the possibility of the write process or the handler being
aborted, therefore failing to set the Busy file back to False. If the
timestamp is more than, say, four minutes old, the True flag can be
overridden. This method is obviously imperfect because it is possible that
two people might be writing to the Busy file at the same time! I’m curious
to know of other handler-based approaches that do not involve setting up
separate databases.
Regards,
Gregory
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode