I am using Yii to deal with a mysql stored procedure. The sp takes several parameter, one of which is a output parameter.
After execute the sp, when I try to get the output parameter, I run into a error
CDbCommand failed to execute the SQL statement: 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.. The SQL statement executed was: select @error_info as result;
My mock up code is like:
$sql = 'CALL p_bid(:username, @param)';
$command = Yii::app()->db->createCommand($sql);
$command->bindParam(":username", $username, PDO::PARAM_STR);
$command->execute();
// the following line raise the error
$errorInfo = Yii::app()->db->createCommand("select @error_info as result;")->queryScalar();
How can I walk around the question? Thanks.