CakePHP中的存储过程错误
知道如何在CakePHP中调用存储过程吗CakePHP中的存储过程错误,php,mysql,stored-procedures,mysqli,cakephp-2.1,Php,Mysql,Stored Procedures,Mysqli,Cakephp 2.1,知道如何在CakePHP中调用存储过程吗 $results = $this->query('call p2'); echo $results; 不过,我一直会遇到这样的错误: Error: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Altern
$results = $this->query('call p2');
echo $results;
不过,我一直会遇到这样的错误:
Error: 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.
我在事务中这样做是为了确保没有其他过程实例被称为中间过程:
$this->begin();
$this->query("CALL procedure();");
$result = $this->query("SELECT something");
$this->commit();
您的问题可能是您正在拨打:
$this->query('call p2');
$this->query('call p2()');
您应该拨打的电话:
$this->query('call p2');
$this->query('call p2()');
因为过程很像函数。你应该打开和关闭括号
$results = $this->query('call p2()');
echo $results;
答案应该是详细的。