Skip to content

Commit

Permalink
guard against missing schema when querying for the views (localytics#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
gspugh-sb authored and zokioki committed Aug 30, 2024
1 parent 73c3ad5 commit 9f85bd6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/odbc_adapter/schema_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ def tables(_name = nil)

# Returns an array of view names defined in the database.
def views
views_query = "SHOW VIEWS IN SCHEMA #{current_schema}"
views_query = "SHOW VIEWS IN SCHEMA #{current_database}.#{current_schema}"

# Temporarily disable debug logging
query_results = ActiveRecord::Base.logger.silence do
exec_query(views_query)
begin
exec_query(views_query)
rescue ODBC_UTF8::Error
[]
end
end

query_results.map { |query_result| format_case(query_result["name"]) }
Expand Down

0 comments on commit 9f85bd6

Please sign in to comment.