CDbCommand::fetchColumn() failed: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active

I want to be able to get some output from mysql stored procedure within OUT params but for case when stored procedure also returns result set via select statement like one below.

DELIMITER $$





DROP PROCEDURE IF EXISTS `RD`.`sp`$$





CREATE DEFINER=`root`@`%` PROCEDURE `sp`(in b int, out a int)


BEGIN


select 664656 into a;





select 5;


END$$





DELIMITER ;

Runing in console below mentioned command one by one

call sp(5,@a)


select @a

we will get result

5 =>  5


@a => 664656 

However when I try to run the same code from php getting error below

[error] [system.db.CDbCommand] CDbCommand::fetchColumn() failed: 


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 @a as result;.

Below please find my php code.

$connection = Yii::app ()->db;


	$b=7;


	$command = $connection->createCommand ( "CALL sp(:b,@a)" );


	$command->bindParam ( ":b", $b, PDO::PARAM_INT );


	$command->execute();





    $command->getPdoStatement()->fetchAll();





   	$command->getPdoStatement()->closeCursor();





    $valueOut = $connection->createCommand ( "select @a as result;" )->queryScalar ();








	echo $valueOut;

Any Ideas how to fix???

PHP Version 5.3.1

Yii version 1.1.9

Mysql Version 5.1.41-3ubuntu12.10

can someone help? please