Class: Mysql::Field

Inherits:
Object
  • Object
show all
Defined in:
ext/mysql_api/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



1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
# File 'ext/mysql_api/mysql.c', line 1183

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



1198
1199
1200
1201
1202
1203
1204
# File 'ext/mysql_api/mysql.c', line 1198

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)


1229
1230
1231
1232
# File 'ext/mysql_api/mysql.c', line 1229

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)


1237
1238
1239
1240
# File 'ext/mysql_api/mysql.c', line 1237

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