/* * call-seq: * res.fields() -> Array * * Returns an array of Strings representing the names of the fields in the result. */ static VALUE pgresult_fields(self) VALUE self; { PGresult *result; VALUE ary; int n, i; result = get_pgresult(self); n = PQnfields(result); ary = rb_ary_new2(n); for (i=0;i<n;i++) { rb_ary_push(ary, rb_tainted_str_new2(PQfname(result, i))); } return ary; }