CakePHP中的存储过程错误

Any idea how to call a stored procedure in CakePHP?

$results = $this->query('call p2');
echo $results;

I keep getting this error though:

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.

I've done this within a transaction to ensure that no other instance of the procedure is called inbetween:

$this->begin();
$this->query("CALL procedure();");
$result = $this->query("SELECT something");
$this->commit();

Your problem may be that you're calling:

$this->query('call p2');

Where you should be calling:

$this->query('call p2()');

as procedures are much like functions.

you should you open and close parentheses

$results = $this->query('call p2()');
echo $results;