doushupu2521 2015-05-20 12:02
浏览 8
已采纳

在mysql中执行查询的PHP序列

If I have a bunch of queries(mysql) 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?

  • 写回答

1条回答 默认 最新

  • dongxianglun5163 2015-05-20 12:06
    关注

    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.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型