public static void findAll(Handler<AsyncResult<ChannelInfo[]>> ar)
{
//getConnection().query("SELECT &", arg1)
getConnection().queryWithParams("SELECT * FROM Servers", new JsonObject(), res -> {
if (res.succeeded() && res.result().size() > 0) {
ChannelInfo[] channels = new ChannelInfo[res.result().size()];
int count = 0;
for (JsonObject row : res.result()) {
channels[count++] = new ChannelInfo()
.setId(row.getInteger("srv_id"))
.setName(row.getString("srv_name"))
.setIp(row.getString("srv_ip"))
.setServerDomain(row.getString("srv_domain"))
.setPort(row.getInteger("srv_port"))
.setPosition(row.getInteger("srv_position"))
.setPromiseToFightFlag(row.getBoolean("srv_promise_to_fight_flag"))
.setMoreServerFlag(row.getBoolean("srv_more_server_flag"))
.setMaxRoom(row.getInteger("srv_max_room"))
.setNumber(row.getInteger("srv_number"))
.setAllowedRoomTypeId(row.getInteger("srv_allowed_room_type_id"))
.setLimitMinLV(row.getInteger("srv_limit_min_lv"))
.setLimitMaxLV(row.getInteger("srv_limit_max_lv"))
.setMaxClient(row.getInteger("srv_max_client"));
}
ar.handle(Future.succeededFuture(channels));
} else {
logger.error("Erro ao obter um usuário pelo nome", res.cause());
ar.handle(Future.failedFuture(res.cause()));
}
});
}
错误:SQLConnection类型中的方法queryWithParams(String,JsonArray,Handler&gt;)不适用于参数(String,JsonObject,(res) - &gt; {})
答案 0 :(得分:0)
替换......
getConnection().queryWithParams("SELECT * FROM Servers", new JsonObject(), res ...
... with:
getConnection().queryWithParams("SELECT * FROM Servers", new JsonArray(), res ...
方法queryWithParams
需要以下参数:
第二个参数必须是JsonArray
不 a JsonObject
。在您的情况下,您似乎没有传递任何参数,因此提供空JsonArray
(例如new JsonArray()
)就足够了。