Skip to content

Commit

Permalink
Better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Feb 3, 2017
1 parent 4c8b91f commit 746712b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/active_record/connection_adapters/odbc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
module ActiveRecord
class Base
class << self
def odbc_connection(config) # :nodoc:
def odbc_connection(config)
config = config.symbolize_keys

connection, options =
Expand Down
17 changes: 9 additions & 8 deletions lib/odbc_adapter/adapters/mysql_odbc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def unquoted_false
0
end

def disable_referential_integrity(&block) #:nodoc:
def disable_referential_integrity(&block)
old = select_value("SELECT @@FOREIGN_KEY_CHECKS")

begin
Expand All @@ -60,13 +60,14 @@ def disable_referential_integrity(&block) #:nodoc:
end
end

# Create a new MySQL database with optional <tt>:charset</tt> and <tt>:collation</tt>.
# Charset defaults to utf8.
# Create a new MySQL database with optional <tt>:charset</tt> and
# <tt>:collation</tt>. Charset defaults to utf8.
#
# Example:
# create_database 'charset_test', :charset => 'latin1', :collation => 'latin1_bin'
# create_database 'matt_development'
# create_database 'matt_development', :charset => :big5
# create_database 'charset_test', charset: 'latin1',
# collation: 'latin1_bin'
# create_database 'rails_development'
# create_database 'rails_development', charset: :big5
def create_database(name, options = {})
if options[:collation]
execute("CREATE DATABASE `#{name}` DEFAULT CHARACTER SET `#{options[:charset] || 'utf8'}` COLLATE `#{options[:collation]}`")
Expand All @@ -78,8 +79,8 @@ def create_database(name, options = {})
# Drops a MySQL database.
#
# Example:
# drop_database('sebastian_development')
def drop_database(name) #:nodoc:
# drop_database('rails_development')
def drop_database(name)
execute("DROP DATABASE IF EXISTS `#{name}`")
end

Expand Down
6 changes: 3 additions & 3 deletions lib/odbc_adapter/adapters/postgresql_odbc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def truncate(table_name, name = nil)

# Returns the sequence name for a table's primary key or some other
# specified key.
def default_sequence_name(table_name, pk = nil) #:nodoc:
def default_sequence_name(table_name, pk = nil)
serial_sequence(table_name, pk || 'id').split('.').last
rescue ActiveRecord::StatementInvalid
"#{table_name}_#{pk || 'id'}_seq"
Expand Down Expand Up @@ -63,7 +63,7 @@ def quote_string(string)
string.gsub(/\\/, '\&\&').gsub(/'/, "''")
end

def disable_referential_integrity #:nodoc:
def disable_referential_integrity
execute(tables.map { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(';'))
yield
ensure
Expand Down Expand Up @@ -105,7 +105,7 @@ def create_database(name, options = {})
#
# Example:
# drop_database 'rails_development'
def drop_database(name) #:nodoc:
def drop_database(name)
execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
end

Expand Down

0 comments on commit 746712b

Please sign in to comment.