php mysql,存储过程和事务问题

时间:2014-12-08 09:50:55

标签: php mysql transactions

我遇到了php mysql的问题以及存储过程和PDO事务的使用。

我的代码:

$conn_admin_diag = $db_connection_manager->getConnectionByName(BASE_ADMIN_DIAG);

$stmt = $conn_admin_diag->getPdo()->prepare('CALL check_etat_retirable(?)', array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
$stmt->bindParam(1, 3, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 10000);
$stmt->execute();
$problemes = $stmt->fetchAll();

$conn_admin_diag->getPdo()->beginTransaction();
// some code after wich works ...

当我在没有存储过程的情况下调用代码时,我没有任何问题。

错误是:

SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.

其他一些信息:

  • php版本:5.6.2-1

  • mysql版本是:5.5.40

我还使用php 5.3.3-7+squeeze19进行了一些测试,我遇到了同样的问题。

0 个答案:

没有答案