mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #17337 from claudiob/remove-duplicate-select-method
Remove duplicate 'select' database statement
This commit is contained in:
commit
c1dc9b3584
5 changed files with 3 additions and 17 deletions
|
@ -337,8 +337,9 @@ module ActiveRecord
|
|||
|
||||
# Returns an ActiveRecord::Result instance.
|
||||
def select(sql, name = nil, binds = [])
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
undef_method :select
|
||||
|
||||
|
||||
# Returns the last auto-generated ID from the affected table.
|
||||
def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
|
||||
|
|
|
@ -232,11 +232,6 @@ module ActiveRecord
|
|||
|
||||
alias exec_without_stmt exec_query
|
||||
|
||||
# Returns an ActiveRecord::Result instance.
|
||||
def select(sql, name = nil, binds = [])
|
||||
exec_query(sql, name)
|
||||
end
|
||||
|
||||
def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
|
||||
super
|
||||
id_value || @connection.last_id
|
||||
|
|
|
@ -465,7 +465,7 @@ module ActiveRecord
|
|||
|
||||
def select(sql, name = nil, binds = [])
|
||||
@connection.query_with_result = true
|
||||
rows = exec_query(sql, name, binds)
|
||||
rows = super
|
||||
@connection.more_results && @connection.next_result # invoking stored procedures with CLIENT_MULTI_RESULTS requires this to tidy up else connection will be dropped
|
||||
rows
|
||||
end
|
||||
|
|
|
@ -698,12 +698,6 @@ module ActiveRecord
|
|||
exec_query("SELECT currval('#{sequence_name}')", 'SQL')
|
||||
end
|
||||
|
||||
# Executes a SELECT query and returns the results, performing any data type
|
||||
# conversions that are required to be performed here instead of in PostgreSQLColumn.
|
||||
def select(sql, name = nil, binds = [])
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
|
||||
# Returns the list of a table's column names, data types, and default values.
|
||||
#
|
||||
# The underlying query is roughly:
|
||||
|
|
|
@ -514,10 +514,6 @@ module ActiveRecord
|
|||
register_class_with_limit m, %r(char)i, SQLite3String
|
||||
end
|
||||
|
||||
def select(sql, name = nil, binds = []) #:nodoc:
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
|
||||
def table_structure(table_name)
|
||||
structure = exec_query("PRAGMA table_info(#{quote_table_name(table_name)})", 'SCHEMA').to_hash
|
||||
raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty?
|
||||
|
|
Loading…
Reference in a new issue