Class: Innodb::DataType
- Inherits:
-
Object
- Object
- Innodb::DataType
- Defined in:
- lib/innodb/data_type.rb
Defined Under Namespace
Classes: BinaryType, BitType, BlobType, CharacterType, DateType, DatetimeType, DecimalType, DoubleType, FloatType, IntegerType, TimeType, TimestampType, VariableBinaryType, VariableCharacterType, YearType
Constant Summary collapse
- TYPES =
Maps base type to data type class.
{ :BIT => BitType, :BOOL => IntegerType, :BOOLEAN => IntegerType, :TINYINT => IntegerType, :SMALLINT => IntegerType, :MEDIUMINT => IntegerType, :INT => IntegerType, :INT6 => IntegerType, :BIGINT => IntegerType, :FLOAT => FloatType, :DOUBLE => DoubleType, :DECIMAL => DecimalType, :NUMERIC => DecimalType, :CHAR => CharacterType, :VARCHAR => VariableCharacterType, :BINARY => BinaryType, :VARBINARY => VariableBinaryType, :TINYBLOB => BlobType, :BLOB => BlobType, :MEDIUMBLOB => BlobType, :LONGBLOB => BlobType, :TINYTEXT => BlobType, :TEXT => BlobType, :MEDIUMTEXT => BlobType, :LONGTEXT => BlobType, :YEAR => YearType, :TIME => TimeType, :DATE => DateType, :DATETIME => DatetimeType, :TIMESTAMP => TimestampType, }
Class Method Summary collapse
- .make_name(base_type, modifiers, properties) ⇒ Object
- .new(base_type, modifiers, properties) ⇒ Object
Class Method Details
.make_name(base_type, modifiers, properties) ⇒ Object
348 349 350 351 352 353 354 |
# File 'lib/innodb/data_type.rb', line 348 def self.make_name(base_type, modifiers, properties) name = base_type.to_s name << '(' + modifiers.join(',') + ')' if not modifiers.empty? name << " " name << properties.join(' ') name.strip end |
.new(base_type, modifiers, properties) ⇒ Object
356 357 358 359 |
# File 'lib/innodb/data_type.rb', line 356 def self.new(base_type, modifiers, properties) raise "Data type '#{base_type}' is not supported" unless TYPES.key?(base_type) TYPES[base_type].new(base_type, modifiers, properties) end |