Class: Mysql::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/ventouse/mysql_compat.rb

Constant Summary collapse

TYPE_DECIMAL =

Field type

0
TYPE_TINY =
1
TYPE_SHORT =
2
TYPE_LONG =
3
TYPE_FLOAT =
4
TYPE_DOUBLE =
5
TYPE_NULL =
6
TYPE_TIMESTAMP =
7
TYPE_LONGLONG =
8
TYPE_INT24 =
9
TYPE_DATE =
10
TYPE_TIME =
11
TYPE_DATETIME =
12
TYPE_YEAR =
13
TYPE_NEWDATE =
14
TYPE_ENUM =
247
TYPE_SET =
248
TYPE_TINY_BLOB =
249
TYPE_MEDIUM_BLOB =
250
TYPE_LONG_BLOB =
251
TYPE_BLOB =
252
TYPE_VAR_STRING =
253
TYPE_STRING =
254
TYPE_GEOMETRY =
255
TYPE_CHAR =
TYPE_TINY
TYPE_INTERVAL =
TYPE_ENUM
NOT_NULL_FLAG =

Flag

1
PRI_KEY_FLAG =
2
UNIQUE_KEY_FLAG =
4
MULTIPLE_KEY_FLAG =
8
BLOB_FLAG =
16
UNSIGNED_FLAG =
32
ZEROFILL_FLAG =
64
BINARY_FLAG =
128
ENUM_FLAG =
256
AUTO_INCREMENT_FLAG =
512
TIMESTAMP_FLAG =
1024
SET_FLAG =
2048
NUM_FLAG =
32768
PART_KEY_FLAG =
16384
GROUP_FLAG =
32768
UNIQUE_FLAG =
65536

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, org_table, name, length, type, flags, decimals, def_value, max_length) ⇒ Field

Returns a new instance of Field.



741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/ventouse/mysql_compat.rb', line 741

def initialize(table, org_table, name, length, type, flags, decimals, def_value, max_length)
  @table = table
  @org_table = org_table
  @name = name
  @length = length
  @type = type
  @flags = flags
  @decimals = decimals
  @def = def_value
  @max_length = max_length
  if (type <= TYPE_INT24 and (type != TYPE_TIMESTAMP or length == 14 or length == 8)) or type == TYPE_YEAR then
	@flags |= NUM_FLAG
  end
end

Instance Attribute Details

#decimalsObject (readonly)

Returns the value of attribute decimals.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def decimals
  @decimals
end

#defObject (readonly)

Returns the value of attribute def.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def def
  @def
end

#flagsObject (readonly)

Returns the value of attribute flags.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def flags
  @flags
end

#lengthObject (readonly)

Returns the value of attribute length.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def length
  @length
end

#max_lengthObject (readonly)

Returns the value of attribute max_length.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def max_length
  @max_length
end

#nameObject (readonly)

Returns the value of attribute name.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def name
  @name
end

#org_tableObject (readonly)

Returns the value of attribute org_table.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def org_table
  @org_table
end

#tableObject (readonly)

Returns the value of attribute table.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def table
  @table
end

#typeObject (readonly)

Returns the value of attribute type.



755
756
757
# File 'lib/ventouse/mysql_compat.rb', line 755

def type
  @type
end

Instance Method Details

#inspectObject



757
758
759
# File 'lib/ventouse/mysql_compat.rb', line 757

def inspect()
  "#<#{self.class}:#{@name}>"
end