public function ping()
    {
        try {
            $this->connect();
            $this->pdo->query('select 1')->fetchColumn();
        } catch (\PDOException $e) {
            if (strpos($e->getMessage(), 'server has gone away') !== false) {
                return false;
            }
        }

        return true;
    }
public function ping()
    {
        try {
            $this->connect();
            $this->pdo->query('select 1')->fetchColumn();
        } catch (\PDOException $e) {
            if (strpos($e->getMessage(), 'server has gone away') !== false) {
                return false;
            }
        }

        return true;
    }
public function ping ( ) { try { $ this -> connect ( ) ; $ this -> pdo -> query ( 'select 1' ) -> fetchColumn ( ) ; } catch ( \ PDOException $ e ) { if ( strpos ( $ e -> getMessage ( ) , 'server has gone away' ) !== false ) { return false ; } } return true ; }
Check whether the connection is available
@return bool
@throws \PDOException
@throws \RuntimeException
Check whether the connection is available