Active Record MySQL2 Adapter
Methods
- A
- D
- E
- N
- Q
- S
Included Modules
Constants
ADAPTER_NAME | = | "Mysql2" |
ER_ACCESS_DENIED_ERROR | = | 1045 |
ER_BAD_DB_ERROR | = | 1049 |
ER_CONN_HOST_ERROR | = | 2003 |
ER_DBACCESS_DENIED_ERROR | = | 1044 |
ER_UNKNOWN_HOST_ERROR | = | 2005 |
TYPE_MAP | = | Type::TypeMap.new.tap { |m| initialize_type_map(m) } |
Class Public methods
new(...) Link
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 66 def initialize(...) super @config[:flags] ||= 0 if @config[:flags].kind_of? Array @config[:flags].push "FOUND_ROWS" else @config[:flags] |= ::Mysql2::Client::FOUND_ROWS end @connection_parameters ||= @config end
new_client(config) Link
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 35 def new_client(config) ::Mysql2::Client.new(config) rescue ::Mysql2::Error => error case error.error_number when ER_BAD_DB_ERROR raise ActiveRecord::NoDatabaseError.db_error(config[:database]) when ER_DBACCESS_DENIED_ERROR, ER_ACCESS_DENIED_ERROR raise ActiveRecord::DatabaseConnectionError.username_error(config[:username]) when ER_CONN_HOST_ERROR, ER_UNKNOWN_HOST_ERROR raise ActiveRecord::DatabaseConnectionError.hostname_error(config[:host]) else raise ActiveRecord::ConnectionNotEstablished, error.message end end
Instance Public methods
active?() Link
disconnect!() Link
Disconnects from the database if already connected. Otherwise, this method does nothing.
error_number(exception) Link
quote_string(string) Link
Quotes strings for use in SQL input.