class Rails::DataMapper::Storage::Mysql

Public Instance Methods

_create() click to toggle source
# File lib/dm-rails/storage.rb, line 159
def _create
  execute("CREATE DATABASE `#{database}` DEFAULT CHARACTER SET #{charset} DEFAULT COLLATE #{collation}")
end
_drop() click to toggle source
# File lib/dm-rails/storage.rb, line 163
def _drop
  execute("DROP DATABASE IF EXISTS `#{database}`")
end

Private Instance Methods

collation() click to toggle source
# File lib/dm-rails/storage.rb, line 180
def collation
  @collation ||= config['collation'] || ENV['COLLATION'] || 'utf8_unicode_ci'
end
execute(statement) click to toggle source
# File lib/dm-rails/storage.rb, line 169
def execute(statement)
  command = [
    'mysql',
    username.present? ? "--user=#{username}"     : nil,
    password.present? ? "--password=#{password}" : nil,
    '-e',
    statement,
  ].compact
  system(*command)
end