本文整理了Java中io.vertx.ext.sql.SQLConnection.callWithParams()
方法的一些代码示例,展示了SQLConnection.callWithParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLConnection.callWithParams()
方法的具体详情如下:
包路径:io.vertx.ext.sql.SQLConnection
类名称:SQLConnection
方法名:callWithParams
暂无
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* 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 resultHandler the handler which is called once the operation completes. It will return a <code>ResultSet</code>.
* @return
*/
public io.vertx.rxjava.ext.sql.SQLConnection callWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> resultHandler) {
delegate.callWithParams(sql, params, outputs, resultHandler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* 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 resultHandler the handler which is called once the operation completes. It will return a <code>ResultSet</code>.
* @return
*/
public io.vertx.rxjava.ext.sql.SQLConnection callWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> resultHandler) {
delegate.callWithParams(sql, params, outputs, resultHandler);
return this;
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Override
public SQLConnection callWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> resultHandler) {
delegate.callWithParams(sql, params, outputs, resultHandler);
return this;
}
代码示例来源:origin: io.vertx/vertx-sql-common
} else {
final SQLConnection conn = getConnection.result();
conn.callWithParams(sql, params, outputs, HandlerUtil.closeAndHandleResult(conn, handler));
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static io.vertx.ext.sql.SQLConnection callWithParams(io.vertx.ext.sql.SQLConnection 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>>> resultHandler) {
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,
resultHandler != 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) {
resultHandler.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.SQLConnection batchWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sqlStatement, java.util.List<java.util.List<Object>> args, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>>> handler) {
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Test
public void testStoredProcedure3() {
connection().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();
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Test
public void testStoredProcedure0() {
connection().callWithParams("{call new_customer(?, ?)}", new JsonArray().add("Paulo").add("Lopes"), null, onSuccess(resultSet -> {
testComplete();
}));
await();
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Test
public void testStoredProcedure2() {
connection().callWithParams("{call an_hour_before()}", null, null, onSuccess(resultSet -> {
assertNotNull(resultSet);
assertEquals(1, resultSet.getResults().size());
testComplete();
}));
await();
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Test
public void testStoredProcedure1() {
connection().callWithParams("{call customer_lastname(?, ?)}", new JsonArray().add("Paulo"), new JsonArray().addNull().add("VARCHAR"), onSuccess(resultSet -> {
assertNotNull(resultSet);
assertEquals(0, resultSet.getResults().size());
assertEquals("Lopes", resultSet.getOutput().getString(1));
testComplete();
}));
await();
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
/**
* This test has been marked as ignored since it can only run on mysql and it might not be 100% correct.
* A procedure is not supposed to return data by definition however MySQL allows this mix...
*
* This requires the following proc to be installed on a MySQL server:
*
* create DATABASE test;
* use test;
*
* DROP PROCEDURE `proc_test`;
*
* DELIMITER $$
* CREATE PROCEDURE `proc_test`(IN firstname varchar(45), OUT lastname varchar(45))
* BEGIN
* select concat(firstname, '!!!') into lastname;
* select now(6);
* END$$
* DELIMITER ;
*/
@Test
@Ignore
public void testStoredProcedure1() {
connection().callWithParams("{call proc_test(?, ?)}", new JsonArray().add("zepinos"), new JsonArray().addNull().add("VARCHAR"), onSuccess(resultSet -> {
assertNotNull(resultSet);
assertEquals(1, resultSet.getResults().size());
assertEquals("zepinos!!!", resultSet.getOutput().getString(1));
testComplete();
}));
await();
}
内容来源于网络,如有侵权,请联系作者删除!