Sql 在vertx中使用updateWithParms从JsonArray插入数据

Sql 在vertx中使用updateWithParms从JsonArray插入数据,sql,prepared-statement,vert.x,Sql,Prepared Statement,Vert.x,可以在vertx postgres客户端中使用updatewithparms()使用json数组将数据插入到。我尝试了下列方法,但没有成功 String INSERT_QUERY="INSERT INTO testDb (rid , aid , created_at, expiry_time, strings , strings) VALUES" private JsonArray preparedParameters(){ //JsonArray params = new Json

可以在vertx postgres客户端中使用updatewithparms()使用json数组将数据插入到。我尝试了下列方法,但没有成功

String  INSERT_QUERY="INSERT INTO testDb (rid , aid , created_at, expiry_time, strings , strings) VALUES"

private JsonArray preparedParameters(){
    //JsonArray params = new JsonArray();
    DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    return new JsonArray()
            .add(device.getRecordId().toString())
            .add( device.getAccountId())
            .add(dateTimeFormat.format(device.getCreatedAt()))
            .add(dateTimeFormat.format(device.getExpiresAt()))
            .add( device.getEnrollmentId())
            .add(device.getHashedEnrollmentId());
}
然后我调用如下函数

try (SQLConnection connection = connectionResult.result()) {
        connection.updateWithParams(INSERT_QUERY,preparedParameters() ,queryRes -> {
            if (queryRes.succeeded()) {
                booleanFuture.complete(true);
            } else {
                booleanFuture.complete(false);
            }
        });
    } catch (Exception e) {

        booleanFuture.complete(false);
    }
我收到以下错误

The query contains 0 parameters but you gave it 6 ("sda","sda",2018-01-22 20:23:26,2018-02-21 20:23:26,"sda","sda")

com.github.mauricio.async.db.exceptions.InsufficientParameters异常:查询包含0个参数,但您给了它6(“sda”,“sda”,2018-01-22 20:23:26:262018-02-21 20:23:26,“sda”,“sda”)

您的查询无效,它丢失了参数

String  INSERT_QUERY="INSERT INTO testDb (rid , aid , created_at, expiry_time, strings , strings) VALUES (?,?,?,?,?,?)"

请参阅Vert.x SQL文档的一节。

您的查询无效,它遗漏了参数

String  INSERT_QUERY="INSERT INTO testDb (rid , aid , created_at, expiry_time, strings , strings) VALUES (?,?,?,?,?,?)"
请参阅Vert.xSQL文档的一节