aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb5
-rw-r--r--activerecord/lib/active_record/connection_adapters/db2_adapter.rb4
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/mysql_adapter.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb4
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb4
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb4
6 files changed, 26 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 6a9ca8fcf1..5d2c764afe 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -356,6 +356,11 @@ module ActiveRecord
name
end
+ # Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
+ def adapter_name()
+ 'Abstract'
+ end
+
# Returns a string of the CREATE TABLE SQL statements for recreating the entire structure of the database.
def structure_dump() end
diff --git a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb
index 867b17eaa0..225ade0441 100644
--- a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb
@@ -74,6 +74,10 @@ begin
def quote_column_name(name) name; end
+ def adapter_name()
+ 'DB2'
+ end
+
def quote_string(s)
s.gsub(/'/, "''") # ' (for ruby-mode)
end
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 645e5f6dd4..c637a50c5a 100755
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -102,7 +102,11 @@ module ActiveRecord
def quote_column_name(name)
return "`#{name}`"
end
-
+
+ def adapter_name()
+ 'MySQL'
+ end
+
def structure_dump
select_all("SHOW TABLES").inject("") do |structure, table|
structure += select_one("SHOW CREATE TABLE #{table.to_a.first.last}")["Create Table"] + ";\n\n"
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index ef939d747b..67b26739ca 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -89,6 +89,10 @@ module ActiveRecord
return "\"#{name}\""
end
+ def adapter_name()
+ 'PostgreSQL'
+ end
+
private
def last_insert_id(table, column = "id")
sequence_name = "#{table}_#{column || 'id'}_seq"
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
index b8a91929c7..d8f3e04498 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -141,6 +141,10 @@ module ActiveRecord
return "'#{name}'"
end
+ def adapter_name()
+ 'SQLite'
+ end
+
protected
def table_structure(table_name)
execute "PRAGMA table_info(#{table_name})"
diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
index 84293736e3..7bddba9b5b 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -43,6 +43,10 @@ module ActiveRecord
raise ArgumentError, "No database specified. Missing argument: database."
end
+ def adapter_name()
+ 'SqlServer'
+ end
+
conn = DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data Source=#{host};Initial Catalog=#{database};User Id=#{username};Password=#{password};")
conn["AutoCommit"] = true