Example usage for io.vertx.sqlclient SqlClient preparedQuery

List of usage examples for io.vertx.sqlclient SqlClient preparedQuery

Introduction

In this page you can find the example usage for io.vertx.sqlclient SqlClient preparedQuery.

Prototype

@Fluent
SqlClient preparedQuery(String sql, Handler<AsyncResult<RowSet<Row>>> handler);

Source Link

Document

Prepare and execute a query.

Usage

From source file:examples.SqlClientExamples.java

License:Apache License

public void queries03(SqlClient client) {
    client.preparedQuery("SELECT first_name, last_name FROM users", ar -> {
        if (ar.succeeded()) {
            RowSet<Row> rows = ar.result();
            for (Row row : rows) {
                System.out.println("User " + row.getString(0) + " " + row.getString(1));
            }//from   w w  w  .ja v a  2s . c  o m
        } else {
            System.out.println("Failure: " + ar.cause().getMessage());
        }
    });
}