Class | Sequel::Dataset::TYPE_TRANSLATOR
In: | lib/sequel/adapters/jdbc/derby.rb lib/sequel/adapters/jdbc/oracle.rb lib/sequel/adapters/jdbc/h2.rb lib/sequel/adapters/jdbc/jtds.rb lib/sequel/adapters/jdbc/postgresql.rb lib/sequel/adapters/jdbc.rb
Parent: | Object

Handle type conversions for common Java types.

### Methods

blob buffered_reader byte_array clob date decimal derby_clob h2_clob jtds_clob oracle_decimal pg_object time uuid

### Constants

LF | = | "\n".freeze

### Public Instance methods

blob(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 654
    654:         def blob(v) Sequel::SQL::Blob.new(String.from_java_bytes(v.getBytes(1, v.length))) end

buffered_reader(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 656
    656:         def buffered_reader(v)
    657:           lines = ""
    658:           c = false
    659:           while(line = v.read_line) do
    660:             lines << LF if c
    661:             lines << line
    662:             c ||= true
    663:           end
    664:           lines
    665:         end

byte_array(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 653
    653:         def byte_array(v) Sequel::SQL::Blob.new(String.from_java_bytes(v)) end

clob(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 655
    655:         def clob(v) Sequel::SQL::Blob.new(v.getSubString(1, v.length)) end

date(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 651
    651:         def date(v) Date.civil(v.getYear + 1900, v.getMonth + 1, v.getDate) end

decimal(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 652
    652:         def decimal(v) BigDecimal.new(v.to_string) end

derby_clob(v)

[Source]

         # File lib/sequel/adapters/jdbc/derby.rb, line 244
    244:           def derby_clob(v) v.getSubString(1, v.length) end

h2_clob(v)

[Source]

         # File lib/sequel/adapters/jdbc/h2.rb, line 181
    181:           def h2_clob(v) v.getSubString(1, v.length) end

jtds_clob(v)

[Source]

        # File lib/sequel/adapters/jdbc/jtds.rb, line 24
    24:           def jtds_clob(v) Sequel::SQL::Blob.new(v.getSubString(1, v.length)) end

oracle_decimal(v)

[Source]

        # File lib/sequel/adapters/jdbc/oracle.rb, line 80
    80:           def oracle_decimal(v)
    81:             if v.scale == 0
    82:               i = v.long_value
    83:               if v.equals(JAVA_BIG_DECIMAL.new(i))
    84:                 i
    85:               else
    86:                 decimal(v)
    87:               end
    88:             else
    89:               decimal(v)
    90:             end
    91:           end

pg_object(v)

Convert Java::OrgPostgresqlUtil::PGobject to ruby strings

[Source]

        # File lib/sequel/adapters/jdbc/postgresql.rb, line 46
    46:           def pg_object(v)
    47:             v.to_string
    48:           end

time(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 650
    650:         def time(v) Sequel.string_to_time("#{v.to_string}.#{sprintf('%03i', v.getTime.divmod(1000).last)}") end

uuid(v)

[Source]

         # File lib/sequel/adapters/jdbc.rb, line 666
    666:         def uuid(v) v.to_string end

[Validate]