Search in sources :

Example 1 with RowSet

use of io.vertx.mutiny.sqlclient.RowSet in project smallrye-mutiny-vertx-bindings by smallrye.

the class PostGreSQLClientTest method testSequence.

@Test
public void testSequence() {
    PgConnectOptions options = new PgConnectOptions().setPort(container.getMappedPort(5432)).setHost(container.getContainerIpAddress()).setDatabase(container.getDatabaseName()).setUser(container.getUsername()).setPassword(container.getPassword());
    Pool client = PgPool.pool(vertx, options, new PoolOptions().setMaxSize(5));
    Uni<Tuple2<RowSet<Row>, RowSet<Row>>> uni = client.getConnection().flatMap(c -> Uni.combine().all().unis(c.preparedQuery("SELECT 1").execute(), c.preparedQuery("SELECT 1").execute()).asTuple());
    Tuple2<RowSet<Row>, RowSet<Row>> results = uni.await().indefinitely();
    assertThat(results).isNotNull();
    assertThat(results.size()).isEqualTo(2);
    assertThat(results.getItem1()).isNotNull();
    assertThat(results.getItem2()).isNotNull();
}
Also used : PgConnectOptions(io.vertx.pgclient.PgConnectOptions) Tuple2(io.smallrye.mutiny.tuples.Tuple2) PoolOptions(io.vertx.sqlclient.PoolOptions) RowSet(io.vertx.mutiny.sqlclient.RowSet) PgPool(io.vertx.mutiny.pgclient.PgPool) Pool(io.vertx.mutiny.sqlclient.Pool) Row(io.vertx.mutiny.sqlclient.Row)

Example 2 with RowSet

use of io.vertx.mutiny.sqlclient.RowSet in project smallrye-mutiny-vertx-bindings by smallrye.

the class DB2ClientTest method testSequence.

@Test
public void testSequence() {
    DB2ConnectOptions options = new DB2ConnectOptions().setPort(container.getMappedPort(50000)).setHost(container.getContainerIpAddress()).setDatabase(container.getDatabaseName()).setUser(container.getUsername()).setPassword(container.getPassword());
    Pool client = DB2Pool.pool(vertx, options, new PoolOptions().setMaxSize(5));
    Uni<Tuple2<RowSet<Row>, RowSet<Row>>> uni = client.getConnection().flatMap(c -> Uni.combine().all().unis(c.preparedQuery("SELECT 1 FROM SYSIBM.SYSDUMMY1").execute(), c.preparedQuery("SELECT 1 FROM SYSIBM.SYSDUMMY1").execute()).asTuple());
    Tuple2<RowSet<Row>, RowSet<Row>> results = uni.await().indefinitely();
    assertThat(results).isNotNull();
    assertThat(results.size()).isEqualTo(2);
    assertThat(results.getItem1()).isNotNull();
    assertThat(results.getItem2()).isNotNull();
}
Also used : Tuple2(io.smallrye.mutiny.tuples.Tuple2) PoolOptions(io.vertx.sqlclient.PoolOptions) RowSet(io.vertx.mutiny.sqlclient.RowSet) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions) Pool(io.vertx.mutiny.sqlclient.Pool) DB2Pool(io.vertx.mutiny.db2client.DB2Pool) Row(io.vertx.mutiny.sqlclient.Row) Test(org.junit.Test)

Aggregations

Tuple2 (io.smallrye.mutiny.tuples.Tuple2)2 Pool (io.vertx.mutiny.sqlclient.Pool)2 Row (io.vertx.mutiny.sqlclient.Row)2 RowSet (io.vertx.mutiny.sqlclient.RowSet)2 PoolOptions (io.vertx.sqlclient.PoolOptions)2 DB2ConnectOptions (io.vertx.db2client.DB2ConnectOptions)1 DB2Pool (io.vertx.mutiny.db2client.DB2Pool)1 PgPool (io.vertx.mutiny.pgclient.PgPool)1 PgConnectOptions (io.vertx.pgclient.PgConnectOptions)1 Test (org.junit.Test)1