2009年4月23日星期四

[fw-db] Zend_Db_Table_Abstract problem fetching db result on nested routine

Sorry for crossposting on different list, but only right now i see that the
right place it might be Zend_DB

Hi all,
i'm having a problem while fetching a result set on a nested routine.

I think it's more simple to read the example:

$myFirstTable = new myFirstTable();// extetend Zend_Db_Table_Abstract
$mySecondTable = new mySecondTable();// extetend Zend_Db_Table_Abstract

then i call a function that get some rows from db (i don want to use
fetchAll due to big set of results, so i use query statment)
$result = $myFirstTable->getResult($id);
while ($row = $result->fetch()) {
//do some logic
//but if I use another query to db the while loop will stop immediatly
$mySecondTable->updateMyrecord($mycalcualtedId);
//if I not use this call o any call to db the loop finish correctly
}

So to solve this problem i'm going to waste memory fetching all result on an
array and then
looping and this work.
foreach ($myresults as $foo => $bar) {
//do somet logic
$mySecondTable->updateMyrecord($mycalcualtedId);
}

Someone can drive me on right direction?

Thank you
--
View this message in context: http://www.nabble.com/Zend_Db_Table_Abstract-problem-fetching-db-result-on-nested-routine-tp23197371p23197371.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: