src/CI_Base_Model.php
public function set_database($database = null)
    {
        switch (true) {
            case ($database === null) :
                $this->_database = $this->db;
                break;
            case is_string($database) :
                $this->_database = $this->_load_database_by_group($database);
                break;
            case ($database instanceof CI_DB_driver):
                $this->_database = $database;
                break;
            default :
                $this->_show_error('You have specified an invalid database connection/group.');
        }

        return $this;
    }
public function set_database($database = null)
    {
        switch (true) {
            case ($database === null) :
                $this->_database = $this->db;
                break;
            case is_string($database) :
                $this->_database = $this->_load_database_by_group($database);
                break;
            case ($database instanceof CI_DB_driver):
                $this->_database = $database;
                break;
            default :
                $this->_show_error('You have specified an invalid database connection/group.');
        }

        return $this;
    }
public function set_database ( $ database = null ) { switch ( true ) { case ( $ database === null ) : $ this -> _database = $ this -> db ; break ; case is_string ( $ database ) : $ this -> _database = $ this -> _load_database_by_group ( $ database ) ; break ; case ( $ database instanceof CI_DB_driver ) : $ this -> _database = $ database ; break ; default : $ this -> _show_error ( 'You have specified an invalid database connection/group.' ) ; } return $ this ; }
@param mixed $database

@return $this
@param mixed $database