Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improves Mysql2 adapter docs

  • Loading branch information...
commit 0ee2513356404f47f6d1ba1248e8d70421cef578 1 parent fab9bb7
@smartinez87 smartinez87 authored
View
6 activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -5,6 +5,7 @@
module ActiveRecord
class Base
+ # Establishes a connection to the database that's used by all Active Record objects.
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
@@ -213,6 +214,8 @@ def requires_reloading?
false
end
+ # Disconnects from the database if already connected.
+ # Otherwise, this method does nothing.
def disconnect!
unless @connection.nil?
@connection.close
@@ -368,6 +371,8 @@ def structure_dump
end
end
+ # Drops the database specified on the +name+ attribute
+ # and creates it again using the provided +options+.
def recreate_database(name, options = {})
drop_database(name)
create_database(name, options)
@@ -538,6 +543,7 @@ def add_column_position!(sql, options)
end
end
+ # SHOW VARIABLES LIKE 'name'.
def show_variable(name)
variables = select_all("SHOW VARIABLES LIKE '#{name}'")
variables.first['Value'] unless variables.empty?
Please sign in to comment.
Something went wrong with that request. Please try again.