oracle-enhanced icon indicating copy to clipboard operation
oracle-enhanced copied to clipboard

OracleEnhancedAdapter.emulate_booleans doesn't work

Open areman opened this issue 3 years ago • 4 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.

areman avatar Jan 21 '22 09:01 areman

Just encountered this issue. We believe the issue was introduced in this commit https://github.com/rsim/oracle-enhanced/commit/34ca92b39cc048d490db71dd8fb8284579b87c48

andynu avatar Jun 14 '22 16:06 andynu

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

andynu avatar Jun 14 '22 17:06 andynu

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.

andynu avatar Jun 14 '22 18:06 andynu

I am happy to review pull requests with tests. https://github.com/rsim/oracle-enhanced/pull/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.

yahonda avatar Jun 15 '22 03:06 yahonda

Closed via #2301

yahonda avatar Sep 15 '22 14:09 yahonda