io.vertx.ext.sql.SQLConnection.setQueryTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中io.vertx.ext.sql.SQLConnection.setQueryTimeout()方法的一些代码示例,展示了SQLConnection.setQueryTimeout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLConnection.setQueryTimeout()方法的具体详情如下:
包路径:io.vertx.ext.sql.SQLConnection
类名称:SQLConnection
方法名:setQueryTimeout

SQLConnection.setQueryTimeout介绍

[英]Sets a connection wide query timeout. It can be over written at any time and becomes active on the next query call.
[中]设置连接范围的查询超时。它可以在任何时候被重写,并在下一次查询调用时变为活动状态。

代码示例

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Sets a connection wide query timeout.
 *
 * It can be over written at any time and becomes active on the next query call.
 * @param timeoutInSeconds the max amount of seconds the query can take to execute.
 * @return 
 */
@Deprecated()
public io.vertx.rxjava.ext.sql.SQLConnection setQueryTimeout(int timeoutInSeconds) { 
 delegate.setQueryTimeout(timeoutInSeconds);
 return this;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Sets a connection wide query timeout.
 *
 * It can be over written at any time and becomes active on the next query call.
 * @param timeoutInSeconds the max amount of seconds the query can take to execute.
 * @return 
 */
@Deprecated()
public io.vertx.rxjava.ext.sql.SQLConnection setQueryTimeout(int timeoutInSeconds) { 
 delegate.setQueryTimeout(timeoutInSeconds);
 return this;
}

代码示例来源:origin: io.vertx/vertx-jdbc-client

@Test
 public void testQueryTimeout() {
  String sql = "{call NAP(1) + NAP(1) + NAP(1) + NAP(1) + NAP(1)}";

  final SQLConnection conn = connection();

  conn.execute("CREATE FUNCTION NAP() returns INT PARAMETER STYLE JAVA reads sql data language JAVA EXTERNAL NAME 'io.vertx.ext.jdbc.Functions.nap'", onSuccess(res -> {
   conn.setQueryTimeout(1).call(sql, onFailure(resultSet -> {
    assertNotNull(resultSet);
//        assertEquals(1, resultSet.getResults().size());
//        // we expect a String since UUID will be converted with the fallback mode
//        assertNotNull(resultSet.getResults().get(0).getString(0));
    testComplete();
   }));

  }));

  await();
 }

相关文章