Saturday, 17 August 2013

trouble with multiple select in stored procedure zend framework 2.2 tablegateway

trouble with multiple select in stored procedure zend framework 2.2
tablegateway

well. sorry about my english.
i'm working with stored procedures in PDO-mysql with zend framework 2.2,
and tablegateway library.
this is an generic exmaple of my sp.
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_proc`(IN id SMALLINT)
BEGIN
SELECT * FROM TABLE_A WHERE ID_TABLE=ID;
SELECT * FROM TABLE_B WHERE ID_FK=ID;
END
and this is function from model
public function __construct(Adapter $adapter = null, $databaseSchema =
null, ResultSet $selectResultPrototype = null)
{
return parent::__construct('', $adapter, $databaseSchema,
$selectResultPrototype);
}
public function listaServicio()
{
$dbAdapter=$this->getAdapter();
$stmt = $dbAdapter->createStatement();
$stmt->prepare('CALL sp_proc(:id)');
$id=15;
$stmt->getResource()->bindParam(':id', $id, \PDO::PARAM_INT);
$resultado=$stmt->execute();
while ($resultado->next()) {
var_dump($resultado->current());
}
}
but i just have result from the "first" select (table_a), but could not
get the result from "second"(table_b).
i dont know if its problem with my stored procedure or the way ive worked
in the model..

No comments:

Post a Comment