| Class | Mysql::Field |
| In: |
mysql.c
|
| Parent: | Object |
hash
/* hash */
static VALUE field_hash(VALUE obj)
{
VALUE h = rb_hash_new();
rb_hash_aset(h, rb_str_new2("name"), rb_iv_get(obj, "name"));
rb_hash_aset(h, rb_str_new2("table"), rb_iv_get(obj, "table"));
rb_hash_aset(h, rb_str_new2("def"), rb_iv_get(obj, "def"));
rb_hash_aset(h, rb_str_new2("type"), rb_iv_get(obj, "type"));
rb_hash_aset(h, rb_str_new2("length"), rb_iv_get(obj, "length"));
rb_hash_aset(h, rb_str_new2("max_length"), rb_iv_get(obj, "max_length"));
rb_hash_aset(h, rb_str_new2("flags"), rb_iv_get(obj, "flags"));
rb_hash_aset(h, rb_str_new2("decimals"), rb_iv_get(obj, "decimals"));
return h;
}
inspect
/* inspect */
static VALUE field_inspect(VALUE obj)
{
VALUE n = rb_iv_get(obj, "name");
VALUE s = rb_str_new(0, RSTRING(n)->len + 16);
sprintf(RSTRING(s)->ptr, "#<Mysql::Field:%s>", RSTRING(n)->ptr);
return s;
}
/* is_not_null? */
static VALUE field_is_not_null(VALUE obj)
{
return IS_NOT_NULL(NUM2INT(rb_iv_get(obj, "flags"))) ? Qtrue : Qfalse;
}