Module: ActiveRecord::ConnectionAdapters::OracleEnhanced::JDBCQuoting

Included in:
Quoting
Defined in:
lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb

Instance Method Summary collapse

Instance Method Details

#type_cast(value) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb', line 7

def type_cast(value)
  case value
  when ActiveModel::Type::Binary::Data
    blob = Java::OracleSql::BLOB.createTemporary(@raw_connection.raw_connection, false, Java::OracleSql::BLOB::DURATION_SESSION)
    blob.setBytes(1, value.to_s.to_java_bytes)
    blob
  when Type::OracleEnhanced::Text::Data
    clob = Java::OracleSql::CLOB.createTemporary(@raw_connection.raw_connection, false, Java::OracleSql::CLOB::DURATION_SESSION)
    clob.setString(1, value.to_s)
    clob
  when Type::OracleEnhanced::NationalCharacterText::Data
    clob = Java::OracleSql::NCLOB.createTemporary(@raw_connection.raw_connection, false, Java::OracleSql::NCLOB::DURATION_SESSION)
    clob.setString(1, value.to_s)
    clob
  else
    super
  end
end