aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorclaudiob <claudiob@gmail.com>2014-10-20 11:05:11 -0700
committerclaudiob <claudiob@gmail.com>2014-10-20 11:05:11 -0700
commitec981aa1f05983754d661723e7d910ed4e1d4b28 (patch)
treea1b142931e38178d92ab5dadde40eb019956fe5a /activesupport
parent74a527cc63ef56f3d0a42cf638299958dc7cb08c (diff)
downloadrails-ec981aa1f05983754d661723e7d910ed4e1d4b28.tar.gz
rails-ec981aa1f05983754d661723e7d910ed4e1d4b28.tar.bz2
rails-ec981aa1f05983754d661723e7d910ed4e1d4b28.zip
Remove duplicate 'select' database statement
The `select` method has the same definition in almost all database adapters, so it can be moved from the database-specific adapters (PostgreSQl, MySQL, SQLite) to the abstract `database_statement`: ```ruby def select(sql, name = nil, binds = []) exec_query(sql, name, binds) end ``` --- More details about this commit: the only two DB-specific adapters that have a different definition of `select` are MySQLAdapter and MySQL2Adapter. In MySQLAdapter, `select` invokes `exec_query(sql, name, binds)`, so calling `super` achieves the same goal with less repetition. In MySQL2Adapter, `select` invokes `exec_query(sql, name)`, that is, it does not pass the `binds` parameter like other methods do. However, [MySQL2Adapter's `exec_query`](https://github.com/rails/rails/blob/74a527cc63ef56f3d0a42cf638299958dc7cb08c/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L228L231) works exactly the same whether this parameters is passed or not, so the output does not change: ```ruby def exec_query(sql, name = 'SQL', binds = []) result = execute(sql, name) ActiveRecord::Result.new(result.fields, result.to_a) end ```
Diffstat (limited to 'activesupport')
0 files changed, 0 insertions, 0 deletions