/* * call-seq: * res.fnumber( name ) -> Fixnum * * Returns the index of the field specified by the string _name_. * * Raises an ArgumentError if the specified _name_ isn't one of the field names; * raises a TypeError if _name_ is not a String. */ static VALUE pgresult_fnumber(self, name) VALUE self, name; { int n; Check_Type(name, T_STRING); n = PQfnumber(get_pgresult(self), StringValuePtr(name)); if (n == -1) { rb_raise(rb_eArgError,"Unknown field: %s", StringValuePtr(name)); } return INT2FIX(n); }