get_last_result (PGconn)

    /*
     * call-seq:
     *    conn.get_last_result( ) -> PGresult
     *
     * This function retrieves all available results
     * on the current connection (from previously issued
     * asynchronous commands like +send_query()+) and
     * returns the last non-NULL result, or +nil+ if no
     * results are available.
     *
     * This function is similar to +PGconn#get_result+
     * except that it is designed to get one and only
     * one result.
     */
    static VALUE
    pgconn_get_last_result(VALUE self)
    {
            VALUE ret, result;
            ret = Qnil;
            while((result = pgconn_get_result(self)) != Qnil) {
                    ret = result;
            }
            pgresult_check(self, ret);
            return ret;
    }