Skip to content
This repository
Browse code

Improves Mysql2 adapter docs

  • Loading branch information...
commit 0ee2513356404f47f6d1ba1248e8d70421cef578 1 parent fab9bb7
Sebastian Martinez authored May 03, 2011
6  activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -5,6 +5,7 @@
5 5
 
6 6
 module ActiveRecord
7 7
   class Base
  8
+    # Establishes a connection to the database that's used by all Active Record objects.
8 9
     def self.mysql2_connection(config)
9 10
       config[:username] = 'root' if config[:username].nil?
10 11
 
@@ -213,6 +214,8 @@ def requires_reloading?
213 214
         false
214 215
       end
215 216
 
  217
+      # Disconnects from the database if already connected.
  218
+      # Otherwise, this method does nothing.
216 219
       def disconnect!
217 220
         unless @connection.nil?
218 221
           @connection.close
@@ -368,6 +371,8 @@ def structure_dump
368 371
         end
369 372
       end
370 373
 
  374
+      # Drops the database specified on the +name+ attribute
  375
+      # and creates it again using the provided +options+.
371 376
       def recreate_database(name, options = {})
372 377
         drop_database(name)
373 378
         create_database(name, options)
@@ -538,6 +543,7 @@ def add_column_position!(sql, options)
538 543
         end
539 544
       end
540 545
 
  546
+      # SHOW VARIABLES LIKE 'name'.
541 547
       def show_variable(name)
542 548
         variables = select_all("SHOW VARIABLES LIKE '#{name}'")
543 549
         variables.first['Value'] unless variables.empty?

0 notes on commit 0ee2513

Please sign in to comment.
Something went wrong with that request. Please try again.