Class: Chicago::Database::TypeConverters::MysqlTypeConverter Private
- Inherits:
-
DbTypeConverter
- Object
- DbTypeConverter
- Chicago::Database::TypeConverters::MysqlTypeConverter
- Defined in:
- lib/chicago/database/type_converters.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
MySql-specific type conversion strategy
Instance Method Summary collapse
- #db_type(column) ⇒ Object private
- #integer_type(min, max) ⇒ Object private
-
#table_options ⇒ Object
private
Returns table options for a dimension or fact table.
Methods inherited from DbTypeConverter
Instance Method Details
#db_type(column) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
72 73 74 75 |
# File 'lib/chicago/database/type_converters.rb', line 72 def db_type(column) return :enum if column.elements && column.elements.size < 65_536 super(column) end |
#integer_type(min, max) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/chicago/database/type_converters.rb', line 84 def integer_type(min, max) return :integer unless min && max case when in_numeric_range?(min, max, TINY_INT_MAX) then :tinyint when in_numeric_range?(min, max, SMALL_INT_MAX) then :smallint when in_numeric_range?(min, max, MEDIUM_INT_MAX) then :mediumint when in_numeric_range?(min, max, INT_MAX) then :integer when in_numeric_range?(min, max, BIG_INT_MAX) then :bigint else raise ArgumentError.new("#{min} is too small or #{max} is too large for a single column") end end |
#table_options ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns table options for a dimension or fact table.
Dimension tables are defined as MyISAM tables in MySQL.
80 81 82 |
# File 'lib/chicago/database/type_converters.rb', line 80 def {:engine => "myisam"} end |