oracle / oracle-r2dbc

R2DBC Driver for Oracle Database
https://oracle.com
Other
197 stars 40 forks source link

Oracle Warning Segments #98

Closed Michael-A-McMahon closed 1 year ago

Michael-A-McMahon commented 2 years ago

This branch adds a new Result.Segment type for database warnings. The new type is intended for consumption by user code, so it is added as a public type in the oracle.r2dbc package: OracleR2dbcWarning.

In the previous release, warnings were emitted as Result.Message segments. Message segments cause onError signals to be emitted when consuming results of SQL calls. Based on discussions with several users, I'm convinced that this behavior was not correct. In the case of a warning, an onError signal is not helpful as it prevents user code from consuming the actual result of the SQL call. For instance, a call to Result.map(Function) would result in an error even if rows were successfully queried, but a warning was raised.

With this branch, warnings are emitted as a distinct message type. User code may choose to consume the warning if desired, but otherwise the warning will be ignored. This model is inspired by the JDBC API, which does not throw SQLWarning exceptions, but instead requires an explicit call to a getWarnings method.

Although it is similar to Result.Message, I choose to make OracleR2dbcWarning a distinct type. The intent of this is to avoid confusion for driver agnostic code which may (rightfully so) consider all Message segments to be errors. Driver agnostic code can then remain agnostic, and not need to reference a type that is specific to Oracle R2DBC in order to discern between errors and warnings.

Thanks to @larousso and @rathoreamrsingh for providing helpful discussions that lead to this change.

Michael-A-McMahon commented 2 years ago

I should look into the test action failure before we merge this. But I'm done for today, so it will have to wait until tomorrow.

rathoreamrsingh commented 1 year ago

Hi @Michael-A-McMahon May I know this fix will be available in which release of R2DBC? And will there be any release for the library based on 0.4.0 release?

Thanks

Michael-A-McMahon commented 1 year ago

We aim for quarterly releases, so we are already overdue for a 1.1.0 release. The team is working to make that available very soon, but I can't commit to a date just yet.

I know that a lot of programmers would like us to patch the 0.4.0 release, as it is currently the only one compatible with Spring. However, as time moves forward, a new release of Spring will be compatible with our 1.x releases. As a future investment, I want to sink all of my development effort into the 1.x releases.

I have no plan to update the older releases for now, as it would detract from the time I can put into development of newer releases. I know this not an ideal situation at the moment, but I think it will pay off when a new Spring release supports the 1.0.0 R2DBC SPI.