Home > Article > Backend Development > what is php transaction
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.
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!