/*      fetch_lengths()              */
static VALUE fetch_lengths(VALUE obj)
{
    MYSQL_RES* res;
    unsigned int n;
    unsigned long* lengths;
    VALUE ary;
    unsigned int i;
    check_free(obj);
    res = GetMysqlRes(obj);
    n = mysql_num_fields(res);
    lengths = mysql_fetch_lengths(res);
    if (lengths == NULL)
        return Qnil;
    ary = rb_ary_new2(n);
    for (i=0; i<n; i++)
        rb_ary_store(ary, i, INT2NUM(lengths[i]));
    return ary;
}