Remove superfluous code and quote table name. References #9971 [jkit, nzkoz]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8015 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Michael Koziarski
2007-10-25 18:53:07 +00:00
parent 11d2a309c5
commit 96557eb35b

View File

@@ -442,9 +442,8 @@ module ActiveRecord
# Returns a table's primary key and belonging sequence.
def pk_and_sequence_for(table) #:nodoc:
table_desc_result = execute("describe #{table}")
keys = []
execute("describe #{table}").each_hash do |h|
execute("describe #{quote_table_name(table)}").each_hash do |h|
keys << h["Field"]if h["Key"] == "PRI"
end
keys.length == 1 ? [keys.first, nil] : nil