本文整理了Java中io.vertx.ext.sql.SQLConnection.queryStreamWithParams()
方法的一些代码示例,展示了SQLConnection.queryStreamWithParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLConnection.queryStreamWithParams()
方法的具体详情如下:
包路径:io.vertx.ext.sql.SQLConnection
类名称:SQLConnection
方法名:queryStreamWithParams
暂无
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Executes the given SQL <code>SELECT</code> statement which returns the results of the query as a read stream.
* @param sql the SQL to execute. For example <code>SELECT * FROM table ...</code>.
* @param params these are the parameters to fill the statement.
* @param handler the handler which is called once the operation completes. It will return a <code>SQLRowStream</code>.
* @return
*/
public io.vertx.rxjava.ext.sql.SQLConnection queryStreamWithParams(String sql, JsonArray params, Handler<AsyncResult<io.vertx.rxjava.ext.sql.SQLRowStream>> handler) {
delegate.queryStreamWithParams(sql, params, new Handler<AsyncResult<io.vertx.ext.sql.SQLRowStream>>() {
public void handle(AsyncResult<io.vertx.ext.sql.SQLRowStream> ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.ext.sql.SQLRowStream.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Executes the given SQL <code>SELECT</code> statement which returns the results of the query as a read stream.
* @param sql the SQL to execute. For example <code>SELECT * FROM table ...</code>.
* @param params these are the parameters to fill the statement.
* @param handler the handler which is called once the operation completes. It will return a <code>SQLRowStream</code>.
* @return
*/
public io.vertx.rxjava.ext.sql.SQLConnection queryStreamWithParams(String sql, JsonArray params, Handler<AsyncResult<io.vertx.rxjava.ext.sql.SQLRowStream>> handler) {
delegate.queryStreamWithParams(sql, params, new Handler<AsyncResult<io.vertx.ext.sql.SQLRowStream>>() {
public void handle(AsyncResult<io.vertx.ext.sql.SQLRowStream> ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.ext.sql.SQLRowStream.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Override
public SQLConnection queryStreamWithParams(String sql, JsonArray params, Handler<AsyncResult<SQLRowStream>> handler) {
delegate.queryStreamWithParams(sql, params, handler);
return this;
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static io.vertx.ext.sql.SQLConnection queryStreamWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, java.util.List<Object> params, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.SQLRowStream>> handler) {
io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.queryStreamWithParams(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.SQLRowStream>>() {
public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.SQLRowStream> ar) {
handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromObject(event)));
}
} : null));
return j_receiver;
}
public static io.vertx.ext.sql.SQLConnection update(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-sql-common
} else {
final SQLConnection conn = getConnection.result();
conn.queryStreamWithParams(sql, params, query -> {
if (query.failed()) {
conn.close(close -> {
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Test
public void testStreamWithParams() {
String sql = "SELECT ID, FNAME, LNAME FROM select_table WHERE LNAME = ? ORDER BY ID";
final AtomicInteger cnt = new AtomicInteger(0);
connection().queryStreamWithParams(sql, new JsonArray().add("doe"), onSuccess(res -> {
res.handler(row -> {
cnt.incrementAndGet();
}).endHandler(v -> {
assertEquals(2, cnt.get());
testComplete();
}).exceptionHandler(t -> {
fail(t);
});
}));
await();
}
内容来源于网络,如有侵权,请联系作者删除!