63
63
import java .time .OffsetDateTime ;
64
64
import java .time .OffsetTime ;
65
65
import java .time .Period ;
66
- import java .time .temporal .ChronoUnit ;
67
- import java .util .Arrays ;
68
66
import java .util .List ;
69
67
import java .util .Map ;
70
68
import java .util .NoSuchElementException ;
71
- import java .util .Objects ;
72
69
import java .util .TreeMap ;
73
- import java .util .concurrent .TimeUnit ;
74
70
import java .util .function .Function ;
75
71
import java .util .function .IntFunction ;
76
72
@@ -125,7 +121,6 @@ class OracleReadableImpl implements io.r2dbc.spi.Readable {
125
121
* {@code jdbcReadable}. Not null.
126
122
* @param jdbcReadable Readable values from a JDBC Driver. Not null.
127
123
* @param readablesMetadata Metadata of each value. Not null.
128
- * @param adapter Adapts JDBC calls into reactive streams. Not null.
129
124
*/
130
125
private OracleReadableImpl (
131
126
OracleConnectionImpl r2dbcConnection , DependentCounter dependentCounter ,
@@ -144,13 +139,12 @@ private OracleReadableImpl(
144
139
* provided {@code jdbcReadable} and {@code metadata}. The metadata
145
140
* object is used to determine the default type mapping of column values.
146
141
* </p>
147
- * @param jdbcConnection JDBC connection that created the
142
+ * @param r2dbcConnection R2DBC connection that created the
148
143
* {@code jdbcReadable}. Not null.
149
144
* @param dependentCounter Counter that is increased for each dependent
150
145
* {@code Result} created by the returned {@code Row}
151
146
* @param jdbcReadable Row data from the Oracle JDBC Driver. Not null.
152
147
* @param metadata Meta-data for the specified row. Not null.
153
- * @param adapter Adapts JDBC calls into reactive streams. Not null.
154
148
* @return A {@code Row} backed by the {@code jdbcReadable} and
155
149
* {@code metadata}. Not null.
156
150
*/
@@ -173,7 +167,6 @@ static Row createRow(
173
167
* {@code Result} created by the returned {@code OutParameters}
174
168
* @param jdbcReadable Row data from the Oracle JDBC Driver. Not null.
175
169
* @param metadata Meta-data for the specified row. Not null.
176
- * @param adapter Adapts JDBC calls into reactive streams. Not null.
177
170
* @return An {@code OutParameters} backed by the {@code jdbcReadable} and
178
171
* {@code metadata}. Not null.
179
172
*/
@@ -406,17 +399,6 @@ private Clob getClob(int index) {
406
399
*/
407
400
private LocalDateTime getLocalDateTime (int index ) {
408
401
return jdbcReadable .getObject (index , LocalDateTime .class );
409
- /*
410
- if (OracleR2dbcTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE
411
- .equals(readablesMetadata.get(index).getType())) {
412
- // TODO: Remove this when Oracle JDBC implements a correct conversion
413
- Timestamp timestamp = jdbcReadable.getObject(index, Timestamp.class);
414
- return timestamp == null ? null : timestamp.toLocalDateTime();
415
- }
416
- else {
417
- return jdbcReadable.getObject(index, LocalDateTime.class);
418
- }
419
- */
420
402
}
421
403
422
404
/**
@@ -741,7 +723,7 @@ private static Map<String, Object> toMap(OracleReadableImpl readable) {
741
723
private <T ,U > Function <T ,U > getMappingFunction (
742
724
Class <T > fromType , Class <U > toType ) {
743
725
744
- Function <? extends Object , Object > mappingFunction = null ;
726
+ Function <?, Object > mappingFunction = null ;
745
727
746
728
if (toType .isAssignableFrom (fromType )) {
747
729
return toType ::cast ;
@@ -857,20 +839,7 @@ else if (INTERVALYM.class.isAssignableFrom(fromType)
857
839
}
858
840
else if (INTERVALDS .class .isAssignableFrom (fromType )
859
841
&& toType .isAssignableFrom (Duration .class )) {
860
- mappingFunction = (INTERVALDS intervalds ) -> {
861
- // The binary representation is specified in the JavaDoc of
862
- // oracle.sql.INTERVALDS. In 21.x, the JavaDoc has bug: It neglects
863
- // to mention that the day and fractional second values are offset by
864
- // 0x80000000
865
- ByteBuffer byteBuffer = ByteBuffer .wrap (intervalds .shareBytes ());
866
- return Duration .of (
867
- TimeUnit .DAYS .toNanos (byteBuffer .getInt () - 0x80000000 )// 4 byte day
868
- + TimeUnit .HOURS .toNanos (byteBuffer .get () - 60 ) // 1 byte hour
869
- + TimeUnit .MINUTES .toNanos (byteBuffer .get () - 60 ) // 1 byte minute
870
- + TimeUnit .SECONDS .toNanos (byteBuffer .get () - 60 ) // 1 byte second
871
- + byteBuffer .getInt () - 0x80000000 , // 4 byte fractional second
872
- ChronoUnit .NANOS );
873
- };
842
+ mappingFunction = (INTERVALDS intervalds ) -> intervalds .getDuration ();
874
843
}
875
844
else if (java .sql .Blob .class .isAssignableFrom (fromType )
876
845
&& byte [].class .equals (toType )) {
@@ -1008,7 +977,6 @@ private static final class RowImpl
1008
977
* {@code jdbcReadable}. Not null.
1009
978
* @param jdbcReadable Row data from the Oracle JDBC Driver. Not null.
1010
979
* @param metadata Meta-data for the specified row. Not null.
1011
- * @param adapter Adapts JDBC calls into reactive streams. Not null.
1012
980
*/
1013
981
private RowImpl (
1014
982
OracleConnectionImpl r2dbcConnection , DependentCounter dependentCounter ,
@@ -1046,11 +1014,10 @@ private static final class OutParametersImpl
1046
1014
* {@code jdbcReadable} and obtains metadata of the values from
1047
1015
* {@code outParametersMetaData}.
1048
1016
* </p>
1049
- * @param jdbcConnection JDBC connection that created the
1017
+ * @param r2dbcConnection R2DBC connection that created the
1050
1018
* {@code jdbcReadable}. Not null.
1051
1019
* @param jdbcReadable Readable values from a JDBC Driver. Not null.
1052
1020
* @param metadata Metadata of each value. Not null.
1053
- * @param adapter Adapts JDBC calls into reactive streams. Not null.
1054
1021
*/
1055
1022
private OutParametersImpl (
1056
1023
OracleConnectionImpl r2dbcConnection , DependentCounter dependentCounter ,
@@ -1080,7 +1047,6 @@ private final class OracleR2dbcObjectImpl
1080
1047
* {@code jdbcReadable}. Not null.
1081
1048
* @param structJdbcReadable Readable values from a JDBC Driver. Not null.
1082
1049
* @param metadata Metadata of each value. Not null.
1083
- * @param adapter Adapts JDBC calls into reactive streams. Not null.
1084
1050
*/
1085
1051
private OracleR2dbcObjectImpl (
1086
1052
OracleConnectionImpl r2dbcConnection ,
0 commit comments