【发布时间】:2013-02-06 10:06:16
【问题描述】:
使用 INNODB,您可以将 LOCK IN SHARE MODE; 添加到查询中,以便其他用户仍然可以阅读,但在编辑完成之前不能更新。
我目前在 PHP 中的 PDO 函数如下所示:
//$this->db is a PDO connection to the MYSQL innodb database.
try
{
$this->db->beginTransaction();
$tmp = $this->db->prepare($query);
$tmp->execute($arr);
$this->last_id = $this->db->lastInsertId();
$this->db->commit();
return $this->last_id;
}
catch(PDOException $ex)
{
$this->db->rollBack();
return $ex->getMessage();
}
是否有 PDO 驱动程序功能设置可以将其设置为共享模式?如果是这样怎么办?我发现唯一的事情没有答案,文档也不是很清楚。 还是应该简单地将其添加到查询字符串中?
【问题讨论】: