/** * Executes the given prepared statement which may be an <code>INSERT</code>, <code>UPDATE</code>, or <code>DELETE</code> * statement with the given parameters * @param sql the SQL to execute. For example <code>INSERT INTO table ...</code> * @param params these are the parameters to fill the statement. * @param handler the handler which is called once the operation completes. * @return */ public io.vertx.rxjava.ext.sql.SQLClient updateWithParams(String sql, JsonArray params, Handler<AsyncResult<UpdateResult>> handler) { delegate.updateWithParams(sql, params, handler); return this; }
/** * Executes the given prepared statement which may be an <code>INSERT</code>, <code>UPDATE</code>, or <code>DELETE</code> * statement with the given parameters * @param sql the SQL to execute. For example <code>INSERT INTO table ...</code> * @param params these are the parameters to fill the statement. * @param handler the handler which is called once the operation completes. * @return */ public io.vertx.rxjava.ext.sql.SQLClient updateWithParams(String sql, JsonArray params, Handler<AsyncResult<UpdateResult>> handler) { delegate.updateWithParams(sql, params, handler); return this; }
public static io.vertx.ext.sql.SQLClient updateWithParams(io.vertx.ext.sql.SQLClient j_receiver, java.lang.String sql, java.util.List<Object> params, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.updateWithParams(sql, params != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(params) : null, handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.UpdateResult>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.UpdateResult> ar) { handler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null)); return j_receiver; } public static io.vertx.ext.sql.SQLClient call(io.vertx.ext.sql.SQLClient j_receiver, java.lang.String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) {
@Test public void testInsertOneShot() { String sql = "INSERT INTO insert_table (FNAME, LNAME) VALUES (?,?)"; client.updateWithParams(sql, new JsonArray().add("Paulo").add("Lopes"), onSuccess(result -> { assertUpdate(result, 1, true); testComplete(); })); await(); }