Skip to content

Commit 23ab5a4

Browse files
committed
make schema attr lookup case insensitive
If the ODBC connection string doesn't specifically set the `schema` connection param name as all lowercase, the lookup for `current_schema` will result in `nil` which in turn leads to various errors that depend on this value being properly set. This lookup was only checking for strictly `schema` attribute, however, the ODBC connection string seems to allow for some flexibility in how its param names are formatted - we've seen these attributes writen as "schema", "Schema", or "SCHEMA" (e.g. this repo's README and code examples show the uppercase variant for its ODBC strings [1][2]). This makes the lookup case-insensitive to allow all variants of formatting for this attribute name. [1] https://github.com/doximity/odbc_adapter/blob/d36c64ee2973942558b960c706848db06f50ffde/README.md#L45 [2] https://github.com/doximity/odbc_adapter/blob/a18a9ef02d27488a3b2b31ad7c695743bc2ff098/lib/active_record/connection_adapters/odbc_adapter.rb#L56
1 parent 88fc21e commit 23ab5a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/odbc_adapter/schema_statements.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def current_database
193193
end
194194

195195
def current_schema
196-
@config[:driver].attrs['schema']
196+
@config[:driver].attrs.transform_keys(&:downcase)['schema']
197197
end
198198

199199
def name_regex(name)

0 commit comments

Comments
 (0)