Sha256: 5aea543adbf9bc9e93cd22aa2401033d45fde764cb372123e41f7ca1f3d38683

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 KB

Contents

require 'data_objects'
if RUBY_PLATFORM =~ /java/
  require 'do_jdbc'
  require 'java'

  module DataObjects
    module Mysql
      JDBC_DRIVER = 'com.mysql.jdbc.Driver'
    end
  end

  begin
    java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Mysql::JDBC_DRIVER, true)
  rescue java.lang.ClassNotFoundException
    require 'jdbc/mysql' # the JDBC driver, packaged as a gem
  end

  # Another way of loading the JDBC Class. This seems to be more reliable
  # than Class.forName() or
  # Thread.currentThread.getContextClassLoader().loadClass() within the
  # data_objects.Connection Java class, which is currently not working as
  # expected.
  java_import DataObjects::Mysql::JDBC_DRIVER

end

begin
  require 'do_mysql/do_mysql'
rescue LoadError
  if RUBY_PLATFORM =~ /mingw|mswin/
    RUBY_VERSION =~ /(\d+.\d+)/
    require "do_mysql/#{$1}/do_mysql"
  else
    raise
  end
end

require 'do_mysql/version'
require 'do_mysql/transaction' if RUBY_PLATFORM !~ /java/
require 'do_mysql/encoding'

if RUBY_PLATFORM =~ /java/

  DataObjects::Mysql::Connection.class_eval do

    def using_socket?
      @using_socket
    end

    def secure?
      false
    end

  end

else

  module DataObjects
    module Mysql
      class Connection
        def secure?
          !(@ssl_cipher.nil? || @ssl_cipher.empty?)
        end
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
do_mysql-0.10.11 lib/do_mysql.rb
do_mysql-0.10.11-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.11-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.11-java lib/do_mysql.rb
do_mysql-0.10.10 lib/do_mysql.rb
do_mysql-0.10.10-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.10-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.10-java lib/do_mysql.rb
do_mysql-0.10.9 lib/do_mysql.rb
do_mysql-0.10.9-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.9-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.9-java lib/do_mysql.rb