Sha256: c974ae3dd04df11cf5f694e80fa76dedd1f37376f831de7b9d3668ab022310d0

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'rubygems'
require 'data_objects'
if RUBY_PLATFORM =~ /java/
  require 'do_jdbc'
  require 'java'
  gem 'jdbc-mysql'
  require 'jdbc/mysql' # the JDBC driver, packaged as a gem
end

require 'do_mysql_ext'
require File.expand_path(File.join(File.dirname(__FILE__), 'do_mysql', 'version'))
require File.expand_path(File.join(File.dirname(__FILE__), 'do_mysql', 'transaction'))

if RUBY_PLATFORM =~ /java/
  # Another way of loading the JDBC Class. This seems to be more reliable
  # than Class.forName() within the data_objects.Connection Java class,
  # which is currently not working as expected.
  import 'com.mysql.jdbc.Driver'

  module DataObjects
    module Mysql
      class Connection
        def self.pool_size
          20
        end

        def using_socket?
          @using_socket
        end

        def character_set
          # JDBC API does not provide an easy way to get the current character set
          reader = self.create_command("SHOW VARIABLES LIKE 'character_set_client'").execute_reader
          reader.next!
          char_set = reader.values[1]
          reader.close
          char_set.downcase
        end

      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
do_mysql-0.9.12-java lib/do_mysql.rb
do_mysql-0.9.12-x86-mingw32 lib/do_mysql.rb
do_mysql-0.9.12 lib/do_mysql.rb
do_mysql-0.9.12-x86-mswin32-60 lib/do_mysql.rb