Sha256: 07d18a2960ec8d85e6e60cf225feda5fef6da69139e357f47f94d140e818cef2

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

ArJdbc::ConnectionMethods.module_eval do
  def h2_connection(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:#{db}"
      end
    end
    config[:driver] ||= defined?(::Jdbc::H2.driver_name) ? ::Jdbc::H2.driver_name : 'org.h2.Driver'
    config[:adapter_spec] ||= ::ArJdbc::H2
    
    embedded_driver(config)
  end
  alias_method :jdbch2_connection, :h2_connection
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.3.2 lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-1.3.1 lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-1.3.0 lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-1.3.0.rc1 lib/arjdbc/h2/connection_methods.rb
activerecord-jdbc-adapter-1.3.0.beta2 lib/arjdbc/h2/connection_methods.rb