@@ -44,7 +44,7 @@ package org.acme.reactive.crud;
4444
4545import io.smallrye.mutiny.Multi;
4646import io.smallrye.mutiny.Uni;
47- import io.vertx.mutiny.pgclient.PgPool ;
47+ import io.vertx.mutiny.sqlclient.Pool ;
4848import io.vertx.mutiny.sqlclient.Row;
4949import io.vertx.mutiny.sqlclient.RowSet;
5050import io.vertx.mutiny.sqlclient.Tuple;
@@ -179,7 +179,7 @@ quarkus.datasource.password=quarkus_test
179179quarkus.datasource.reactive.url=postgresql://localhost:5432/quarkus_test
180180----
181181
182- With that you can create your `FruitResource` skeleton and inject a `io.vertx.mutiny.pgclient.PgPool ` instance:
182+ With that you can create your `FruitResource` skeleton and inject a `io.vertx.mutiny.sqlclient.Pool ` instance:
183183
184184[source,java]
185185.src/main/java/org/acme/vertx/FruitResource.java
@@ -199,14 +199,14 @@ import jakarta.ws.rs.core.Response.Status;
199199
200200import io.smallrye.mutiny.Multi;
201201import io.smallrye.mutiny.Uni;
202- import io.vertx.mutiny.pgclient.PgPool ;
202+ import io.vertx.mutiny.sqlclient.Pool ;
203203
204204@Path("fruits")
205205public class FruitResource {
206206
207- private final PgPool client;
207+ private final Pool client;
208208
209- public FruitResource(PgPool client) {
209+ public FruitResource(Pool client) {
210210 this.client = client;
211211 }
212212}
@@ -226,7 +226,7 @@ But for development we can simply drop and create the tables on startup, and the
226226package org.acme.reactive.crud;
227227
228228import io.quarkus.runtime.StartupEvent;
229- import io.vertx.mutiny.pgclient.PgPool ;
229+ import io.vertx.mutiny.sqlclient.Pool ;
230230import org.eclipse.microprofile.config.inject.ConfigProperty;
231231
232232import jakarta.enterprise.context.ApplicationScoped;
@@ -235,10 +235,10 @@ import jakarta.enterprise.event.Observes;
235235@ApplicationScoped
236236public class DBInit {
237237
238- private final PgPool client;
238+ private final Pool client;
239239 private final boolean schemaCreate;
240240
241- public DBInit(PgPool client, @ConfigProperty(name = "myapp.schema.create", defaultValue = "true") boolean schemaCreate) {
241+ public DBInit(Pool client, @ConfigProperty(name = "myapp.schema.create", defaultValue = "true") boolean schemaCreate) {
242242 this.client = client;
243243 this.schemaCreate = schemaCreate;
244244 }
@@ -293,7 +293,7 @@ To retrieve all the data, we will use the `query` method again:
293293[source,java]
294294./src/main/java/org/acme/reactive/crud/Fruit.java
295295----
296- public static Multi<Fruit> findAll(PgPool client) {
296+ public static Multi<Fruit> findAll(Pool client) {
297297 return client.query("SELECT id, name FROM fruits ORDER BY name ASC").execute()
298298 .onItem().transformToMulti(set -> Multi.createFrom().iterable(set)) // <1>
299299 .onItem().transform(Fruit::from); // <2>
@@ -350,7 +350,7 @@ Equipped with this tooling, we are able to safely use an `id` provided by the us
350350[source,java]
351351.src/main/java/org/acme/vertx/Fruit.java
352352----
353- public static Uni<Fruit> findById(PgPool client, Long id) {
353+ public static Uni<Fruit> findById(Pool client, Long id) {
354354 return client.preparedQuery("SELECT id, name FROM fruits WHERE id = $1").execute(Tuple.of(id)) // <1>
355355 .onItem().transform(RowSet::iterator) // <2>
356356 .onItem().transform(iterator -> iterator.hasNext() ? from(iterator.next()) : null); // <3>
@@ -381,7 +381,7 @@ The same logic applies when saving a `Fruit`:
381381[source,java]
382382.src/main/java/org/acme/vertx/Fruit.java
383383----
384- public Uni<Long> save(PgPool client) {
384+ public Uni<Long> save(Pool client) {
385385 return client.preparedQuery("INSERT INTO fruits (name) VALUES ($1) RETURNING id").execute(Tuple.of(name))
386386 .onItem().transform(pgRowSet -> pgRowSet.iterator().next().getLong("id"));
387387}
@@ -412,7 +412,7 @@ Let's use this to support removal of fruits in the database:
412412[source,java]
413413.src/main/java/org/acme/vertx/Fruit.java
414414----
415- public static Uni<Boolean> delete(PgPool client, Long id) {
415+ public static Uni<Boolean> delete(Pool client, Long id) {
416416 return client.preparedQuery("DELETE FROM fruits WHERE id = $1").execute(Tuple.of(id))
417417 .onItem().transform(pgRowSet -> pgRowSet.rowCount() == 1); // <1>
418418}
@@ -524,33 +524,28 @@ Navigate to http://localhost:8080/fruits.html and read/create/delete some fruits
524524[[reactive-sql-clients-details]]
525525== Database Clients details
526526
527- [cols="10,40,40,10 "]
527+ [cols="15,70,15 "]
528528|===
529- |Database |Extension name |Pool class name | Placeholders
529+ |Database |Extension name |Placeholders
530530
531531|IBM Db2
532532|`quarkus-reactive-db2-client`
533- |`io.vertx.mutiny.db2client.DB2Pool`
534533|`?`
535534
536535|MariaDB/MySQL
537536|`quarkus-reactive-mysql-client`
538- |`io.vertx.mutiny.mysqlclient.MySQLPool`
539537|`?`
540538
541539|Microsoft SQL Server
542540|`quarkus-reactive-mssql-client`
543- |`io.vertx.mutiny.mssqlclient.MSSQLPool`
544541|`@p1`, `@p2`, etc.
545542
546543|Oracle
547544|`quarkus-reactive-oracle-client`
548- |`io.vertx.mutiny.oracleclient.OraclePool`
549545|`?`
550546
551547|PostgreSQL
552548|`quarkus-reactive-pg-client`
553- |`io.vertx.mutiny.pgclient.PgPool`
554549|`$1`, `$2`, etc.
555550|===
556551
@@ -570,7 +565,7 @@ The following snippet shows how to run 2 insertions in the same transaction:
570565
571566[source, java]
572567----
573- public static Uni<Void> insertTwoFruits(PgPool client, Fruit fruit1, Fruit fruit2) {
568+ public static Uni<Void> insertTwoFruits(Pool client, Fruit fruit1, Fruit fruit2) {
574569 return client.withTransaction(conn -> {
575570 Uni<RowSet<Row>> insertOne = conn.preparedQuery("INSERT INTO fruits (name) VALUES ($1) RETURNING id")
576571 .execute(Tuple.of(fruit1.name));
@@ -691,11 +686,11 @@ You can then inject the clients as follows:
691686[source,java]
692687----
693688@Inject <1>
694- PgPool defaultClient;
689+ Pool defaultClient;
695690
696691@Inject
697692@ReactiveDataSource("additional1") <2>
698- PgPool additional1Client;
693+ Pool additional1Client;
699694
700695@Inject
701696@ReactiveDataSource("additional2")
@@ -830,18 +825,18 @@ import jakarta.inject.Singleton;
830825
831826import io.quarkus.reactive.pg.client.PgPoolCreator;
832827import io.vertx.pgclient.PgConnectOptions;
833- import io.vertx.pgclient.PgPool ;
828+ import io.vertx.sqlclient.Pool ;
834829import io.vertx.sqlclient.PoolOptions;
835830
836831@Singleton
837832public class CustomPgPoolCreator implements PgPoolCreator {
838833
839834 @Override
840- public PgPool create(Input input) {
835+ public Pool create(Input input) {
841836 PgConnectOptions connectOptions = input.pgConnectOptions();
842837 PoolOptions poolOptions = input.poolOptions();
843838 // Customize connectOptions, poolOptions or both, as required
844- return PgPool .pool(input.vertx(), connectOptions, poolOptions);
839+ return Pool .pool(input.vertx(), connectOptions, poolOptions);
845840 }
846841}
847842----
@@ -860,12 +855,12 @@ Here's an example for PostgreSQL:
860855import jakarta.inject.Inject;
861856
862857import io.smallrye.mutiny.Uni;
863- import io.vertx.mutiny.pgclient.PgPool ;
858+ import io.vertx.mutiny.sqlclient.Pool ;
864859
865860public class PipeliningExample {
866861
867862 @Inject
868- PgPool client;
863+ Pool client;
869864
870865 public Uni<String> favoriteFruitAndVegetable() {
871866 // Explicitly acquire a connection
0 commit comments