Remove MySQL::DatabaseStatements#select_one
The implementation from abstract/database_statements.rb seems to work just fine.
And with ActiveRecord::Result now implementing an optimized #first method, the
performance concerns previously addressed in
bf79aa4fc1
should not be an issue.
This commit is contained in:
parent
e292ce8a4f
commit
af834fb2c0
@ -13,19 +13,6 @@ def select_all(arel, name = nil, binds = [], preparable: nil)
|
||||
result
|
||||
end
|
||||
|
||||
# Returns a record hash with the column names as keys and column values
|
||||
# as values.
|
||||
def select_one(arel, name = nil, binds = [])
|
||||
arel, binds = binds_from_relation(arel, binds)
|
||||
@connection.query_options.merge!(as: :hash)
|
||||
select_result(to_sql(arel, binds), name, binds) do |result|
|
||||
@connection.next_result while @connection.more_results?
|
||||
result.first
|
||||
end
|
||||
ensure
|
||||
@connection.query_options.merge!(as: :array)
|
||||
end
|
||||
|
||||
# Returns an array of arrays containing the field values.
|
||||
# Order is the same as that returned by +columns+.
|
||||
def select_rows(sql, name = nil, binds = [])
|
||||
|
Loading…
Reference in New Issue
Block a user