Permalink
Browse files

Free result_metadata directly instead of freeing 2nd, redundant call.

`result_metadata` returns a new object each time it is called, so calling `result_metadata.free` is essentially a noop.  Instead call `free` directly on the metadata when we're done with it.
  • Loading branch information...
1 parent 3baee09 commit 76a58e1e7e10d71ac47aa2a17e6436aca1b506fb @peterkovacs peterkovacs committed Aug 5, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -507,12 +507,12 @@ def exec_stmt(sql, name, binds)
cols = cache[:cols] ||= metadata.fetch_fields.map { |field|
field.name
}
+ metadata.free
end
result_set = ActiveRecord::Result.new(cols, stmt.to_a) if cols
affected_rows = stmt.affected_rows
- stmt.result_metadata.free if cols
stmt.free_result
stmt.close if binds.empty?

0 comments on commit 76a58e1

Please sign in to comment.