Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

favor map over each in mysql* adapters #370

Merged
merged 1 commit into from
May 2, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,9 @@ def collation
end

def tables(name = nil)
tables = []
execute("SHOW TABLES", 'SCHEMA').each do |field|
tables << field.first
execute("SHOW TABLES", 'SCHEMA').collect do |field|
field.first
end
tables
end

def drop_table(table_name, options = {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,8 @@ def collation
end

def tables(name = nil, database = nil) #:nodoc:
tables = []
result = execute(["SHOW TABLES", database].compact.join(' IN '), 'SCHEMA')
result.each { |field| tables << field[0] }
tables = result.collect { |field| field[0] }
result.free
tables
end
Expand Down Expand Up @@ -607,9 +606,8 @@ def indexes(table_name, name = nil)#:nodoc:
# Returns an array of +MysqlColumn+ objects for the table specified by +table_name+.
def columns(table_name, name = nil)#:nodoc:
sql = "SHOW FIELDS FROM #{quote_table_name(table_name)}"
columns = []
result = execute(sql, 'SCHEMA')
result.each { |field| columns << MysqlColumn.new(field[0], field[4], field[1], field[2] == "YES") }
columns = result.collect { |field| MysqlColumn.new(field[0], field[4], field[1], field[2] == "YES") }
result.free
columns
end
Expand Down