1

I have an issue with php mysql and use of stored procedure and PDO transaction.

My code :

$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 ...

When I call the code without the stored procedure, I don't any have issue.

The error is :

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.

Some additional info :

  • php version: 5.6.2-1

  • mysql version is : 5.5.40

I also made some tests with php 5.3.3-7+squeeze19 and I am having the same issue.

Athafoud
  • 2,898
  • 3
  • 40
  • 58
chaillouvincent
  • 197
  • 1
  • 3
  • 17

0 Answers0