Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Database utility -> list_databases() #1994

Closed
skunkbad opened this Issue Nov 12, 2012 · 1 comment

Comments

Projects
None yet
2 participants

I believe list_databases() needs to be revised. In my own testing, there are some places where $query needs to be changed to #query->result():

public function list_databases()
    {
        // Is there a cached result?
        if (isset($this->db->data_cache['db_names']))
        {
            return $this->db->data_cache['db_names'];
        }
        elseif ($this->_list_databases === FALSE)
        {
            return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE;
        }

        $this->db->data_cache['db_names'] = array();

        $query = $this->db->query($this->_list_databases);
        if ($query->result() === FALSE)
        {
            return $this->db->data_cache['db_names'];
        }

        for ($i = 0, $c = count($query->result()); $i < $c; $i++)
        {
            $this->db->data_cache['db_names'][] = current($query->result()[$i]);
        }

        return $this->db->data_cache['db_names'];
    }

narfbg added a commit that referenced this issue Nov 12, 2012

Contributor

narfbg commented Nov 12, 2012

Fixed, thanks for reporting it.

@narfbg narfbg closed this Nov 12, 2012

nonchip pushed a commit to nonchip/CodeIgniter that referenced this issue Jun 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment