aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Martinez <sebastian@wyeworks.com>2011-05-03 21:26:02 -0300
committerSebastian Martinez <sebastian@wyeworks.com>2011-05-03 21:26:02 -0300
commit0ee2513356404f47f6d1ba1248e8d70421cef578 (patch)
tree64944dc1fd5ae195374bca2046f1a94c87575a00
parentfab9bb77bf1ee57e4cbb4d2c7d8cf474edc42709 (diff)
downloadrails-0ee2513356404f47f6d1ba1248e8d70421cef578.tar.gz
rails-0ee2513356404f47f6d1ba1248e8d70421cef578.tar.bz2
rails-0ee2513356404f47f6d1ba1248e8d70421cef578.zip
Improves Mysql2 adapter docs
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index d3a054c29b..2f64f2b077 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -5,6 +5,7 @@ require 'mysql2'
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 @@ module ActiveRecord
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 @@ module ActiveRecord
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 @@ module ActiveRecord
end
end
+ # SHOW VARIABLES LIKE 'name'.
def show_variable(name)
variables = select_all("SHOW VARIABLES LIKE '#{name}'")
variables.first['Value'] unless variables.empty?