当前位置: 首页>>代码示例>>Java>>正文


Java SQLConnection.execute方法代码示例

本文整理汇总了Java中io.vertx.ext.sql.SQLConnection.execute方法的典型用法代码示例。如果您正苦于以下问题:Java SQLConnection.execute方法的具体用法?Java SQLConnection.execute怎么用?Java SQLConnection.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.ext.sql.SQLConnection的用法示例。


在下文中一共展示了SQLConnection.execute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testQueryTimeout

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
@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();
  }
 
开发者ID:vert-x3,项目名称:vertx-jdbc-client,代码行数:21,代码来源:JDBCQueryTimeoutTest.java

示例2: testMultiSelect

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
@Test
public void testMultiSelect() {
  String sql = "{ call MS() }";

  final SQLConnection conn = connection();

  conn.execute("CREATE PROCEDURE MS() PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 2 EXTERNAL NAME 'io.vertx.ext.jdbc.Functions.multiSelect'", onSuccess(res -> {
    conn.call(sql, onSuccess(resultSet -> {
      assertNotNull(resultSet);
      assertNotNull(resultSet.getNext());
      testComplete();
    }));

  }));


  await();
}
 
开发者ID:vert-x3,项目名称:vertx-jdbc-client,代码行数:19,代码来源:JDBCQueryTimeoutTest.java

示例3: execute

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
private void execute(SQLConnection conn, String sql, Handler<Void> done) {
    conn.execute(sql, res -> {
        if (res.failed()) {
            throw new RuntimeException(res.cause());
        }

        done.handle(null);
    });
}
 
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:10,代码来源:JdbcServiceVertcl.java

示例4: example6

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
public void example6(SQLConnection connection) {

    String sql = "CREATE TABLE PEOPLE (ID int generated by default as identity (start with 1 increment by 1) not null," +
      "FNAME varchar(255), LNAME varchar(255), SHOE_SIZE int);";

    connection.execute(sql, execute -> {
      if (execute.succeeded()) {
        System.out.println("Table created !");
      } else {
        // Failed!
      }
    });

  }
 
开发者ID:vert-x3,项目名称:vertx-sql-common,代码行数:15,代码来源:SQLExamples.java

示例5: setupSimpleTable

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
private void setupSimpleTable(SQLConnection conn, Handler<AsyncResult<Void>> handler) {
  conn.execute("BEGIN",
    ar -> conn.execute("DROP TABLE IF EXISTS test_table",
      ar2 -> conn.execute(CREATE_TABLE_STATEMENT,
        ar3 -> conn.update("INSERT INTO test_table (id, name) VALUES " + Data.get(),
          ar4 -> conn.execute("COMMIT", handler)))));
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:8,代码来源:SQLTestBase.java

示例6: setupTestTable

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
private void setupTestTable(SQLConnection conn, Supplier<String> idNameValuesSupplier, Handler<AsyncResult<Void>> handler) {
  conn.execute("BEGIN",
    ar -> conn.execute("DROP TABLE IF EXISTS test_table",
      ar2 -> conn.execute(CREATE_TABLE_STATEMENT,
        ar3 -> conn.update("INSERT INTO test_table (id, name) VALUES " + idNameValuesSupplier.get(),
          ar4 -> conn.execute("COMMIT", handler)))));
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:8,代码来源:SQLTestBase.java

示例7: setupAutoIncrementTable

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
private void setupAutoIncrementTable(SQLConnection conn, Handler<AsyncResult<Void>> handler) {
  conn.execute("BEGIN",
      ar -> conn.execute("DROP TABLE IF EXISTS test_table",
          ar2 -> conn.execute("CREATE TABLE test_table (id BIGSERIAL, name VARCHAR(255), PRIMARY KEY(id))",
              ar3 -> conn.execute("COMMIT", handler::handle))));
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:7,代码来源:PostgreSQLClientTest.java

示例8: setupTableWithUUIDs

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
private void setupTableWithUUIDs(SQLConnection conn, Handler<AsyncResult<Void>> handler) {
  conn.execute("BEGIN",
      ar -> conn.execute("DROP TABLE IF EXISTS test_table",
          ar2 -> conn.execute("CREATE TABLE test_table (some_uuid UUID, name VARCHAR(255))",
              ar3 -> conn.execute("COMMIT", handler::handle))));
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:7,代码来源:PostgreSQLClientTest.java

示例9: setupAutoIncrementTable

import io.vertx.ext.sql.SQLConnection; //导入方法依赖的package包/类
private void setupAutoIncrementTable(SQLConnection conn, Handler<AsyncResult<Void>> handler) {
  conn.execute("BEGIN",
      ar -> conn.execute("DROP TABLE IF EXISTS test_table",
          ar2 -> conn.execute("CREATE TABLE test_table (id BIGINT AUTO_INCREMENT, name VARCHAR(255), PRIMARY KEY(id))",
              ar3 -> conn.execute("COMMIT", handler::handle))));
}
 
开发者ID:vert-x3,项目名称:vertx-mysql-postgresql-client,代码行数:7,代码来源:MySQLClientTest.java


注:本文中的io.vertx.ext.sql.SQLConnection.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。