private function connect()
    {
        // validate connection parameters
        if (!$this->config['wrapper']
            || !$this->config['user']
                || !$this->config['password']
                    || !$this->config['table']) {

            throw new \Exception('Insufficient connection parameters');
        }

        // try to connect
        try {
            $handle = new \PDO(
                $this->config['wrapper'],
                $this->config['user'],
                $this->config['password']
            );
            $handle->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

        } catch (\PDOException $e) {
            throw new \PDOException('PDOException: ' . $e->getMessage());
        }

        return $handle;
    }
private function connect()
    {
        // validate connection parameters
        if (!$this->config['wrapper']
            || !$this->config['user']
                || !$this->config['password']
                    || !$this->config['table']) {

            throw new \Exception('Insufficient connection parameters');
        }

        // try to connect
        try {
            $handle = new \PDO(
                $this->config['wrapper'],
                $this->config['user'],
                $this->config['password']
            );
            $handle->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

        } catch (\PDOException $e) {
            throw new \PDOException('PDOException: ' . $e->getMessage());
        }

        return $handle;
    }
private function connect ( ) { // validate connection parameters if ( ! $ this -> config [ 'wrapper' ] || ! $ this -> config [ 'user' ] || ! $ this -> config [ 'password' ] || ! $ this -> config [ 'table' ] ) { throw new \ Exception ( 'Insufficient connection parameters' ) ; } // try to connect try { $ handle = new \ PDO ( $ this -> config [ 'wrapper' ] , $ this -> config [ 'user' ] , $ this -> config [ 'password' ] ) ; $ handle -> setAttribute ( \ PDO :: MYSQL_ATTR_USE_BUFFERED_QUERY , true ) ; } catch ( \ PDOException $ e ) { throw new \ PDOException ( 'PDOException: ' . $ e -> getMessage ( ) ) ; } return $ handle ; }
Connect to database and return a handle

@return object       PDO
@throws Exception    if connection parameters are faulty
@throws PDOException if a db error occurred
Connect to database and return a handle