aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-01-29 02:08:30 -0500
committerRafael França <rafaelmfranca@gmail.com>2016-01-29 02:08:30 -0500
commit40d402d8f76861a5b21738d4c9eeef036fe4eae1 (patch)
tree23b43cff144caaf6e4ae64995194c8541c3d06c8 /activerecord/lib/active_record
parent22261405a38dbab84c98925fb4cfbef700d400a4 (diff)
parent82dc7786297a20a7a32e6bee7884ec1d4335410e (diff)
downloadrails-40d402d8f76861a5b21738d4c9eeef036fe4eae1.tar.gz
rails-40d402d8f76861a5b21738d4c9eeef036fe4eae1.tar.bz2
rails-40d402d8f76861a5b21738d4c9eeef036fe4eae1.zip
Merge pull request #23188 from jcoleman/ar-connection-execute-docs-clarification
Clarify DatabaseStatements#execute docs re: memory usage.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb2
2 files changed, 7 insertions, 1 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 7a2a1a0e33..7e0c9f7837 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -69,7 +69,11 @@ module ActiveRecord
end
undef_method :select_rows
- # Executes the SQL statement in the context of this connection.
+ # Executes the SQL statement in the context of this connection and returns
+ # the raw result from the connection adapter.
+ # Note: depending on your database connector, the result returned by this
+ # method may be manually memory managed. Consider using the exec_query
+ # wrapper instead.
def execute(sql, name = nil)
end
undef_method :execute
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index 6c15facf3b..8c7cfae7c1 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -128,6 +128,8 @@ module ActiveRecord
# Executes an SQL statement, returning a PGresult object on success
# or raising a PGError exception otherwise.
+ # Note: the PGresult object is manually memory managed; if you don't
+ # need it specifically, you many want consider the exec_query wrapper.
def execute(sql, name = nil)
log(sql, name) do
@connection.async_exec(sql)