Home  >  Article  >  Backend Development  >  what is php transaction

what is php transaction

(*-*)浩
(*-*)浩Original
2019-09-10 13:55:033808browse

Transaction: used to ensure data consistency. It consists of a set of related dml statements. The reorganized dml statements either all succeed or all fail.

what is php transaction

The current version of the plug-in is not transaction-safe because it does not recognize all transaction operations.

SQL transaction unit is run in a single server. The plug-in does not effectively know when a transaction unit starts and ends. Therefore, within the transaction unit, the database connection may be switched.

If the application does not configure transaction unit editing, then no MySQL load balancer can detect it. (Recommended learning: PHP programming from entry to proficiency)

This restriction can be lifted through SQL hints. You can selectively call the transaction API for monitoring, and then call the API to execute the control transaction. An example is given below:

Configuring a master and a slave plug-in

[myapp]
{
    "myapp": {
        "master": {
            "master_0": {
                "host": "localhost",
                "socket": "\/tmp\/mysql.sock"
            }
        },
        "slave": {
            "slave_0": {
                "host": "192.168.2.27",
                "port": "3306"
            }
        }
    }
}

The above is the detailed content of what is php transaction. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn