/* * call-seq: * res.size( index ) * * Returns the size of the field type in bytes. Returns <tt>-1</tt> if the field is variable sized. * * res = conn.exec("SELECT myInt, myVarChar50 FROM foo;") * res.size(0) => 4 * res.size(1) => -1 */ static VALUE pgresult_size(obj, index) VALUE obj, index; { PGresult *result; int i = NUM2INT(index); int size; result = get_pgresult(obj); if (i < 0 || i >= PQnfields(result)) { rb_raise(rb_eArgError,"invalid field number %d", i); } size = PQfsize(result, i); return INT2NUM(size); }