From 9f85bd6a4be0c76ef800c33779e0757b661f39b9 Mon Sep 17 00:00:00 2001 From: Greg Pugh <108016789+gspugh-sb@users.noreply.github.com> Date: Wed, 8 May 2024 14:00:30 -0400 Subject: [PATCH] guard against missing schema when querying for the views (#39) --- lib/odbc_adapter/schema_statements.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/odbc_adapter/schema_statements.rb b/lib/odbc_adapter/schema_statements.rb index 43095cf0..c99c1fb9 100644 --- a/lib/odbc_adapter/schema_statements.rb +++ b/lib/odbc_adapter/schema_statements.rb @@ -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"]) }