Class: ActiveFacts::Metamodel::DataType::DefaultContext
- Defined in:
- lib/activefacts/metamodel/datatypes.rb
Direct Known Subclasses
Instance Method Summary collapse
- #boolean_type ⇒ Object
- #default_length(data_type, type_name) ⇒ Object
- #integer_ranges ⇒ Object
- #surrogate_type ⇒ Object
- #valid_from_type ⇒ Object
Methods inherited from Context
Instance Method Details
#boolean_type ⇒ Object
117 118 119 |
# File 'lib/activefacts/metamodel/datatypes.rb', line 117 def boolean_type 'CHAR' end |
#default_length(data_type, type_name) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/activefacts/metamodel/datatypes.rb', line 96 def default_length data_type, type_name case data_type when TYPE_Real 53 # IEEE Double precision floating point when TYPE_Integer case type_name when /([a-z ]|\b)Tiny([a-z ]|\b)/i 8 when /([a-z ]|\b)Small([a-z ]|\b)/i, /([a-z ]|\b)Short([a-z ]|\b)/i 16 when /([a-z ]|\b)Big([a-z ]|\b)/i 64 else 32 end else nil end end |
#integer_ranges ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/activefacts/metamodel/datatypes.rb', line 87 def integer_ranges # A set suitable for Standard SQL: [ ['SMALLINT', -2**15, 2**15-1, 16], # The SQL standard says -10^5..10^5 (less than 16 bits) ['INTEGER', -2**31, 2**31-1, 32], # The standard says -10^10..10^10 (more than 32 bits!) ['BIGINT', -2**63, 2**63-1, 64], # The standard says -10^19..10^19 (less than 64 bits) ] end |
#surrogate_type ⇒ Object
121 122 123 |
# File 'lib/activefacts/metamodel/datatypes.rb', line 121 def surrogate_type 'BIGINT' end |
#valid_from_type ⇒ Object
125 126 127 |
# File 'lib/activefacts/metamodel/datatypes.rb', line 125 def valid_from_type 'TIMESTAMP' end |