本文整理汇总了PHP中CI_DB_result::result方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_DB_result::result方法的具体用法?PHP CI_DB_result::result怎么用?PHP CI_DB_result::result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_DB_result
的用法示例。
在下文中一共展示了CI_DB_result::result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process_query
/**
* Process Query
*
* Converts a query result into an array of objects.
* Also updates this object
*
* @ignore
* @param CI_DB_result $query
*/
protected function _process_query($query)
{
if ($query->num_rows() > 0) {
// Populate all with records as objects
$this->all = array();
$this->_to_object($this, $query->row());
// don't bother recreating the first item.
$index = $this->all_array_uses_ids && isset($this->id) ? $this->id : 0;
$this->all[$index] = $this->get_clone();
if ($query->num_rows() > 1) {
$model = get_class($this);
$first = TRUE;
foreach ($query->result() as $row) {
if ($first) {
$first = FALSE;
continue;
}
$item = new $model();
$this->_to_object($item, $row);
if ($this->all_array_uses_ids && isset($item->id)) {
$this->all[$item->id] = $item;
} else {
$this->all[] = $item;
}
}
}
// remove instantiations
$this->_instantiations = NULL;
// free large queries
if ($query->num_rows() > $this->free_result_threshold) {
$query->free_result();
}
} else {
// Refresh stored values is called by _to_object normally
$this->_refresh_stored_values();
}
}