Sha256: 9f081f32da0d4ea9cb8a9850282dfceb2f441bc9bc40508b775a970cfae20b74

Contents?: true

Size: 882 Bytes

Versions: 98

Compression:

Stored size: 882 Bytes

Contents

ArJdbc::ConnectionMethods.module_eval do
  def h2_connection(config)
    config[:adapter_spec] ||= ::ArJdbc::H2
    config[:adapter_class] = ActiveRecord::ConnectionAdapters::H2Adapter unless config.key?(:adapter_class)

    return jndi_connection(config) if jndi_config?(config)

    begin
      require 'jdbc/h2'
      ::Jdbc::H2.load_driver(:require) if defined?(::Jdbc::H2.load_driver)
    rescue LoadError # assuming driver.jar is on the class-path
    end

    config[:url] ||= begin
      db = config[:database]
      if db[0, 4] == 'mem:' || db[0, 5] == 'file:' || db[0, 5] == 'hsql:'
        "jdbc:h2:#{db}"
      else
        "jdbc:h2:file:#{File.expand_path(db)}"
      end
    end
    config[:driver] ||= defined?(::Jdbc::H2.driver_name) ? ::Jdbc::H2.driver_name : 'org.h2.Driver'

    embedded_driver(config)
  end
  alias_method :jdbch2_connection, :h2_connection
end

Version data entries

98 entries across 98 versions & 3 rubygems

Version Path
activerecord-jdbc-alt-adapter-61.3.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-71.0.0.alpha2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-71.0.0.alpha1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-70.2.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-70.2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-61.3-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-70.1.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-70.0.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-70.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-70.0.0.rc2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-60.3.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-61.2.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-70.0.0.rc1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-70.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-70.0.pre-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-61.2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-60.2.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-61.1.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-61.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-60.4-java lib/arjdbc/h2/connection_methods.rb