Files

Class/Module Index [+]

Quicksearch

ArJdbc::HSQLDB

Public Class Methods

arel2_visitors(config) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 67
def self.arel2_visitors(config)
  require 'arel/visitors/hsqldb'
  {
    'hsqldb' => ::Arel::Visitors::HSQLDB,
    'jdbchsqldb' => ::Arel::Visitors::HSQLDB,
  }
end
column_selector() click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 7
def self.column_selector
  [ /hsqldb/, lambda { |cfg, column| column.extend(::ArJdbc::HSQLDB::Column) } ]
end

Public Instance Methods

add_column(table_name, column_name, type, options = {}) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 139
def add_column(table_name, column_name, type, options = {})
  add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
  add_column_options!(add_column_sql, options)
  execute(add_column_sql)
end
create_database(name) click to toggle source

do nothing since database gets created upon connection. However this method gets called by rails db rake tasks so now we're avoiding method_missing error

# File lib/arjdbc/hsqldb/adapter.rb, line 212
def create_database(name)
end
drop_database(name) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 215
def drop_database(name)
  execute("DROP ALL OBJECTS")
end
last_insert_id() click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 168
def last_insert_id
  identity = select_value("CALL IDENTITY()")
  Integer(identity.nil? ? 0 : identity)
end
modify_types(types) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 95
def modify_types(types)
  super(types)
  types[:primary_key] = NATIVE_DATABASE_TYPES[:primary_key]
  types[:string] = NATIVE_DATABASE_TYPES[:string].dup
  #types[:integer][:limit] = nil
  #types[:boolean][:limit] = nil
  types[:text][:limit] = nil
  types
end
native_database_types() click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 91
def native_database_types
  super.merge NATIVE_DATABASE_TYPES
end
recreate_database(name, options = {}) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 205
def recreate_database(name, options = {})
  drop_database(name)
end
remove_index(table_name, options = {}) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 201
def remove_index(table_name, options = {})
  execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}"
end
rename_table(name, new_name) click to toggle source
# File lib/arjdbc/hsqldb/adapter.rb, line 164
def rename_table(name, new_name)
  execute "ALTER TABLE #{name} RENAME TO #{new_name}"
end
tables() click to toggle source

filter out system tables (that otherwise end up in db/schema.rb) JdbcConnection#tables now takes an optional block filter so we can screen out rows corresponding to system tables. HSQLDB names its system tables SYSTEM.*, but H2 seems to name them without any kind of convention

# File lib/arjdbc/hsqldb/adapter.rb, line 197
def tables
  @connection.tables.select { |row| row.to_s !~ /^system_/ }
end
type_to_sql(type, limit = nil, precision = nil, scale = nil) click to toggle source

Maps logical Rails types to MySQL-specific data types.

# File lib/arjdbc/hsqldb/adapter.rb, line 158
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
  return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil

  type
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.