Skip to content

Commit 496e75d

Browse files
Updating documentation
1 parent 32d364c commit 496e75d

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,32 @@ Oracle R2DBC's implementation of Publishers that emit multiple items will
344344
typically defer execution until a Subscriber signals demand, and not support
345345
multiple subscribers.
346346

347-
### Errors
347+
### Errors and Warnings
348348
Oracle R2DBC creates R2dbcExceptions having the same ORA-XXXXX error codes
349-
used by Oracle Database and Oracle JDBC.
349+
used by Oracle Database and Oracle JDBC. The
350+
[Database Error Messages](https://docs.oracle.com/en/database/oracle/oracle-database/21/errmg/ORA-00000.html#GUID-27437B7F-F0C3-4F1F-9C6E-6780706FB0F6)
351+
document provides a reference for all ORA-XXXXX error codes.
350352

351-
A reference for the ORA-XXXXX error codes can be found
352-
[here](https://docs.oracle.com/en/database/oracle/oracle-database/21/errmg/ORA-00000.html#GUID-27437B7F-F0C3-4F1F-9C6E-6780706FB0F6)
353+
Warning messages from Oracle Database are emitted as
354+
`oracle.r2dbc.OracleR2dbcWarning` segments. These segments may be consumed using
355+
`Result.flatMap(Function)`:
356+
```java
357+
result.flatMap(segment -> {
358+
if (segment instanceof OracleR2dbcWarning) {
359+
logWarning(((OracleR2dbcWarning)segment).getMessage());
360+
return emptyPublisher();
361+
}
362+
else if (segment instanceof Result.Message){
363+
... handle an error ...
364+
}
365+
else {
366+
... handle other segment types ...
367+
}
368+
})
369+
```
370+
Unlike the errors of standard `Result.Message` segments, if a warning is not
371+
consumed by `flatMap`, then it will be silently discarded when a `Result` is
372+
consumed using the `map` or `getRowsUpdated` methods.
353373

354374
### Transactions
355375
Oracle R2DBC uses READ COMMITTED as the default transaction isolation level.

src/main/java/oracle/r2dbc/OracleR2dbcWarning.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package oracle.r2dbc;
22

3-
import io.r2dbc.spi.R2dbcException;
43
import io.r2dbc.spi.Result;
54

65
import java.util.function.Function;
76
import java.util.function.Predicate;
87

98
/**
109
* <p>
11-
* A subtype of the {@link Result.Segment} interface that provides information
12-
* on warnings raised by Oracle Database.
10+
* A subtype of {@link Result.Message} that provides information on warnings
11+
* raised by Oracle Database.
1312
* </p><p>
1413
* When a SQL command results in a warning, Oracle R2DBC emits a {@link Result}
1514
* with an {@code OracleR2dbcWarning} segment in addition to any other segments
@@ -55,4 +54,4 @@
5554
*/
5655
public interface OracleR2dbcWarning extends Result.Message {
5756

58-
}
57+
}

0 commit comments

Comments
 (0)