Sha256: 7f55757f4246ac05923133023a50e70e31c50d9349ddf02be4ac826eafca7aee

Contents?: true

Size: 889 Bytes

Versions: 15

Compression:

Stored size: 889 Bytes

Contents

require 'jdbc_adapter/tsql_helper'

module ::JdbcSpec
  module ActiveRecordExtensions
    def cachedb_connection( config )
      config[:port] ||= 1972
      config[:url] ||= "jdbc:Cache://#{config[:host]}:#{config[:port]}/#{ config[:database]}"
      config[:driver] ||= "com.intersys.jdbc.CacheDriver"
      jdbc_connection( config )
    end
  end

  module CacheDB
    include TSqlMethods

    def self.adapter_matcher(name, *)
     name =~ /cache/i ? self : false
    end

    def self.column_selector
      [ /cache/i, lambda {  | cfg, col | col.extend( ::JdbcSpec::CacheDB::Column ) } ]
    end

    module Column
    end
    
    def create_table(name, options = { })
      super(name, options)
      primary_key = options[:primary_key] || "id"
      execute "ALTER TABLE #{name} ADD CONSTRAINT #{name}_PK PRIMARY KEY(#{primary_key})" unless options[:id] == false
    end
  end
end

Version data entries

15 entries across 15 versions & 4 rubygems

Version Path
saturnflyer-activerecord-jdbc-adapter-0.9.3 lib/jdbc_adapter/jdbc_cachedb.rb
kb-activerecord-jdbc-adapter-0.9.7.1-java lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.7-java lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.6-java lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.5-java lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.4-java lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.3-java lib/jdbc_adapter/jdbc_cachedb.rb
jpzwarte-activerecord-jdbc-adapter-0.9.2.6 lib/jdbc_adapter/jdbc_cachedb.rb
jpzwarte-activerecord-jdbc-adapter-0.9.2.5 lib/jdbc_adapter/jdbc_cachedb.rb
jpzwarte-activerecord-jdbc-adapter-0.9.2.4 lib/jdbc_adapter/jdbc_cachedb.rb
jpzwarte-activerecord-jdbc-adapter-0.9.2.3 lib/jdbc_adapter/jdbc_cachedb.rb
jpzwarte-activerecord-jdbc-adapter-0.9.2.2 lib/jdbc_adapter/jdbc_cachedb.rb
jpzwarte-activerecord-jdbc-adapter-0.9.2.1 lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.2 lib/jdbc_adapter/jdbc_cachedb.rb
activerecord-jdbc-adapter-0.9.1 lib/jdbc_adapter/jdbc_cachedb.rb