-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make autoCommit, maxRows, outFormat, etc. connection attributes rather than global properties #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@mrapczynski I'm going to need some convincing that the added UI complexity is worth the flexibility. Early on we decided to make the attributes settable in two places: at the oracledb level and via Anyone else want to chime in with an opinion? |
I am definitely 👍 on removing it from global. The problem with having it globally is when you have to connect to multiple oracle db's or different schemas. You often want to have different settings depending on the usage scenario. So then, you're forced to send it with every execute. Another similar way it impacts the way we use it at my company, is that some of our services are deployed together and not separately. If two services, both end up using oracle, then those global settings are shared between the two. So if one service does not expect it, you can get bad results. That's the biggest problem with it. Keeping the option of setting it with every execute should be maintained if this considered since that's very useful in its own. |
I'm for connection level autocommit, as you need same value for all your operations when working with that connection in your specific scenario but other scenarios might not need same value. maxrows and outformat are really logical to set per operation, definitely not globally, because you write your output handling code based on that and you might do mixing in same scenario. |
To list them out, are these the options you want at the connection level? What about I could spend time quibbling that |
I think all of them. Thinking about this further...would it make sense to enable setting these options at several levels: global, pool, connection, and statement? Statement (execute) inherits and/or overrides settings from the connection, the connection from the pool, and the pool from global. |
A global/pool/connection/execute hierarchy is ultimately flexible but there is a cognitive burden and added complexity. I know the gut feel is that it would be "nice" but I'd like to see some detailed discussion of exactly how difficult it is to always set these at the execute level. |
outFormat, autoCommit, maxRows, fetchAsString are not app level settings. In simple-oracledb I check the output of the query to see how it is structured and based on that, different code is executed (for example if it is rows or resultset, if a row is array or object and so on...). |
Let's keep this in the todo list. |
Since |
This is enhancement request to make the various SQL execution properties such as
autoCommit
,maxRows
, oroutFormat
attributes of a connection whether directly established or acquired from a pool, and not global constants on theoracledb
object itself.I maintain an internal library for our developers that wraps around
node-oracledb
to provide a variety of conveniences like multiple named Oracle connections from external config, promisification, etc. I have had to do a measurable amount of extra engineering to work around the fact that something likeautoCommit
is a global property rather than a connection specific one.Off the top of my head, I think this per connection configurability could be something many developers might like to use and not just myself. If I recall right, the Java JDBC driver works in this way where these behaviors are per connection and not at the global driver level.
The text was updated successfully, but these errors were encountered: