/*
 * call-seq:
 *    res.fname( index ) -> String
 *
 * Returns the name of the column corresponding to _index_.
 */
static VALUE
pgresult_fname(VALUE self, VALUE index)
{
        VALUE fname;
        PGresult *result;
        int i = NUM2INT(index);

        result = get_pgresult(self);
        if (i < 0 || i >= PQnfields(result)) {
                rb_raise(rb_eArgError,"invalid field number %d", i);
        }
        fname = rb_tainted_str_new2(PQfname(result, i));
        ASSOCIATE_INDEX(fname, self);
        return fname;
}