Class: Mysql::Field

Inherits:
Object
  • Object
show all
Defined in:
ext/mysql.c

Constant Summary collapse

TYPE_TINY =

:Field constant: TYPE

Mysql
TYPE_ENUM =
INT2NUM(FIELD_TYPE_ENUM)
TYPE_DECIMAL =
INT2NUM(FIELD_TYPE_DECIMAL)
TYPE_SHORT =
INT2NUM(FIELD_TYPE_SHORT)
TYPE_LONG =
INT2NUM(FIELD_TYPE_LONG)
TYPE_FLOAT =
INT2NUM(FIELD_TYPE_FLOAT)
TYPE_DOUBLE =
INT2NUM(FIELD_TYPE_DOUBLE)
TYPE_NULL =
INT2NUM(FIELD_TYPE_NULL)
TYPE_TIMESTAMP =
INT2NUM(FIELD_TYPE_TIMESTAMP)
TYPE_LONGLONG =
INT2NUM(FIELD_TYPE_LONGLONG)
TYPE_INT24 =
INT2NUM(FIELD_TYPE_INT24)
TYPE_DATE =
INT2NUM(FIELD_TYPE_DATE)
TYPE_TIME =
INT2NUM(FIELD_TYPE_TIME)
TYPE_DATETIME =
INT2NUM(FIELD_TYPE_DATETIME)
TYPE_YEAR =
INT2NUM(FIELD_TYPE_YEAR)
TYPE_BIT =
INT2NUM(FIELD_TYPE_BIT)
TYPE_NEWDECIMAL =
INT2NUM(FIELD_TYPE_NEWDECIMAL)
TYPE_SET =
INT2NUM(FIELD_TYPE_SET)
TYPE_BLOB =
INT2NUM(FIELD_TYPE_BLOB)
TYPE_STRING =
INT2NUM(FIELD_TYPE_STRING)
TYPE_VAR_STRING =
INT2NUM(FIELD_TYPE_VAR_STRING)
TYPE_CHAR =
INT2NUM(FIELD_TYPE_CHAR)
NOT_NULL_FLAG =

:Field constant: FLAG

Mysql
PRI_KEY_FLAG =
INT2NUM(PRI_KEY_FLAG)
UNIQUE_KEY_FLAG =
INT2NUM(UNIQUE_KEY_FLAG)
MULTIPLE_KEY_FLAG =
INT2NUM(MULTIPLE_KEY_FLAG)
BLOB_FLAG =
INT2NUM(BLOB_FLAG)
UNSIGNED_FLAG =
INT2NUM(UNSIGNED_FLAG)
ZEROFILL_FLAG =
INT2NUM(ZEROFILL_FLAG)
BINARY_FLAG =
INT2NUM(BINARY_FLAG)
ENUM_FLAG =
INT2NUM(ENUM_FLAG)
AUTO_INCREMENT_FLAG =
INT2NUM(AUTO_INCREMENT_FLAG)
TIMESTAMP_FLAG =
INT2NUM(TIMESTAMP_FLAG)
SET_FLAG =
INT2NUM(SET_FLAG)
NUM_FLAG =
INT2NUM(NUM_FLAG)
PART_KEY_FLAG =
INT2NUM(PART_KEY_FLAG)

Instance Method Summary collapse

Instance Method Details

#decimalsObject

#defObject

#flagsObject

#hashObject

hash



1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
# File 'ext/mysql.c', line 1690

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;
}

#inspectObject

inspect



1705
1706
1707
1708
1709
1710
1711
# File 'ext/mysql.c', line 1705

static VALUE field_inspect(VALUE obj)
{
    VALUE n = rb_iv_get(obj, "name");
    VALUE s = rb_str_new(0, RSTRING_LEN(n) + 16);
    sprintf(RSTRING_PTR(s), "#<Mysql::Field:%s>", RSTRING_PTR(n));
    return s;
}

#is_not_null?Boolean

is_not_null?

Returns:

  • (Boolean)


1736
1737
1738
1739
# File 'ext/mysql.c', line 1736

static VALUE field_is_not_null(VALUE obj)
{
    return IS_NOT_NULL(NUM2INT(rb_iv_get(obj, "flags"))) ? Qtrue : Qfalse;
}

#is_num?Boolean

Returns:

  • (Boolean)

#is_pri_key?Boolean

is_pri_key?

Returns:

  • (Boolean)


1744
1745
1746
1747
# File 'ext/mysql.c', line 1744

static VALUE field_is_pri_key(VALUE obj)
{
    return IS_PRI_KEY(NUM2INT(rb_iv_get(obj, "flags"))) ? Qtrue : Qfalse;
}

#lengthObject

#max_lengthObject

#nameObject

MysqlField object method

#tableObject

#typeObject