We can define the SAVEPOINT during mysql transaction processing, and then roll back to the status before the specified save point. The syntax for defining the save point and rolling back to the status before the specified save point is as follows.
This article mainly introduces the usage of Mysql transactions in PHP and is a very important practical operation skill in PHP database programming, for more information about how to use MySQL in PHP, see the following examples. Share it with you
In MySql, transactions are a series of steps in a logical unit of work. Transactions are used to ensure the security of data operations.
Transaction features:
1. Atomicity (Atomicity)2. Consistency (stability and Consistency)3. Isolation (Isolation)
Assume that after STARTTRANSACTION is used to start a transaction, before ROLLBACK, data in the table is deleted, and then SELECT, the data in the table is empty. after ROLLBACK is executed, if the data is returned, will the data in the cache exist
In e-commerce, there is often a small inventory and a large number of buyers. In the case of high concurrency, how can we ensure that the number of products will not be bought multiple times.
In fact, it is very simple to use the transaction + for
There are two main methods to process MYSQL transactions.1. Use begin, rollback, and commit to implement Start a transactionRollback transaction rollbackCommit transaction validation2. directly use set to change the mysql automatic submission Mode
Auto-increment IDs are often used in projects, such as uid. The simplest method is to directly use the AUTO_INCREMENT provided by the database. However, if the number of users is large, tens of millions, when hundreds of millions of users need to
The Innodb Storage engine supports XA transactions and distributed transactions. Distributed transactions refer to multiple independent transaction resources (transactionalres ).
The Innodb Storage engine supports XA transactions and distributed
This article mainly introduces the usage of Mysql transactions in PHP and is a very important practical operation skill in PHP database programming, for more information about how to use MySQL in PHP, see the following examples. Share it with you
Transactions are required to meet 4 conditions (ACID): atomicity (autmic), consistency (consistency), isolation (isolation), persistence (durability)
Atomicity (autmic): The transaction is in execution, to do "either do it or do it all!" ", which
Select @ tx_isolation; view the isolation level settransactionisolationlevelreaduncommitted; set the read uncommitted level starttransaction; open the transaction rollback; roll back select @ tx_isolation; // view the isolation level
Set
#这是我的MySql数据的配置
#本文中我的用计算机的mysql数据库安装目录是 "D:webservermysql"
#我的数据库目录是 "F:sun datamysql data"
#我的计算机的IP地址为192.168.0.2 If the public IP is the same
#[mysqld] Part of the MySQL Environment configuration section
#[winmysqladmin] for the database startup
I have been debugging for half a day because l transaction is not effective today. It is because the MySQL database MyISAM type table does not support transactions.Later, I changed the table type to InnoDB, and the transaction processing took effect.
The problems caused by transaction concurrency are the problems that need to be solved by the database. The transaction processing technology is very mature, and the four isolation levels plus a snapshot is a common solution for all databases,
There are two main methods to process MYSQL transactions.
1. Use begin, rollback, and commit to implement
Start a transaction
Rollback transaction rollback
Commit transaction validation
2. directly use set to change the mysql automatic submission
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.