Vertx executeBatch not returning all rows
See original GitHub issueQuestions
Hello, I want to use pg-client executeBatch() method however the result that I am getting is not what I expect. I see that in the database several rows have been inserted but the result RowSet<Row> contains only the first inserted row. Could you please elaborate on this?
Version
version: pg-client: 3.9.5
Do you have a reproducer?
`List<Tuple> batch = new ArrayList<>(); batch.add(Tuple.of(“julien”, “Julien Viet”)); batch.add(Tuple.of(“emad”, “Emad Alblueshi”));
// Execute the prepared batch client .preparedQuery(“INSERT INTO USERS (id, name) VALUES ($1, $2) RETURNING id”) .executeBatch(batch, res -> { if (res.succeeded()) {
// Process rows
RowSet<Row> rows = res.result();
System.out.println("Got " + rows.rowCount() + " rows ");
for (Row row : rows) {
System.out.println("User id: " + row.getInteger("id"));
}
} else { System.out.println("Batch failed " + res.cause()); } });`
Output is always the first inserted row: Got 1 rows User id: julien
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Vertx executeBatch not returning all rows - Stack Overflow
The code example below will fix the issue and get all rows. client .preparedQuery("INSERT INTO color (color_name) VALUES ($1) RETURNING color_id ...
Read more >Quarkus sql client PreparedQuery.executeBatch number of ...
Final. We are using the preparedQuery.executeBatch as below, but the rowCount always returns 1 no matter how many rows it updated. import io....
Read more >PreparedQuery (Vert.x Stack - Docs 4.3.6 API)
Execute the query with a batch of tuples. Use the specified mapper for mapping Row to <U> .
Read more >Reactive SQL Clients - Quarkus
src/main/java/org/acme/vertx/Fruit.java. private static Fruit from(Row row) { return new Fruit(row.getLong("id"), row.getString("name")); }. Putting it all ...
Read more >SQL common | Eclipse Vert.x
There are times when you will want to run a single SQL operation, e.g.: a single select of a row, or a update...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ivadoncheva Use this one
Thanks, @zero88. This works!