hsicard
Založený: 22.10.2003
Príspevky: 17
Zaslal: 2008-03-26 17:46
Návrat hore
Odpovedať s citátom
|
Hello all,
I would like to block simultaneous editings of a given record.
I found a post from Doug in 2003, explaining how he handled it through a "recycle" bin were versions could be compared in case of multiple editing.
I would prefer locking the record, or at least alerting the second user opening the same record that he is not alone on it.
I imagine it's possible to solve this with triggers. Of course an issue are records potentially tagged as "left opened" while in fact user just went away or connection was lost.
Did someone came up with some solution?
Thanks in advance, and greetings to all,
Hugues
|
marcel
Založený: 28.07.2007
Príspevky: 5
Zaslal: 2008-06-11 09:46
Návrat hore
Odpovedať s citátom
|
Same question from me.
I have the same situation, but I do not know how to solve...
|
franciscohm
Založený: 08.05.2008
Príspevky: 33
Zaslal: 2008-06-12 09:06
Návrat hore
Odpovedať s citátom
|
I am implementing this tool, using a lot of its feautures (export, calendar, languages, etc.). It is great.
I think the block feature should be top of the list in future developments of PHPMyEdit.
Regards
Francisco
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2008-07-08 02:36
Návrat hore
Odpovedať s citátom
|
have a look at pre triggers. however you need some authentification.
|
franciscohm
Založený: 08.05.2008
Príspevky: 33
Zaslal: 2009-01-23 04:02
Návrat hore
Odpovedať s citátom
|
Can you please be more specific?
I looked at the documentation and I did not see anything related.
Is there an example somewhere?
Thks
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-01-24 14:45
Návrat hore
Odpovedať s citátom
|
Implementation of the change log feature in each form is a good idea. If one user overwrites changes made by another user, old values might be retrieved from the changelog table.
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.logging.html
If a method of locking records or tables existed, and if the user did not commit their planned changes, how would you remove the lock?
|
franciscohm
Založený: 08.05.2008
Príspevky: 33
Zaslal: 2009-01-24 15:03
Návrat hore
Odpovedať s citátom
|
Thanks Doug
I have the logging method implemented (very nice BTW), but reconstructing data from it, when there can be thousands of transactions, is complicated.
I see your point about blocking and not being able to unblock. It is indeed a problem too...
So I think a good "midpoint" solution might be to have a trigger that after submiting the changes alert us if any other user have done changes while we were editing the register. Hence the pop-up would give us the opportunity to cancel our saving, or to go ahead and overwritte the register.
Does it make sense?
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-01-24 15:32
Návrat hore
Odpovedať s citátom
|
I don't know if individual records can be locked in MyISAM tables. Search in Google for "php mysql record locking"
http://www.google.com/search?hl=en&q=php+mysql+record+locking&btnG=Google+Search&aq=f&oq=
I did not take time to read all the proposed solutions. It seems that one would want to log the user's name and the LOCK request, and possibly configure a Cron job to run every 5 minutes on the server to search for and report on locks that are older than perhaps 5 minutes (300 seconds). Time entries might easily use PHP's time() function.
| Kód: |
CREATE TABLE `locked_records` (
`id` mediumint NOT NULL auto_increment,
`is_active` tinyint(1) not null default '1',
`host_name` char(50) not null default '',
`table_name` char(50) not null default '',
`field_name` char(50) not null default '',
`record_id` varchar(50) not null default '',
`user_name` char(50) not null default '',
`user_ip` char(50) not null default '',
`php_time` int(10) unsigned not null default '0',
`updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
)TYPE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; |
If locks were recorded to the above schema, the Admin might develop a web page they could reload periodically to view a list of old locks. Such a report should probably include links or a form to enable the Admin to release locks by clicking a link or executing a form which would in turn execute an unlock query.
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-01-24 15:59
Návrat hore
Odpovedať s citátom
|
With MyISAM the entire table must be locked:
http://lists.mysql.org/mysql/126906
The above link reads, in part: "But usually it is a bad idea to implement application level locks by using database locks. What if I leave my computer? You have to implement some kind of timeout. And so on. Better to implement conflict handling correctly from the start."
|
franciscohm
Založený: 08.05.2008
Príspevky: 33
Zaslal: 2009-01-24 17:17
Návrat hore
Odpovedať s citátom
|
Thaks Doug for the tips.
I will explore those ways. :-)
Francisco
|
JammerPro
Založený: 07.12.2006
Príspevky: 33
Zaslal: 2009-10-19 08:18
Návrat hore
Odpovedať s citátom
|
Thanks Doug and Francisco...
I read through a few of the Google articles, and it seems that Francisco's idea about using triggers is the best solution... if it can be implemented.
Using the log file's timestamp, if the last update to a record was AFTER the user entered "change" mode, the trigger should prevent the user from saving the file and display a message that the file was in use... Once the user returns to view list, etc., he could view the record and enter change mode again to make changes...
Can someone take the first shot at programming this? It would really be a great feature and make PHPMyEdit a true network app... I will be glad to help, but I think there are some of you out there who are more familiar with triggers than I...
|
|
Odoslať novú tému
Odpovedať na tému
|