Example usage for io.vertx.sqlclient Pool query

List of usage examples for io.vertx.sqlclient Pool query

Introduction

In this page you can find the example usage for io.vertx.sqlclient Pool query.

Prototype

@Override
    Pool query(String sql, Handler<AsyncResult<RowSet<Row>>> handler);

Source Link

Usage

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);
    });//from w w  w.j av a 2  s .  co  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  w ww  . j a v  a 2s  .c om
}