Module: JdbcSpec::CacheDB

Includes:
TSqlMethods
Defined in:
lib/jdbc_adapter/jdbc_cachedb.rb

Defined Under Namespace

Modules: Column

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TSqlMethods

#add_limit_offset!, #modify_types, #type_to_sql

Class Method Details

.adapter_matcher(name) ⇒ Object



16
17
18
# File 'lib/jdbc_adapter/jdbc_cachedb.rb', line 16

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

.column_selectorObject



20
21
22
# File 'lib/jdbc_adapter/jdbc_cachedb.rb', line 20

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

Instance Method Details

#create_table(name, options = { }) ⇒ Object



27
28
29
30
31
# File 'lib/jdbc_adapter/jdbc_cachedb.rb', line 27

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