CI_DB_result::result_object PHP Method

result_object() public method

Query result. "object" version.
public result_object ( ) : array
return array
    public function result_object()
    {
        if (count($this->result_object) > 0) {
            return $this->result_object;
        }
        // In the event that query caching is on, the result_id variable
        // will not be a valid resource so we'll simply return an empty
        // array.
        if (!$this->result_id or $this->num_rows === 0) {
            return array();
        }
        if (($c = count($this->result_array)) > 0) {
            for ($i = 0; $i < $c; $i++) {
                $this->result_object[$i] = (object) $this->result_array[$i];
            }
            return $this->result_object;
        }
        is_null($this->row_data) or $this->data_seek(0);
        while ($row = $this->_fetch_object()) {
            $this->result_object[] = $row;
        }
        return $this->result_object;
    }