use of io.mycat.mysqlclient.decoder.ObjectArrayDecoder in project Mycat2 by MyCATApache.
the class VertxMycatConnectionPool method query.
@Override
public synchronized Future<RowSet> query(String sql, List<Object> params) {
String psql = deparameterize(sql, params);
Future<RowSet> rowSetFuture = queryCloseFuture.flatMap(unused -> {
Promise<RowSet> promise = Promise.promise();
ObjectArrayDecoder objectArrayDecoder = new ObjectArrayDecoder();
Observable<Object[]> query = connection.query(psql, objectArrayDecoder);
onSend();
Single<RowSet> map = query.subscribeOn(Schedulers.computation()).toList().map(objects -> {
MycatMySQLRowMetaData mycatMySQLRowMetaData = new MycatMySQLRowMetaData(Arrays.asList(objectArrayDecoder.getColumnDefPackets()));
return new RowSet(mycatMySQLRowMetaData, objects);
});
map = map.doOnSuccess(objects -> promise.tryComplete(objects));
map = map.doOnError(objects -> promise.tryFail(objects));
map = map.doOnTerminate(() -> onRev());
map.subscribe();
return promise.future();
});
this.queryCloseFuture = rowSetFuture.mapEmpty();
return rowSetFuture;
}
Aggregations