/*
 * call-seq:
 *    res.fname( index ) -> String
 *
 * Returns the name of the column corresponding to _index_.
 */
static VALUE
pgresult_fname(self, index)
    VALUE self, index;
{
    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);
    }
    return rb_tainted_str_new2(PQfname(result, i));
}