Home > database >  How to guarantee the concurrent operation, the only field will not be repeated?
How to guarantee the concurrent operation, the only field will not be repeated?

Time:10-23

Do an asset management system, the front every time a new assets will automatically generate a new asset number (database asset number only), a batch of new and then saved to the database, in order to ensure the number of the concurrent operation asset will not be repeated, it is now: the front end of new record, first in the table inserted into the new generated by the asset number, status is set to 0, submit the record update, to 1, but there will be a problem: if abnormal shut down the page, the record will always exist in the database, could you tell me what is the good way to solve? Such as transaction, lock of what, I check the information, or no ideas, want to ask next everybody, thank you,

CodePudding user response:

With sequence, it can solve your this problem,

But, may be the cause of the situation of the "broken", can accept?

CodePudding user response:

reference 1st floor selling fruit net reply:
with sequence, can solve your question,

But, may be the cause of the situation of the "broken", can accept?


Roughly understand, thank you, I'll try,

CodePudding user response:

Oracle with sequence, it has no attributes on the set, mysql, use the add or sequence, if you have to delete, will exist fault, define your own easy to cause conflict
  • Related