List of usage examples for io.vertx.sqlclient Tuple of
static Tuple of(Object elt1, Object elt2, Object elt3)
From source file:examples.MySQLClientExamples.java
public void jsonExample() { // Create a tuple Tuple tuple = Tuple.of(Tuple.JSON_NULL, new JsonObject().put("foo", "bar"), 3); // Retrieving json Object value = tuple.getValue(0); // Expect JSON_NULL ////w ww .ja va2 s. c o m value = tuple.get(JsonObject.class, 1); // Expect JSON object // value = tuple.get(Integer.class, 2); // Expect 3 value = tuple.getInteger(2); // Expect 3 }
From source file:examples.PgClientExamples.java
License:Apache License
public void returning(SqlClient client) { client.preparedQuery("INSERT INTO color (color_name) VALUES ($1), ($2), ($3) RETURNING color_id", Tuple.of("white", "red", "blue"), ar -> { if (ar.succeeded()) { RowSet<Row> rows = ar.result(); System.out.println(rows.rowCount()); for (Row row : rows) { System.out.println("generated key: " + row.getInteger("color_id")); }//from w ww. j av a 2 s.c o m } else { System.out.println("Failure: " + ar.cause().getMessage()); } }); }