each (PGresult)

    /*
     * call-seq:
     *    res.each{ |tuple| ... }
     *
     * Invokes the block for each tuple (row) in the result.
     *
     * Equivalent to <tt>res.result.each{ |tuple| ... }</tt>.
     */
    static VALUE
    pgresult_each(self)
        VALUE self;
    {
        PGresult *result = get_pgresult(self);
        int row_count = PQntuples(result);
        VALUE fields = pgresult_fields(self);

        int row_num;
        for (row_num = 0; row_num < row_count; row_num++) {
            VALUE row = fetch_pgrow(self, fields, row_num);
            rb_yield(row);
        }

        return self;
    }