remove performance overrides of select_one, select_value, and select_values in the AR adapter for now
This commit is contained in:
parent
1086233cc3
commit
00ab233606
@ -264,28 +264,33 @@ module ActiveRecord
|
|||||||
|
|
||||||
# DATABASE STATEMENTS ======================================
|
# DATABASE STATEMENTS ======================================
|
||||||
|
|
||||||
# Returns a record hash with the column names as keys and column values
|
# FIXME: re-enable the following once a "better" query_cache solution is in core
|
||||||
# as values.
|
#
|
||||||
def select_one(sql, name = nil)
|
# The overrides below perform much better than the originals in AbstractAdapter
|
||||||
result = execute(sql, name)
|
# because we're able to take advantage of mysql2's lazy-loading capabilities
|
||||||
result.each(:as => :hash) do |r|
|
#
|
||||||
return r
|
# # Returns a record hash with the column names as keys and column values
|
||||||
end
|
# # as values.
|
||||||
end
|
# def select_one(sql, name = nil)
|
||||||
|
# result = execute(sql, name)
|
||||||
# Returns a single value from a record
|
# result.each(:as => :hash) do |r|
|
||||||
def select_value(sql, name = nil)
|
# return r
|
||||||
result = execute(sql, name)
|
# end
|
||||||
if first = result.first
|
# end
|
||||||
first.first
|
#
|
||||||
end
|
# # Returns a single value from a record
|
||||||
end
|
# def select_value(sql, name = nil)
|
||||||
|
# result = execute(sql, name)
|
||||||
# Returns an array of the values of the first column in a select:
|
# if first = result.first
|
||||||
# select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
|
# first.first
|
||||||
def select_values(sql, name = nil)
|
# end
|
||||||
execute(sql, name).map { |row| row.first }
|
# end
|
||||||
end
|
#
|
||||||
|
# # Returns an array of the values of the first column in a select:
|
||||||
|
# # select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
|
||||||
|
# def select_values(sql, name = nil)
|
||||||
|
# execute(sql, name).map { |row| row.first }
|
||||||
|
# end
|
||||||
|
|
||||||
# Returns an array of arrays containing the field values.
|
# Returns an array of arrays containing the field values.
|
||||||
# Order is the same as that returned by +columns+.
|
# Order is the same as that returned by +columns+.
|
||||||
|
Loading…
Reference in New Issue
Block a user