MySQL stored procedures may have multiple result sets. That is, you can run more than one SELECT query inside a stored procedure, and then iterate over these multiple result sets.
This complicates fetching because the whole result is really like an array of arrays of arrays (multiple result sets, each result set may have multiple rows, each row may have multiple columns).
But fetchAll()
only fetches all the rows from one result set. So when you call a stored procedure, you need to force it to flush all result sets. That is, keep calling nextRowset()
until that function returns null.
The Zend_Db API is modeled off of PDO, so you can see example usage of nextRowset()
in the docs for PDOStatement::nextRowset()
.
Unfortunately, there is no such function like fetchAllRowsets()
. You are left to do it yourself as a while loop.