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-51.3.2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-52.2.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-51.3.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-52.2.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-51.3.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-50.3.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-alt-adapter-50.3.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-60.0.rc1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-52.2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-51.3-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-50.3-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-52.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-51.2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-50.2-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-1.3.25 lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-52.0-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-51.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-50.1-java lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-51.0 lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-1.3.24 lib/arjdbc/h2/connection_methods.rb