In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the handling of transactions in MySQL, the contents of the articles are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to understand the handling of transactions in MySQL.
Steps:
1. Open transaction start transaction
When we start a transaction, our operations on sql take place in memory, but there is no real feedback to the file on the database disk!
two。 Roll back rollback
Rollback is to return to the original state before the transaction starts!
Note: the rollback operation will automatically close a transaction. If you want to execute the transaction again, you need to reopen the transaction!
3. Submit commit
The basic principles of transactions
Ordinary execution is executed immediately and takes effect, because by default, MySQL's execution of sql statements is automatically committed! Therefore, the essence of opening a transaction is to turn off the previous auto-commit function, but by the user to manually commit (using the commit statement)!
Steps to summarize the transaction:
1. Start the transaction
2. If the execution is successful, submit the commit.
3. If any of the sql statements fail, roll back rollback!
The most typical transaction is borrowing and repaying money. Let's take Zhang San returning 1000 yuan to Li Si as an example.
First check the respective amount of money in the database
Here is the code to handle the repayment transaction:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.