本文介绍了mysqli_use_result()和并发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这仅与myISAM表有关还是与InnoDB有关?
Does this only pertain to myISAM tables or also for InnoDB?
推荐答案
只需检查:MyISAM
锁定,InnoDB
不锁定:
Just checked: MyISAM
locks, InnoDB
doesn't lock:
<?php
$db = new mysqli() or die ("Cannot connect: " . mysqli_connect_error() . "\n");
$query = "SELECT * FROM mytable";
$db->real_query($query) or die ("Cannot fetch: $db->error\n");
$result = $db->use_result() or die ("Cannot use result: $db->error\n");
while($row = $result->fetch_row()) {
print join("\t", $row) . "\n";
usleep(1000000);
}
?>
此锁定:
UPDATE mytable /* isam */ SET myvalue = 'test' WHERE id = 100
这不是:
UPDATE mytable /* innodb */ SET myvalue = 'test' WHERE id = 100
这篇关于mysqli_use_result()和并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!