Class: Sequel::JDBC::Dataset::TYPE_TRANSLATOR
- Defined in:
- lib/sequel/adapters/jdbc.rb,
lib/sequel/adapters/jdbc/h2.rb,
lib/sequel/adapters/jdbc/db2.rb,
lib/sequel/adapters/jdbc/jtds.rb,
lib/sequel/adapters/jdbc/derby.rb,
lib/sequel/adapters/jdbc/oracle.rb,
lib/sequel/adapters/jdbc/postgresql.rb,
lib/sequel/adapters/jdbc/sqlanywhere.rb
Overview
JAVA_H2_CLOB = Java::OrgH2Jdbc::JdbcClob
Constant Summary collapse
- LF =
"\n".freeze
Instance Method Summary collapse
- #blob(v) ⇒ Object
- #buffered_reader(v) ⇒ Object
- #byte_array(v) ⇒ Object
- #clob(v) ⇒ Object
- #date(v) ⇒ Object
- #db2_clob(v) ⇒ Object
- #decimal(v) ⇒ Object
- #derby_clob(v) ⇒ Object
- #h2_clob(v) ⇒ Object
- #hash_map(v) ⇒ Object
- #jtds_clob(v) ⇒ Object
- #oracle_decimal(v) ⇒ Object
-
#pg_object(v) ⇒ Object
Convert Java::OrgPostgresqlUtil::PGobject to ruby strings.
- #sqla_boolean(i) ⇒ Object
- #time(v) ⇒ Object
- #uuid(v) ⇒ Object
Instance Method Details
#blob(v) ⇒ Object
752 |
# File 'lib/sequel/adapters/jdbc.rb', line 752 def blob(v) Sequel::SQL::Blob.new(String.from_java_bytes(v.getBytes(1, v.length))) end |
#buffered_reader(v) ⇒ Object
754 755 756 757 758 759 760 761 762 763 |
# File 'lib/sequel/adapters/jdbc.rb', line 754 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) ⇒ Object
751 |
# File 'lib/sequel/adapters/jdbc.rb', line 751 def byte_array(v) Sequel::SQL::Blob.new(String.from_java_bytes(v)) end |
#clob(v) ⇒ Object
753 |
# File 'lib/sequel/adapters/jdbc.rb', line 753 def clob(v) v.getSubString(1, v.length) end |
#date(v) ⇒ Object
749 |
# File 'lib/sequel/adapters/jdbc.rb', line 749 def date(v) Date.civil(v.getYear + 1900, v.getMonth + 1, v.getDate) end |
#db2_clob(v) ⇒ Object
64 |
# File 'lib/sequel/adapters/jdbc/db2.rb', line 64 def db2_clob(v) Sequel::SQL::Blob.new(v.getSubString(1, v.length)) end |
#decimal(v) ⇒ Object
750 |
# File 'lib/sequel/adapters/jdbc.rb', line 750 def decimal(v) BigDecimal.new(v.to_string) end |
#derby_clob(v) ⇒ Object
252 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 252 def derby_clob(v) v.getSubString(1, v.length) end |
#h2_clob(v) ⇒ Object
199 |
# File 'lib/sequel/adapters/jdbc/h2.rb', line 199 def h2_clob(v) v.getSubString(1, v.length) end |
#hash_map(v) ⇒ Object
765 |
# File 'lib/sequel/adapters/jdbc.rb', line 765 def hash_map(v) v.to_hash end |
#jtds_clob(v) ⇒ Object
30 |
# File 'lib/sequel/adapters/jdbc/jtds.rb', line 30 def jtds_clob(v) v.getSubString(1, v.length) end |
#oracle_decimal(v) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/sequel/adapters/jdbc/oracle.rb', line 91 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) ⇒ Object
Convert Java::OrgPostgresqlUtil::PGobject to ruby strings
113 114 115 |
# File 'lib/sequel/adapters/jdbc/postgresql.rb', line 113 def pg_object(v) v.to_string end |
#sqla_boolean(i) ⇒ Object
35 |
# File 'lib/sequel/adapters/jdbc/sqlanywhere.rb', line 35 def sqla_boolean(i) i != 0 end |
#time(v) ⇒ Object
748 |
# File 'lib/sequel/adapters/jdbc.rb', line 748 def time(v) Sequel.string_to_time("#{v.to_string}.#{sprintf('%03i', v.getTime.divmod(1000).last)}") end |
#uuid(v) ⇒ Object
764 |
# File 'lib/sequel/adapters/jdbc.rb', line 764 def uuid(v) v.to_string end |