Example usage for io.vertx.sqlclient Cursor close

List of usage examples for io.vertx.sqlclient Cursor close

Introduction

In this page you can find the example usage for io.vertx.sqlclient Cursor close.

Prototype

default void close() 

Source Link

Document

Release the cursor.

Usage

From source file:examples.SqlClientExamples.java

License:Apache License

public void usingCursors02(Cursor cursor) {
    cursor.read(50, ar2 -> {//from ww w.j  av a  2 s .c o  m
        if (ar2.succeeded()) {
            // Close the cursor
            cursor.close();
        }
    });
}

From source file:examples.SqlClientExamples.java

License:Apache License

public void usingCursors01(SqlConnection connection) {
    connection.prepare("SELECT * FROM users WHERE age > ?", ar1 -> {
        if (ar1.succeeded()) {
            PreparedQuery pq = ar1.result();

            // Create a cursor
            Cursor cursor = pq.cursor(Tuple.of(18));

            // Read 50 rows
            cursor.read(50, ar2 -> {//from   w  w w  . ja v a 2s  . c  om
                if (ar2.succeeded()) {
                    RowSet<Row> rows = ar2.result();

                    // Check for more ?
                    if (cursor.hasMore()) {
                        // Repeat the process...
                    } else {
                        // No more rows - close the cursor
                        cursor.close();
                    }
                }
            });
        }
    });
}