RE: Best practise for resolving potential conflicts when editing db content?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Raditha,

I'm not sure table locking is the answer. I'm not talking about concurrency
in the sense of 'simultaneous' updates and selects, but in the sense of an
'open record edit session' that predictably will overwrite the value of a
record that may have been changed, after the edit session began, but before
the edit session is committed.

So, User A clicks on an edit link on a page which retrieves that record's
content from the db, and begins editing.

User B performs a page rename, which enacts an update similar to:

UPDATE mytable set content = replace(content, 'old val', 'new val') where
content like '%old val%'

User A finishes his or her page edit and commits the changes, but the
underlying record was already changed by User B's page rename. User A's edit
changes overwrite this update in the record in question, and now that record
still shows 'old val' instead of 'new val', since that was what was in the
content when User A began editing the page.

I'm just wondering how others go about handling these circumstances. One way
I can think of is to have a 'beingedited' field in the table, and to update
this to a 1 when a user requests a page edit, and set it back to 0 when a
user commits the changes, and then to check whether or not any of the rows
affected by the page rename are currently 'locked' (beingedited=1). Still,
this doesn't account for the possibility that a user might request a page
edit, 'locking' the record, and then simply navigate to some other page, or
close their browser etc, thus leaving the record locked. 

I'd be surprised if others hadn't encountered this issue previously?

Much warmth,

Murray


-----Original Message-----
From: raditha dissanayake [mailto:jabber@xxxxxxxxxxx] 
Sent: Tuesday, 12 October 2004 2:27 AM
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  Best practise for resolving potential conflicts when
editing db content?

Murray @ PlanetThoughtful wrote:

>Hi All,
>
> 
>
>I'm developing a wiki-esque application for an in-house project and am
>wondering how others go about resolving potential conflicts when multiple
>users are editing the same content drawn from a MySQL database?
>
>  
>
You might want to ask in a mysql group about table locking.

-- 
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux