# File lib/innodb/data_dictionary.rb, line 159 def self.mtype_prtype_to_type_string(mtype, prtype, len, prec) mysql_type = prtype & COLUMN_PRTYPE_MYSQL_TYPE_MASK internal_type = MYSQL_TYPE_BY_VALUE[mysql_type] external_type = MYSQL_TYPE[internal_type][:type] case external_type when :VARCHAR # One-argument: length. "%s(%i)" % [external_type, len] when :FLOAT, :DOUBLE # Two-argument: length and precision. "%s(%i,%i)" % [external_type, len, prec] when :CHAR if COLUMN_MTYPE_BY_VALUE[mtype] == :MYSQL # When the mtype is :MYSQL, the column is actually # stored as VARCHAR despite being a CHAR. This is # done for CHAR columns having multi-byte character # sets in order to limit size. Note that such data # are still space-padded to at least len. "VARCHAR(%i)" % [len] else "CHAR(%i)" % [len] end when :DECIMAL # The DECIMAL type is designated as DECIMAL(M,D) # however the M and D definitions are not stored # in the InnoDB data dictionary. We need to define # the column as something which will extract the # raw bytes in order to read the column, but we # can't figure out the right decimal type. The # len stored here is actually the on-disk storage # size. "CHAR(%i)" % [len] else external_type end end