aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJames Coleman <jtc331@gmail.com>2016-01-22 10:04:01 -0600
committerJames Coleman <jtc331@gmail.com>2016-01-22 10:04:01 -0600
commit82dc7786297a20a7a32e6bee7884ec1d4335410e (patch)
tree5b8485bfca75f85948d3b7fb4b531bfa604afd7d /activerecord
parent84461db61e8e50a1c7af0b3c5f8586d8ff001e80 (diff)
downloadrails-82dc7786297a20a7a32e6bee7884ec1d4335410e.tar.gz
rails-82dc7786297a20a7a32e6bee7884ec1d4335410e.tar.bz2
rails-82dc7786297a20a7a32e6bee7884ec1d4335410e.zip
Clarify DatabaseStatements#execute docs re: memory usage.
Diffstat (limited to 'activerecord')
-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)