/** * Calls the given SQL <code>PROCEDURE</code> which returns the result from the procedure. * * The index of params and outputs are important for both arrays, for example when dealing with a prodecure that * takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like: * * <pre> * params = [VALUE1, VALUE2, null] * outputs = [null, null, "VARCHAR"] * </pre> * @param sql the SQL to execute. For example <code>{call getEmpName (?, ?)}</code>. * @param params these are the parameters to fill the statement. * @param outputs these are the outputs to fill the statement. * @param handler the handler which is called once the operation completes. It will return a <code>ResultSet</code>. * @return */ public io.vertx.rxjava.ext.sql.SQLClient callWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> handler) { delegate.callWithParams(sql, params, outputs, handler); return this; }
/** * Calls the given SQL <code>PROCEDURE</code> which returns the result from the procedure. * * The index of params and outputs are important for both arrays, for example when dealing with a prodecure that * takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like: * * <pre> * params = [VALUE1, VALUE2, null] * outputs = [null, null, "VARCHAR"] * </pre> * @param sql the SQL to execute. For example <code>{call getEmpName (?, ?)}</code>. * @param params these are the parameters to fill the statement. * @param outputs these are the outputs to fill the statement. * @param handler the handler which is called once the operation completes. It will return a <code>ResultSet</code>. * @return */ public io.vertx.rxjava.ext.sql.SQLClient callWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> handler) { delegate.callWithParams(sql, params, outputs, handler); return this; }
public static io.vertx.ext.sql.SQLClient callWithParams(io.vertx.ext.sql.SQLClient j_receiver, java.lang.String sql, java.util.List<Object> params, java.util.List<Object> outputs, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.callWithParams(sql, params != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(params) : null, outputs != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(outputs) : null, handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet> ar) { handler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null)); return j_receiver; } }
@Test public void testStoredProcedure5() { client.callWithParams("{call time__s2(?)}", new JsonArray().add(2), new JsonArray().add("INTEGER"), onFailure(t -> { testComplete(); })); await(); }
@Test public void testStoredProcedure7() { client.callWithParams("{call an_hour_____before()}", null, null, onFailure(t -> { testComplete(); })); await(); }
@Test public void testStoredProcedure4() { client.callWithParams("{call times2(?)}", new JsonArray().add(2), new JsonArray().add("INTEGER"), onSuccess(resultSet -> { assertNotNull(resultSet); assertEquals(0, resultSet.getResults().size()); assertEquals(new Integer(4), resultSet.getOutput().getInteger(0)); testComplete(); })); await(); }
@Test public void testStoredProcedure6() { client.callWithParams("{call an_hour_before()}", null, null, onSuccess(resultSet -> { assertNotNull(resultSet); assertEquals(1, resultSet.getResults().size()); testComplete(); })); await(); }