On 18 Apr 2001, at 13:47, Nicolas Guilhot wrote:

Don't want to start another religion war, but...
> Hi,
> 
> How can I avoid two or more users to update the same record at the same time
> ?
> 
> Ideally, I would like to lock the record when a user open it for
> modification. So if another user try to open the same record he'll be warned
> or get record values as read only. Is this possible and how to do it with
> PHP ?? How can I know that the user that has locked the record has finished
> with it, if he never commits his changes ? Is there an FAQ about this ?
> 
Rather than a FAQ, you should find some good textbook on 
cuncurrent programming. The problem of concurrent updates of 
data is far too large to be tackled with a brief doc (and even less 
with a mail, I'm afraid).

But to be short:
Generally, Every DBMS out there can guarantee you that there will 
be no 2 users trying to update the same data together (i.e. querys 
are serialized). When it comes to multiple updates, however, or 
updates that touch different tables the problem gets harder, and the 
doubt you put in the subject can comport big difference in the way 
to handle it. 

In the MySQL paradigm, it's up to the programmer to guarantee 
data integrity at application level. In PostgreSQL (and in the rest of 
the DBMS world) paradigm, this work is still left to the DBMS 
system, thru isolated transactions. 

It's up to you to decide which way to go...


/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Fabrizio Ermini               Alternate E-mail:
C.so Umberto, 7               [EMAIL PROTECTED]
loc. Meleto Valdarno          Mail on GSM: (keep it short!)
52020 Cavriglia (AR)          [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to