简体   繁体   中英

PHP sequence of executed queries in mysql

If I have a bunch of queries in PHP, assuming that i'm using PDO, these queries will be executed in sequence, but PHP or MySQL will wait one query to finish before start a new one?

$sql1 = $con->prepare("some query");
$sql2 = $con->prepare("some query");   
$sql3 = $con->prepare("some query");

$sql1->execute();
$sql2->execute();
$sql3->execute();

And if I use a transactional block in PDO with the same queries:

$con->beginTransaction();

Will the execution be the same?

A query is a single SQL statement that does Select, Update, Insert or Delete of rows.

A transaction is a consecutive sequence of SQL statements (from the application viewpoint) that have the "ACID" properties:

  • Atomicity: All statements or none are executed.
  • Consistency: Data integrity is always maintained.
  • Isolation: Transaction A can never affect Transaction B.
  • Durability: Changes that are committed by a transaction persist, even in event of system failure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM