7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb', line 7
def type_cast(value)
case value
when ActiveModel::Type::Binary::Data
lob_value = value == "" ? " " : value
bind_type = OCI8::BLOB
ora_value = bind_type.new(_connection.raw_oci_connection, lob_value)
ora_value.size = 0 if value == ""
ora_value
when Type::OracleEnhanced::Text::Data
lob_value = value.to_s == "" ? " " : value.to_s
bind_type = OCI8::CLOB
ora_value = bind_type.new(_connection.raw_oci_connection, lob_value)
ora_value.size = 0 if value.to_s == ""
ora_value
when Type::OracleEnhanced::NationalCharacterText::Data
lob_value = value.to_s == "" ? " " : value.to_s
bind_type = OCI8::NCLOB
ora_value = bind_type.new(_connection.raw_oci_connection, lob_value)
ora_value.size = 0 if value.to_s == ""
ora_value
else
super
end
end
|