aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb12
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb12
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb28
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb4
7 files changed, 33 insertions, 33 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
index fab5bd0db7..e444cec72b 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -363,31 +363,31 @@ module ActiveRecord
private
# Returns a subquery for the given key using the join information.
- def subquery_for(key, select) # :doc:
+ def subquery_for(key, select)
subselect = select.clone
subselect.projections = [key]
subselect
end
# Returns an ActiveRecord::Result instance.
- def select(sql, name = nil, binds = []) # :doc:
+ def select(sql, name = nil, binds = [])
exec_query(sql, name, binds, prepare: false)
end
- def select_prepared(sql, name = nil, binds = []) # :doc:
+ def select_prepared(sql, name = nil, binds = [])
exec_query(sql, name, binds, prepare: true)
end
- def sql_for_insert(sql, pk, id_value, sequence_name, binds) # :doc:
+ def sql_for_insert(sql, pk, id_value, sequence_name, binds)
[sql, binds]
end
- def last_inserted_id(result) # :doc:
+ def last_inserted_id(result)
row = result.rows.first
row && row.first
end
- def binds_from_relation(relation, binds) # :doc:
+ def binds_from_relation(relation, binds)
if relation.is_a?(Relation) && binds.empty?
relation, binds = relation.arel, relation.bound_attributes
end
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 2b131045db..9c820ce585 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -1171,7 +1171,7 @@ module ActiveRecord
private
- def add_index_sort_order(quoted_columns, **options) # :doc:
+ def add_index_sort_order(quoted_columns, **options)
if order = options[:order]
case order
when Hash
@@ -1186,7 +1186,7 @@ module ActiveRecord
end
# Overridden by the MySQL adapter for supporting index lengths
- def add_options_for_index_columns(quoted_columns, **options) # :doc:
+ def add_options_for_index_columns(quoted_columns, **options)
if supports_index_sort_order?
quoted_columns = add_index_sort_order(quoted_columns, options)
end
@@ -1194,14 +1194,14 @@ module ActiveRecord
quoted_columns
end
- def quoted_columns_for_index(column_names, **options) # :doc:
+ def quoted_columns_for_index(column_names, **options)
return [column_names] if column_names.is_a?(String)
quoted_columns = Hash[column_names.map { |name| [name.to_sym, quote_column_name(name).dup] }]
add_options_for_index_columns(quoted_columns, options).values
end
- def index_name_for_remove(table_name, options = {}) # :doc:
+ def index_name_for_remove(table_name, options = {})
return options[:name] if can_remove_index_by_name?(options)
checks = []
@@ -1231,7 +1231,7 @@ module ActiveRecord
end
end
- def rename_table_indexes(table_name, new_name) # :doc:
+ def rename_table_indexes(table_name, new_name)
indexes(new_name).each do |index|
generated_index_name = index_name(table_name, column: index.columns)
if generated_index_name == index.name
@@ -1240,7 +1240,7 @@ module ActiveRecord
end
end
- def rename_column_indexes(table_name, column_name, new_column_name) # :doc:
+ def rename_column_indexes(table_name, column_name, new_column_name)
column_name, new_column_name = column_name.to_s, new_column_name.to_s
indexes(table_name).each do |index|
next unless index.columns.include?(new_column_name)
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 1badbb576d..4046b3829d 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -571,7 +571,7 @@ module ActiveRecord
end
end
- def translate_exception_class(e, sql) # :doc:
+ def translate_exception_class(e, sql)
begin
message = "#{e.class.name}: #{e.message}: #{sql}"
rescue Encoding::CompatibilityError
@@ -596,7 +596,7 @@ module ActiveRecord
raise translate_exception_class(e, sql)
end
- def translate_exception(exception, message) # :doc:
+ def translate_exception(exception, message)
# override in derived class
case exception
when RuntimeError
@@ -606,7 +606,7 @@ module ActiveRecord
end
end
- def without_prepared_statement?(binds) # :doc:
+ def without_prepared_statement?(binds)
!prepared_statements || binds.empty?
end
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
index 68a88e71ba..0717fc4526 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -701,7 +701,7 @@ module ActiveRecord
end
end
- def extract_precision(sql_type) # :doc:
+ def extract_precision(sql_type)
if /time/.match?(sql_type)
super || 0
else
@@ -709,11 +709,11 @@ module ActiveRecord
end
end
- def fetch_type_metadata(sql_type, extra = "") # :doc:
+ def fetch_type_metadata(sql_type, extra = "")
MySQL::TypeMetadata.new(super(sql_type), extra: extra)
end
- def add_index_length(quoted_columns, **options) # :doc:
+ def add_index_length(quoted_columns, **options)
if length = options[:length]
case length
when Hash
@@ -727,7 +727,7 @@ module ActiveRecord
quoted_columns
end
- def add_options_for_index_columns(quoted_columns, **options) # :doc:
+ def add_options_for_index_columns(quoted_columns, **options)
quoted_columns = add_index_length(quoted_columns, options)
super
end
@@ -743,7 +743,7 @@ module ActiveRecord
ER_CANNOT_ADD_FOREIGN = 1215
ER_CANNOT_CREATE_TABLE = 1005
- def translate_exception(exception, message) # :doc:
+ def translate_exception(exception, message)
case error_number(exception)
when ER_DUP_ENTRY
RecordNotUnique.new(message)
@@ -770,13 +770,13 @@ module ActiveRecord
end
end
- def add_column_sql(table_name, column_name, type, options = {}) # :doc:
+ def add_column_sql(table_name, column_name, type, options = {})
td = create_table_definition(table_name)
cd = td.new_column_definition(column_name, type, options)
schema_creation.accept(AddColumnDefinition.new(cd))
end
- def change_column_sql(table_name, column_name, type, options = {}) # :doc:
+ def change_column_sql(table_name, column_name, type, options = {})
column = column_for(table_name, column_name)
unless options_include_default?(options)
@@ -796,7 +796,7 @@ module ActiveRecord
schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
end
- def rename_column_sql(table_name, column_name, new_column_name) # :doc:
+ def rename_column_sql(table_name, column_name, new_column_name)
column = column_for(table_name, column_name)
options = {
default: column.default,
@@ -810,30 +810,30 @@ module ActiveRecord
schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
end
- def remove_column_sql(table_name, column_name, type = nil, options = {}) # :doc:
+ def remove_column_sql(table_name, column_name, type = nil, options = {})
"DROP #{quote_column_name(column_name)}"
end
- def remove_columns_sql(table_name, *column_names) # :doc:
+ def remove_columns_sql(table_name, *column_names)
column_names.map { |column_name| remove_column_sql(table_name, column_name) }
end
- def add_index_sql(table_name, column_name, options = {}) # :doc:
+ def add_index_sql(table_name, column_name, options = {})
index_name, index_type, index_columns, _, index_algorithm, index_using = add_index_options(table_name, column_name, options)
index_algorithm[0, 0] = ", " if index_algorithm.present?
"ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_algorithm}"
end
- def remove_index_sql(table_name, options = {}) # :doc:
+ def remove_index_sql(table_name, options = {})
index_name = index_name_for_remove(table_name, options)
"DROP INDEX #{index_name}"
end
- def add_timestamps_sql(table_name, options = {}) # :doc:
+ def add_timestamps_sql(table_name, options = {})
[add_column_sql(table_name, :created_at, :datetime, options), add_column_sql(table_name, :updated_at, :datetime, options)]
end
- def remove_timestamps_sql(table_name, options = {}) # :doc:
+ def remove_timestamps_sql(table_name, options = {})
[remove_column_sql(table_name, :updated_at), remove_column_sql(table_name, :created_at)]
end
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
index 1e13890eca..78e7181266 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
@@ -54,7 +54,7 @@ module ActiveRecord
private
- def last_inserted_id(result) # :doc:
+ def last_inserted_id(result)
@connection.last_id
end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 72947a78f5..0ebd907cc0 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -415,7 +415,7 @@ module ActiveRecord
SERIALIZATION_FAILURE = "40001"
DEADLOCK_DETECTED = "40P01"
- def translate_exception(exception, message) # :doc:
+ def translate_exception(exception, message)
return exception unless exception.respond_to?(:result)
case exception.result.try(:error_field, PGresult::PG_DIAG_SQLSTATE)
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
index f2c84cd782..e761b9531a 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -518,11 +518,11 @@ module ActiveRecord
SELECT #{quoted_from_columns} FROM #{quote_table_name(from)}")
end
- def sqlite_version # :doc:
+ def sqlite_version
@sqlite_version ||= SQLite3Adapter::Version.new(select_value("select sqlite_version(*)"))
end
- def translate_exception(exception, message) # :doc:
+ def translate_exception(exception, message)
case exception.message
# SQLite 3.8.2 returns a newly formatted error message:
# UNIQUE constraint failed: *table_name*.*column_name*