use of io.vertx.ext.sql.ResultSet in project vertx-zero by silentbalanceyh.
the class DbWorker method sayDb.
@Address("ZERO://QUEUE/NATIVE/GET")
public void sayDb(final Message<Envelop> message) {
final String type = Ux.getString(message);
this.client.queryWithParams("SELECT * FROM SYS_TABULAR WHERE S_TYPE=?", new JsonArray().add(type), handler -> {
// Success or Failure
if (handler.succeeded()) {
final ResultSet res = handler.result();
// Build result json array
for (final JsonArray item : res.getResults()) {
System.out.println(item);
}
message.reply(Envelop.success(res.getResults()));
} else {
// Replied with error, now only print stack
handler.cause().printStackTrace();
message.reply(Envelop.ok());
}
});
}
Aggregations