提交 1fc9ddbd 编写于 作者: A Abdelkader Boudih

Freeze ADAPTER_NAME in adapters

上级 a8827cb9
......@@ -66,6 +66,7 @@ module ConnectionAdapters # :nodoc:
# Most of the methods in the adapter are useful during migrations. Most
# notably, the instance methods provided by SchemaStatement are very useful.
class AbstractAdapter
ADAPTER_NAME = 'Abstract'.freeze
include Quoting, DatabaseStatements, SchemaStatements
include DatabaseLimits
include QueryCache
......@@ -167,7 +168,7 @@ def unprepared_statement
# Returns the human-readable name of the adapter. Use mixed case - one
# can always use downcase if needed.
def adapter_name
'Abstract'
self.class::ADAPTER_NAME
end
# Does this adapter support migrations?
......
......@@ -162,10 +162,6 @@ def initialize(connection, logger, connection_options, config)
end
end
def adapter_name #:nodoc:
self.class::ADAPTER_NAME
end
# Returns true, since this connection adapter supports migrations.
def supports_migrations?
true
......
......@@ -29,7 +29,7 @@ def mysql2_connection(config)
module ConnectionAdapters
class Mysql2Adapter < AbstractMysqlAdapter
ADAPTER_NAME = 'Mysql2'
ADAPTER_NAME = 'Mysql2'.freeze
def initialize(connection, logger, connection_options, config)
super
......
......@@ -66,7 +66,7 @@ module ConnectionAdapters
# * <tt>:sslcipher</tt> - Necessary to use MySQL with an SSL connection.
#
class MysqlAdapter < AbstractMysqlAdapter
ADAPTER_NAME = 'MySQL'
ADAPTER_NAME = 'MySQL'.freeze
class StatementPool < ConnectionAdapters::StatementPool
def initialize(connection, max = 1000)
......
......@@ -74,7 +74,7 @@ module ConnectionAdapters
# In addition, default connection parameters of libpq can be set per environment variables.
# See http://www.postgresql.org/docs/9.1/static/libpq-envars.html .
class PostgreSQLAdapter < AbstractAdapter
ADAPTER_NAME = 'PostgreSQL'
ADAPTER_NAME = 'PostgreSQL'.freeze
NATIVE_DATABASE_TYPES = {
primary_key: "serial primary key",
......@@ -118,11 +118,6 @@ class PostgreSQLAdapter < AbstractAdapter
include PostgreSQL::DatabaseStatements
include Savepoints
# Returns 'PostgreSQL' as adapter name for identification purposes.
def adapter_name
ADAPTER_NAME
end
def schema_creation # :nodoc:
PostgreSQL::SchemaCreation.new self
end
......
......@@ -67,6 +67,7 @@ def type_cast_for_database(value)
#
# * <tt>:database</tt> - Path to the database file.
class SQLite3Adapter < AbstractAdapter
ADAPTER_NAME = 'SQLite'.freeze
include Savepoints
NATIVE_DATABASE_TYPES = {
......@@ -147,10 +148,6 @@ def initialize(connection, logger, connection_options, config)
end
end
def adapter_name #:nodoc:
'SQLite'
end
def supports_ddl_transactions?
true
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册