What should I do when I request the database. There are only 10 items in stock on A website for purchasing products. at this time, each of the three members of A & nbsp; B & nbsp; C buys 4 items and submits them at the same time. In this case, what should the program do. Do transactions need to be performed in the database? If you have a better method, please advise to request the database at the same time. what should I do?
For more information, see.
For A website that purchases commodities, there are only 10 remaining goods in stock. at this time, each of the three persons of a B and C purchased four commodities and submitted them at the same time. In this case, what should the program do. Do transactions need to be performed in the database? If you have a better method, please advise
------ Solution --------------------
Transaction processing. Very correct.
------ Solution --------------------
This is for transaction processing. Otherwise, the inventory will become negative.
------ Solution --------------------
Use innodB for transaction processing
------ Solution --------------------
Really?
Please give the practice
------ Solution --------------------
Sort by time, first buy first ship, then the last person will fail the order, and there is 2 left in the inventory, you can directly query the line.
------ Solution --------------------
Reference:
Sort by time, first buy first ship, then the last person will fail the order, and there is 2 left in the inventory, you can directly query the line.
++