mysql-Design of PHP commit database transaction Mode

Source: Internet
Author: User
The individual does not have much contact with the transaction, but in fact the transaction is a more important part of a project, the transaction pattern is taken out to discuss with you, more is based on this discussion can learn more transaction processing mode.

Take MySQL for example:

Once the transaction mode is executed, the MySQL autocommit mode needs to be turned off, and then the SQL is submitted sequentially, and if it is passed, the success and related processing are returned.

Do not know how people generally design?
can be specific to the code logic of the steps and scenarios to apply the introduction!

Reply content:

The individual does not have much contact with the transaction, but in fact the transaction is a more important part of a project, the transaction pattern is taken out to discuss with you, more is based on this discussion can learn more transaction processing mode.

Take MySQL for example:

Once the transaction mode is executed, the MySQL autocommit mode needs to be turned off, and then the SQL is submitted sequentially, and if it is passed, the success and related processing are returned.

Do not know how people generally design?
can be specific to the code logic of the steps and scenarios to apply the introduction!

This is very simple, the operation of the operation is generally operating 2 and above the multi-table operation, if one of the tables of SQL execution fails, then all the SQL execution undo, that is, the transaction rollback to the original state, the bank transfer operation is certainly something, Zhang San will 100 yuan to John Doe, Zhang San account-100 yuan, John Doe account + 100 Yuan, if the Zhang San operation-100 failure, then John Doe +100 also failed, if not things, or Zhang Sanxi dead, or the bank died.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.