class Sequel::JDBC::Dataset::TYPE_TRANSLATOR
Handle type conversions for common Java types.
JAVA_H2_CLOB = Java::OrgH2Jdbc::JdbcClob
Constants
- LF
Public Instance Methods
blob(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 707 def blob(v) Sequel::SQL::Blob.new(String.from_java_bytes(v.getBytes(1, v.length))) end
buffered_reader(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 709 def buffered_reader(v) lines = "" c = false while(line = v.read_line) do lines << LF if c lines << line c ||= true end lines end
byte_array(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 706 def byte_array(v) Sequel::SQL::Blob.new(String.from_java_bytes(v)) end
clob(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 708 def clob(v) v.getSubString(1, v.length) end
date(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 704 def date(v) Date.civil(v.getYear + 1900, v.getMonth + 1, v.getDate) end
db2_clob(v)
click to toggle source
# File lib/sequel/adapters/jdbc/db2.rb, line 60 def db2_clob(v) Sequel::SQL::Blob.new(v.getSubString(1, v.length)) end
decimal(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 705 def decimal(v) BigDecimal.new(v.to_string) end
derby_clob(v)
click to toggle source
# File lib/sequel/adapters/jdbc/derby.rb, line 252 def derby_clob(v) v.getSubString(1, v.length) end
h2_clob(v)
click to toggle source
# File lib/sequel/adapters/jdbc/h2.rb, line 199 def h2_clob(v) v.getSubString(1, v.length) end
jtds_clob(v)
click to toggle source
# File lib/sequel/adapters/jdbc/jtds.rb, line 30 def jtds_clob(v) v.getSubString(1, v.length) end
oracle_decimal(v)
click to toggle source
# File lib/sequel/adapters/jdbc/oracle.rb, line 87 def oracle_decimal(v) if v.scale == 0 i = v.long_value if v.equals(JAVA_BIG_DECIMAL_CONSTRUCTOR.call(i)) i else decimal(v) end else decimal(v) end end
pg_object(v)
click to toggle source
Convert Java::OrgPostgresqlUtil::PGobject to ruby strings
# File lib/sequel/adapters/jdbc/postgresql.rb, line 109 def pg_object(v) v.to_string end
time(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 703 def time(v) Sequel.string_to_time("#{v.to_string}.#{sprintf('%03i', v.getTime.divmod(1000).last)}") end
uuid(v)
click to toggle source
# File lib/sequel/adapters/jdbc.rb, line 719 def uuid(v) v.to_string end