Sha256: fe1c2a8f932673f224525aad273034c63a314d247cb3ac26160aaefe2bc85175

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

require 'upsert/connection/jdbc'

class Upsert
  class Connection
    # @private
    class Java_ComMysqlJdbc_JDBC4Connection < Connection
      include Jdbc

      def quote_ident(k)
        if metal.useAnsiQuotedIdentifiers
          DOUBLE_QUOTE + k.to_s.gsub(DOUBLE_QUOTE, '""') + DOUBLE_QUOTE
        else
          # Escape backticks by doubling them.  Ref http://dev.mysql.com/doc/refman/5.7/en/identifiers.html
          BACKTICK + k.to_s.gsub(BACKTICK, BACKTICK + BACKTICK) + BACKTICK
        end
      end

      def bind_value(v)
        case v
        when DateTime, Time
          date = v.utc
          java.time.LocalDateTime.of(date.year, date.month, date.day, date.hour, date.min, date.sec, date.nsec)
        when Date
          java.time.LocalDate.of(v.year, v.month, v.day)
        else
          super
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
upsert-2.9.10-java lib/upsert/connection/Java_ComMysqlJdbc_JDBC4Connection.rb
upsert-2.9.10 lib/upsert/connection/Java_ComMysqlJdbc_JDBC4Connection.rb
upsert-2.9.9-universal-java-11 lib/upsert/connection/Java_ComMysqlJdbc_JDBC4Connection.rb
upsert-2.9.9 lib/upsert/connection/Java_ComMysqlJdbc_JDBC4Connection.rb