MySQL Forums :: Newbie :: Help with locks


Advanced Search

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 Luis Miguel Valenzuela 03/19/2009 09:29AM
Re: Help with locks laptop alias 03/19/2009 11:53AM
Re: Help with locks Luis Miguel Valenzuela 03/19/2009 12:43PM
Re: Help with locks Rick James 03/19/2009 11:40PM
Re: Help with locks Luis Miguel Valenzuela 03/24/2009 09:34AM


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.