/* * call-seq: * res.ftype( column_number ) * * Returns the data type associated with _column_number_. * * The integer returned is the internal +OID+ number (in PostgreSQL) of the type. */ static VALUE pgresult_ftype(self, index) VALUE self, index; { PGresult* result = get_pgresult(self); int i = NUM2INT(index); if (i < 0 || i >= PQnfields(result)) { rb_raise(rb_eArgError, "invalid field number %d", i); } return INT2NUM(PQftype(result, i)); }