在 while 循环中使用完整的 zend 查询。在循环中我执行完整的查询并将它们合并到一个数组中
优化 zend 查询执行时间过长。在 while 循环中使用完整的 zend 查询。在循环中,我执行完整的查询并将它们合并到一个数组中.. 在我有一个包含结果的数组,但执行需要太多时间.. 下面是确切的情况
while($str){
$db = Zend_Registry::get('dbadapter');
$select = new Zend_Db_Select($db);
$select = $db->select();
// my business logic omitted
$stmt = $select->query();
$result = $stmt->fetchAll();
// after execution merge the record in new array ( $final_result )
$temp_arr = $result;
$final_result = array_merge($final_result,$temp_arr);
unset($temp_arr);
}
optimize the zend query takes too much time to execute. using full zend query in while loop.And in loop i execute full query and merge them in one array .. at the i have one array with results BUT takes too much time to execute .. below is exact case
while($str){
$db = Zend_Registry::get('dbadapter');
$select = new Zend_Db_Select($db);
$select = $db->select();
// my business logic omitted
$stmt = $select->query();
$result = $stmt->fetchAll();
// after execution merge the record in new array ( $final_result )
$temp_arr = $result;
$final_result = array_merge($final_result,$temp_arr);
unset($temp_arr);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不必在循环内编写以下代码,将它们写在循环外...
然后在循环内编写以下代码:
此代码可能会帮助您......
You don't have to write following code inside the loop, Write them outside the loop...
Then write following code inside the loop:
This Code might help you.......