mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fixed error when running db:create with jdbcmysql
This commit is contained in:
@@ -70,7 +70,13 @@ db_namespace = namespace :db do
|
||||
@charset = ENV['CHARSET'] || 'utf8'
|
||||
@collation = ENV['COLLATION'] || 'utf8_unicode_ci'
|
||||
creation_options = {:charset => (config['charset'] || @charset), :collation => (config['collation'] || @collation)}
|
||||
error_class = config['adapter'] =~ /mysql2/ ? Mysql2::Error : Mysql::Error
|
||||
if config['adapter'] =~ /jdbc/
|
||||
#FIXME After Jdbcmysql gives this class
|
||||
require 'active_record/railties/jdbcmysql_error'
|
||||
error_class = ArJdbcMySQL::Error
|
||||
else
|
||||
error_class = config['adapter'] =~ /mysql2/ ? Mysql2::Error : Mysql::Error
|
||||
end
|
||||
access_denied_error = 1045
|
||||
begin
|
||||
ActiveRecord::Base.establish_connection(config.merge('database' => nil))
|
||||
|
||||
16
activerecord/lib/active_record/railties/jdbcmysql_error.rb
Normal file
16
activerecord/lib/active_record/railties/jdbcmysql_error.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
#FIXME Remove if ArJdbcMysql will give.
|
||||
module ArJdbcMySQL
|
||||
class Error < StandardError
|
||||
attr_accessor :error_number, :sql_state
|
||||
|
||||
def initialize msg
|
||||
super
|
||||
@error_number = nil
|
||||
@sql_state = nil
|
||||
end
|
||||
|
||||
# Mysql gem compatibility
|
||||
alias_method :errno, :error_number
|
||||
alias_method :error, :message
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user