Module: ArJdbc::H2

Includes:
HSQLDB
Defined in:
lib/arjdbc/h2/adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HSQLDB

#_execute, #add_column, #add_limit_offset!, #change_column_default, column_selector, #create_database, #drop_database, #last_insert_id, #modify_types, #quote, #quote_column_name, #quote_string, #quoted_false, #quoted_true, #recreate_database, #remove_index, #rename_column, #rename_table, #type_to_sql

Class Method Details

.arel2_visitors(config) ⇒ Object



15
16
17
18
# File 'lib/arjdbc/h2/adapter.rb', line 15

def self.arel2_visitors(config)
  v = HSQLDB.arel2_visitors(config)
  v.merge({}.tap {|v| %w(h2 jdbch2).each {|a| v[a] = ::Arel::Visitors::HSQLDB } })
end

.jdbc_connection_classObject



7
8
9
# File 'lib/arjdbc/h2/adapter.rb', line 7

def self.jdbc_connection_class
  ::ActiveRecord::ConnectionAdapters::H2JdbcConnection
end

Instance Method Details

#adapter_nameObject

:nodoc:



11
12
13
# File 'lib/arjdbc/h2/adapter.rb', line 11

def adapter_name #:nodoc:
  'H2'
end

#change_column(table_name, column_name, type, options = {}) ⇒ Object

:nodoc:



32
33
34
35
36
# File 'lib/arjdbc/h2/adapter.rb', line 32

def change_column(table_name, column_name, type, options = {}) #:nodoc:
  execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} #{type_to_sql(type, options[:limit])}"
  change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)
  change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)
end

#columns(table_name, name = nil) ⇒ Object



28
29
30
# File 'lib/arjdbc/h2/adapter.rb', line 28

def columns(table_name, name=nil)
  @connection.columns_internal(table_name.to_s, name, h2_schema)
end

#h2_adapterObject



20
21
22
# File 'lib/arjdbc/h2/adapter.rb', line 20

def h2_adapter
  true
end

#tablesObject



24
25
26
# File 'lib/arjdbc/h2/adapter.rb', line 24

def tables
  @connection.tables(nil, h2_schema)
end