This is the way databases work. I'm guessing you (like I) come from a
desktop database background where the system will lock a record for editing.
Not so for SQL servers.

One strategy you can use is to add a lock field to your record.

Then, before you commit your change (issue the UPDATE statement) you:

1: check to see if the record is locked.
2: If not, issue an UPDATE statement that only updates the lock field. I
usually write something like userID or session number into it.
3: CHECK TO MAKE SURE YOU GOT THE LOCK.  If 2 people are trying to write to
the record then 2 people will be trying to lock the record.  make sure the
value in the lock field is what you wrote to it.
4: Issue the UPDATE to make your changes.
optional
5: unlock the record by clearing the lock field.

HTH,
Cal

*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-----Original Message-----
From: Silmara Cristina Basso [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 4:21 PM
To: [EMAIL PROTECTED]
Subject: lock table...


I using MySQL (type=MyISAM) with Delphi5 -MyODBC, the problem is that when I
edit one row The MySQL not lock for other machines, therefore other person
can edit the same row and save the changes and when I try to save, it get
one error.
Tell me I to do?

Thanks.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to