public function defaultDatabase($which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $adapter = $this->getAdapter($this->connectionType($which_connection));
        if ($which_connection == '') {
            $which_connection=$this->default_db;
        }

        if (count($this->connections) == 0) {
            return false;
        }

        $query = $adapter->defaultDatabase();

        $ret = false;
        $try = $this->query($query, $which_connection);
        if ($try && $this->num_rows($try) > 0) {
            $row = $this->fetch_row($try);
            $ret = $row['dbname'];
        }

        return $ret;
    }
public function defaultDatabase($which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $adapter = $this->getAdapter($this->connectionType($which_connection));
        if ($which_connection == '') {
            $which_connection=$this->default_db;
        }

        if (count($this->connections) == 0) {
            return false;
        }

        $query = $adapter->defaultDatabase();

        $ret = false;
        $try = $this->query($query, $which_connection);
        if ($try && $this->num_rows($try) > 0) {
            $row = $this->fetch_row($try);
            $ret = $row['dbname'];
        }

        return $ret;
    }
public function defaultDatabase ( $ which_connection = '' ) { $ which_connection = $ which_connection === '' ? $ this -> default_db : $ which_connection ; $ adapter = $ this -> getAdapter ( $ this -> connectionType ( $ which_connection ) ) ; if ( $ which_connection == '' ) { $ which_connection = $ this -> default_db ; } if ( count ( $ this -> connections ) == 0 ) { return false ; } $ query = $ adapter -> defaultDatabase ( ) ; $ ret = false ; $ try = $ this -> query ( $ query , $ which_connection ) ; if ( $ try && $ this -> num_rows ( $ try ) > 0 ) { $ row = $ this -> fetch_row ( $ try ) ; $ ret = $ row [ 'dbname' ] ; } return $ ret ; }
Get current default database
for a given connection
@param which_connection see method close
@return [string] database name
or [boolean] false on failure
Get current default database for a given connection