List of usage examples for io.vertx.sqlclient RowSet iterator
@Override RowIterator<R> iterator();
From source file:examples.MySQLClientExamples.java
public void storedProcedureExample(SqlClient client) { client.query("CREATE PROCEDURE multi() BEGIN\n" + " SELECT 1;\n" + " SELECT 1;\n" + " INSERT INTO ins VALUES (1);\n" + " INSERT INTO ins VALUES (2);\n" + "END;", ar1 -> { if (ar1.succeeded()) { // create stored procedure success client.query("CALL multi();", ar2 -> { if (ar2.succeeded()) { // handle the result RowSet<Row> result1 = ar2.result(); Row row1 = result1.iterator().next(); System.out.println("First result: " + row1.getInteger(0)); RowSet<Row> result2 = result1.next(); Row row2 = result2.iterator().next(); System.out.println("Second result: " + row2.getInteger(0)); RowSet<Row> result3 = result2.next(); System.out.println("Affected rows: " + result3.rowCount()); } else { System.out.println("Failure: " + ar2.cause().getMessage()); }/*from w w w . jav a 2s.c o m*/ }); } else { System.out.println("Failure: " + ar1.cause().getMessage()); } }); }
From source file:examples.PgClientExamples.java
License:Apache License
public void typeMapping01(Pool pool) { pool.query("SELECT 1::BIGINT \"VAL\"", ar -> { RowSet<Row> rowSet = ar.result(); Row row = rowSet.iterator().next(); // Stored as java.lang.Long Object value = row.getValue(0); // Convert to java.lang.Integer Integer intValue = row.getInteger(0); });//w ww. jav a 2 s . c o m }
From source file:examples.PgClientExamples.java
License:Apache License
public void typeMapping02(Pool pool) { pool.query("SELECT 1::BIGINT \"VAL\"", ar -> { RowSet<Row> rowSet = ar.result(); Row row = rowSet.iterator().next(); // Stored as java.lang.Long Object value = row.getValue(0); // Convert to java.lang.Integer Integer intValue = row.getInteger(0); });/*from ww w .j a v a 2s . co m*/ }