aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-05-04 19:36:26 +0200
committerXavier Noria <fxn@hashref.com>2010-05-04 19:36:26 +0200
commit583b60d109522907020700225f1c739737297a2d (patch)
treea36d986cbbb73c94d217cbe86c9af7ef97a89567 /activerecord/lib/active_record/connection_adapters
parent44a98967676492995d19fd4d541dbc9d52bf6b53 (diff)
parent0dd3b4630fea4bd4d4010b7096c9ee79d34c4501 (diff)
downloadrails-583b60d109522907020700225f1c739737297a2d.tar.gz
rails-583b60d109522907020700225f1c739737297a2d.tar.bz2
rails-583b60d109522907020700225f1c739737297a2d.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb2
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb8
4 files changed, 7 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
index 2f36bec764..2493095a04 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
@@ -10,8 +10,8 @@ module ActiveRecord
##
# :singleton-method:
# The connection handler
- cattr_accessor :connection_handler, :instance_writer => false
- @@connection_handler = ConnectionAdapters::ConnectionHandler.new
+ class_inheritable_accessor :connection_handler, :instance_writer => false
+ self.connection_handler = ConnectionAdapters::ConnectionHandler.new
# Returns the connection currently associated with the class. This can
# also be used to "borrow" the connection to do database work that isn't
@@ -54,7 +54,7 @@ module ActiveRecord
raise AdapterNotSpecified unless defined?(Rails.env)
establish_connection(Rails.env)
when ConnectionSpecification
- @@connection_handler.establish_connection(name, spec)
+ self.connection_handler.establish_connection(name, spec)
when Symbol, String
if configuration = configurations[spec.to_s]
establish_connection(configuration)
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
index 3c560903f7..533a7bb8e6 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -76,7 +76,7 @@ module ActiveRecord
def cache_sql(sql)
result =
if @query_cache.has_key?(sql)
- ActiveSupport::Notifications.instrument("active_record.sql",
+ ActiveSupport::Notifications.instrument("sql.active_record",
:sql => sql, :name => "CACHE", :connection_id => self.object_id)
@query_cache[sql]
else
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 578297029b..28a59c1e62 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -197,7 +197,7 @@ module ActiveRecord
def log(sql, name)
name ||= "SQL"
result = nil
- ActiveSupport::Notifications.instrument("active_record.sql",
+ ActiveSupport::Notifications.instrument("sql.active_record",
:sql => sql, :name => name, :connection_id => self.object_id) do
@runtime += Benchmark.ms { result = yield }
end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 74fed4ad62..6389094b8a 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -490,12 +490,8 @@ module ActiveRecord
execute "ROLLBACK"
end
- if defined?(PGconn::PQTRANS_IDLE)
- # The ruby-pg driver supports inspecting the transaction status,
- # while the ruby-postgres driver does not.
- def outside_transaction?
- @connection.transaction_status == PGconn::PQTRANS_IDLE
- end
+ def outside_transaction?
+ @connection.transaction_status == PGconn::PQTRANS_IDLE
end
def create_savepoint