1 require 'jdbc_adapter/tsql_helper'
4 module ActiveRecordExtensions
5 def cachedb_connection( config )
7 config[:url] ||= "jdbc:Cache://#{config[:host]}:#{config[:port]}/#{ config[:database]}"
8 config[:driver] ||= "com.intersys.jdbc.CacheDriver"
9 jdbc_connection( config )
16 def self.column_selector
17 [ /cache/i, lambda { | cfg, col | col.extend( ::JdbcSpec::CacheDB::Column ) } ]
20 def self.adapter_selector
21 [ /cache/i, lambda { | cfg, adapt | adapt.extend( ::JdbcSpec::CacheDB ) } ]
27 def create_table(name, options = { })
29 primary_key = options[:primary_key] || "id"
30 execute "ALTER TABLE #{name} ADD CONSTRAINT #{name}_PK PRIMARY KEY(#{primary_key})" unless options[:id] == false