Sha256: 34a4d13cb20204bfecfc62153d6c1d4bba8a2cfbde6935a14f1eb7cc77dc4464

Contents?: true

Size: 1.31 KB

Versions: 28

Compression:

Stored size: 1.31 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
    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

28 entries across 28 versions & 1 rubygems

Version Path
do_mysql-0.10.8 lib/do_mysql.rb
do_mysql-0.10.8-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.8-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.8-java lib/do_mysql.rb
do_mysql-0.10.7-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.7-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.7 lib/do_mysql.rb
do_mysql-0.10.7-java lib/do_mysql.rb
do_mysql-0.10.6 lib/do_mysql.rb
do_mysql-0.10.6-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.6-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.6-java lib/do_mysql.rb
do_mysql-0.10.5 lib/do_mysql.rb
do_mysql-0.10.5-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.5-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.5-java lib/do_mysql.rb
do_mysql-0.10.4 lib/do_mysql.rb
do_mysql-0.10.4-x86-mswin32-60 lib/do_mysql.rb
do_mysql-0.10.4-x86-mingw32 lib/do_mysql.rb
do_mysql-0.10.4-java lib/do_mysql.rb