MySQL Forums
Forum List  »  Newbie

Help with locks
Posted by: Luis Miguel Valenzuela
Date: March 19, 2009 09:29AM

Hi to everyone.
My problem is the following. I'm designing a system for bank operations registry, the system is required to give to one user a reference number that will be used in the bank's system as a reference. At the end of the bank's process this number will be also used as the key for keeping track of the file that the bank's system outputs. In the meantime, another user has to be able to generate another serial from the tracking system to make another bank operation.
I've thought of two different aproches to solve this:
1) Lock the table with LOCK WRITE so there will be no chance to repeat the numbers.
2) Make an insert and later on, insert the rest of the information to the tables.
Aproach number 1 has one evident problem, while the first user doesn't complete the whole procces, the lock will prevent other users to get a number to start their own proccess.
Aproach number 2 has problems as well, because, if user number 1 doesn't complete the proceess there will be a serial number which doesn't have all the information that it should have.
Is there another solution ?
Thanks in advance for your ansewers.

Options: ReplyQuote


Subject
Written By
Posted
Help with locks
March 19, 2009 09:29AM
March 19, 2009 11:53AM
March 19, 2009 11:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.