Class: ActiveFacts::Metamodel::DataType::DefaultContext
- Inherits:
-
Context
- Object
- Context
- ActiveFacts::Metamodel::DataType::DefaultContext
show all
- Defined in:
- lib/activefacts/metamodel/datatypes.rb
Instance Method Summary
collapse
Methods inherited from Context
#choose_integer_range, #initialize
Instance Method Details
#boolean_type ⇒ Object
120
121
122
|
# File 'lib/activefacts/metamodel/datatypes.rb', line 120
def boolean_type
'CHAR'
end
|
#default_length(data_type, type_name) ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/activefacts/metamodel/datatypes.rb', line 99
def default_length data_type, type_name
case data_type
when TYPE_Real
53 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|Long)([a-z ]|\b)/i
64
else
32
end
else
nil
end
end
|
#integer_ranges ⇒ Object
90
91
92
93
94
95
96
97
|
# File 'lib/activefacts/metamodel/datatypes.rb', line 90
def integer_ranges
[
['SMALLINT', -2**15, 2**15-1, 16], ['INTEGER', -2**31, 2**31-1, 32], ['BIGINT', -2**63, 2**63-1, 64], ]
end
|
#surrogate_type ⇒ Object
124
125
126
|
# File 'lib/activefacts/metamodel/datatypes.rb', line 124
def surrogate_type
'BIGINT'
end
|