16
16
import io .vertx .core .impl .logging .Logger ;
17
17
import io .vertx .core .impl .logging .LoggerFactory ;
18
18
import io .vertx .oracleclient .OracleException ;
19
- import io .vertx .oracleclient .impl .commands .OraclePreparedQueryCommand ;
20
19
import io .vertx .oracleclient .impl .commands .OracleResponse ;
21
20
import io .vertx .sqlclient .Row ;
22
21
import io .vertx .sqlclient .impl .RowDesc ;
@@ -40,7 +39,7 @@ public class RowReader<C, R> implements Flow.Subscriber<Row>, Function<oracle.jd
40
39
private static final Logger LOG = LoggerFactory .getLogger (RowReader .class );
41
40
42
41
private final ContextInternal context ;
43
- private final List <String > types ;
42
+ private final List <Class <?>> classes ;
44
43
private final RowDesc description ;
45
44
private final Statement resultSetStatement ;
46
45
@@ -63,9 +62,9 @@ public RowReader(ContextInternal context, Collector<Row, C, R> collector, Oracle
63
62
resultSetStatement = ors .getStatement ();
64
63
ResultSetMetaData metaData = ors .getMetaData ();
65
64
int cols = metaData .getColumnCount ();
66
- types = new ArrayList <>(cols );
65
+ classes = new ArrayList <>(cols );
67
66
for (int i = 1 ; i <= cols ; i ++) {
68
- types .add (metaData .getColumnClassName (i ));
67
+ classes .add (getType ( metaData .getColumnClassName (i ) ));
69
68
}
70
69
Flow .Publisher <Row > publisher = ors .publisherOracle (this );
71
70
description = OracleRowDesc .create (metaData );
@@ -170,24 +169,24 @@ private OracleResponse<R> createResponse() {
170
169
@ Override
171
170
public Row apply (oracle .jdbc .OracleRow oracleRow ) {
172
171
try {
173
- return transform (types , description , oracleRow );
172
+ return transform (classes , description , oracleRow );
174
173
} catch (SQLException e ) {
175
174
throw new OracleException (e );
176
175
}
177
176
}
178
177
179
- private static Row transform (List <String > ors , RowDesc desc , oracle .jdbc .OracleRow or ) throws SQLException {
178
+ private static Row transform (List <Class <?>> classes , RowDesc desc , oracle .jdbc .OracleRow or ) throws SQLException {
180
179
Row row = new OracleRow (desc );
181
180
for (int i = 1 ; i <= desc .columnNames ().size (); i ++) {
182
- Object res = convertSqlValue (or .getObject (i , getType ( ors .get (i - 1 ) )));
181
+ Object res = convertSqlValue (or .getObject (i , classes .get (i - 1 )));
183
182
row .addValue (res );
184
183
}
185
184
return row ;
186
185
}
187
186
188
187
private static Class <?> getType (String cn ) {
189
188
try {
190
- return OraclePreparedQueryCommand . class .getClassLoader (). loadClass ( cn );
189
+ return Class . forName ( cn , true , RowReader . class .getClassLoader ());
191
190
} catch (ClassNotFoundException e ) {
192
191
return null ;
193
192
}
0 commit comments