At 19:16 -0600 1/8/04, Alfredo Cole wrote:
Hi:

I have an application that is used by around 40 users who need to access a
table, obtain a sequential code, and write it back. I'm using MyISAM tables,
and mysql 3.23 running under LM 9.0.

A couple of times during the day, the users get the same code, and that is
causing us many problems.

The code I use is:

select lock....

get code
add one to code
write code

release lock....

That looks like pseudo code (There is no "SELECT LOCK" statement), so it's difficult to say what this should do.


I have tried lock tables / unlock tables and it will eventually deadlock, even though the manual says it's guaranteed not to happen.

That's right. If you deadlock with table locks on MyISAM tables, something odd is going on.

But, given the nature of what you *appear* to want (get the next code in
sequence), I'm curious why you don't just use an AUTO_INCREMENT column
and use LAST_INSERT_ID() to retrieve the value.  Is there something unusual
about your requirements?


I would appreciate a suggestion as to where I can read more about locking tables / records using MySQL and My ISAM tables.

Thank you.

--
Alfredo J. Cole
[EMAIL PROTECTED]
[EMAIL PROTECTED]


--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

MySQL Users Conference: April 14-16, 2004
http://www.mysql.com/uc2004/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to