Namespace

Included Modules

Files

Class/Module Index [+]

Quicksearch

ArJdbc::H2

Public Class Methods

arel2_visitors(config) click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 75
def self.arel2_visitors(config)
  visitors = HSQLDB.arel2_visitors(config)
  visitors.merge({
    'h2' => ::Arel::Visitors::HSQLDB,
    'jdbch2' => ::Arel::Visitors::HSQLDB,
  })
end
column_selector() click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 11
def self.column_selector
  [ /\.h2\./, lambda { |cfg, column| column.extend(::ArJdbc::H2::Column) } ]
end
jdbc_connection_class() click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 7
def self.jdbc_connection_class
  ::ActiveRecord::ConnectionAdapters::H2JdbcConnection
end

Public Instance Methods

columns(table_name, name = nil) click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 154
def columns(table_name, name = nil)
  @connection.columns_internal(table_name.to_s, name, h2_schema)
end
current_schema() click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 164
def current_schema
  execute('CALL SCHEMA()')[0].values[0]
end
explain(arel, binds = []) click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 185
def explain(arel, binds = [])
  sql = "EXPLAIN #{to_sql(arel, binds)}"
  raw_result  = execute(sql, "EXPLAIN", binds)
  raw_result[0].values.join("\n") # [ "SELECT \n ..." ].to_s
end
modify_types(types) click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 119
def modify_types(types)
  types
end
native_database_types() click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 115
def native_database_types
  NATIVE_DATABASE_TYPES.dup
end
supports_explain?() click to toggle source

EXPLAIN support :

# File lib/arjdbc/h2/adapter.rb, line 183
def supports_explain?; true; end
tables() click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 150
def tables
  @connection.tables(nil, h2_schema)
end
type_to_sql(type, limit = nil, precision = nil, scale = nil) click to toggle source
# File lib/arjdbc/h2/adapter.rb, line 123
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
  case type.to_sym
  when :integer
    case limit
    when 1; 'tinyint'
    when 2; 'smallint'
    when nil, 3, 4; 'int'
    when 5..8; 'bigint'
    else raise(ActiveRecordError, "No integer type has byte size #{limit}")
    end
  when :float
    case limit
    when 1..4; 'real'
    when 5..8; 'double'
    else raise(ActiveRecordError, "No float type has byte size #{limit}")
    end
  when :binary
    if limit && limit < 2 * 1024 * 1024
      'binary'
    else
      'blob'
    end
  else
    super
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.