Skip to content

Commit

Permalink
Moved methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jul 28, 2016
1 parent 2777277 commit 0bc5fbf
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/blazer/adapters/active_record_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ def self.name
end
end

def schemas
default_schema = (postgresql? || redshift?) ? "public" : connection_model.connection_config[:database]
settings["schemas"] || [connection_model.connection_config[:schema] || default_schema]
end

def tables
result = data_source.run_statement(connection_model.send(:sanitize_sql_array, ["SELECT table_name FROM information_schema.tables WHERE table_schema IN (?) ORDER BY table_name", schemas]))
result.rows.map(&:first)
end

def run_statement(statement, comment)
columns = []
rows = []
Expand All @@ -50,6 +40,16 @@ def run_statement(statement, comment)
[columns, rows, error]
end

def tables
result = data_source.run_statement(connection_model.send(:sanitize_sql_array, ["SELECT table_name FROM information_schema.tables WHERE table_schema IN (?) ORDER BY table_name", schemas]))
result.rows.map(&:first)
end

def schemas
default_schema = (postgresql? || redshift?) ? "public" : connection_model.connection_config[:database]
settings["schemas"] || [connection_model.connection_config[:schema] || default_schema]
end

def reconnect
connection_model.establish_connection(settings["url"])
end
Expand Down

0 comments on commit 0bc5fbf

Please sign in to comment.