rsim/oracle-enhanced

OracleEnhancedAdapter.emulate_booleans doesn't work

areman opened this issue · 5 comments

On load of OracleEnhancedAdapter the TYPE_MAP will be initialized. But that makes it impossible to set OracleEnhancedAdapter.emulate_booleans = false. To set it to false you need to require the ruby source file, and OracleEnhancedAdapter.emulate_booleans = false is always set after the TYPE_MAP is nitialized.

Just encountered this issue. We believe the issue was introduced in this commit 34ca92b

Here is a monkey patching initializer workaround. https://gist.github.com/andynu/9522d16ab85fd4ec2c2c31903fbe249d

Would the maintainers be interested in a PR along the lines of the workaround? Converting the TYPE_MAP constant into a class attribute? I'd be happy to provide one, but wasn't sure if that is the direction you'd like to go since it would involve re-parsing the mappings later in the load process. I'm not sure if there is a better approach to more lazily set the type_map so that the configs can be set before the first time it is initialized.

I am happy to review pull requests with tests. #2199 aims to reduce amount of memory in Rails 7.0. So converting the TYPE_MAP into constant may introduce the same memory usage as Rails 6.1 or older.

Closed via #2301