7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/oracle_enhanced_plus_xmltype/oracle_enhanced_oci_connection_with_xmltype.rb', line 7
def typecast_result_value(value, get_lob_value)
case value
when Fixnum, Bignum
value
when String
if value.match(/\<\?xml/i)
Hash.from_xml(value)["hash"]
else
value
end
when Float, BigDecimal
value == (v_to_i = value.to_i) ? v_to_i : value
when OraNumber
value == (v_to_i = value.to_i) ? v_to_i : BigDecimal.new(value.to_s)
when OCI8::LOB
if get_lob_value
data = value.read || "" data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding) && value.is_a?(OCI8::BLOB)
data
else
value
end
when OraDate, Time, DateTime
if ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates && date_without_time?(value)
value.to_date
else
create_time_with_default_timezone(value)
end
when OraDate, Time, DateTime
if ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates && date_without_time?(value)
value.to_date
else
create_time_with_default_timezone(value)
end
else
value
end
end
|