io.vertx.sqlclient

## Interface SqlConnection

- All Superinterfaces:
    SqlClient
  All Known Subinterfaces:
    MySQLConnection, PgConnection

      public interface SqlConnection
      extends SqlClient

  A connection to database server.
  Author:
    Julien Viet, Emad Alblueshi

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Transaction` | `begin()` Begin a transaction and returns a `Transaction` for controlling and tracking this transaction.
    `void` | `close()` Close the current connection after all the pending commands have been processed.
    `SqlConnection` | `closeHandler(Handler<Void> handler)` Set an handler called when the connection is closed.
    `SqlConnection` | `exceptionHandler(Handler<Throwable> handler)` Set an handler called with connection errors.
    `boolean` | `isSSL()`
    `SqlConnection` | `prepare(String sql, Handler<AsyncResult<PreparedQuery>> handler)` Create a prepared query.
    `<R> SqlConnection` | `preparedBatch(String sql, List<Tuple> batch, java.util.stream.Collector<Row,?,R> collector, Handler<AsyncResult<SqlResult<R>>> handler)` Prepare and execute a createBatch.
    `SqlConnection` | `preparedBatch(String sql, List<Tuple> batch, Handler<AsyncResult<RowSet<Row>>> handler)` Prepare and execute a createBatch.
    `<R> SqlConnection` | `preparedQuery(String sql, java.util.stream.Collector<Row,?,R> collector, Handler<AsyncResult<SqlResult<R>>> handler)` Prepare and execute a query.
    `SqlConnection` | `preparedQuery(String sql, Handler<AsyncResult<RowSet<Row>>> handler)` Prepare and execute a query.
    `<R> SqlConnection` | `preparedQuery(String sql, Tuple arguments, java.util.stream.Collector<Row,?,R> collector, Handler<AsyncResult<SqlResult<R>>> handler)` Prepare and execute a query.
    `SqlConnection` | `preparedQuery(String sql, Tuple arguments, Handler<AsyncResult<RowSet<Row>>> handler)` Prepare and execute a query.
    `<R> SqlConnection` | `query(String sql, java.util.stream.Collector<Row,?,R> collector, Handler<AsyncResult<SqlResult<R>>> handler)` Execute a simple query.
    `SqlConnection` | `query(String sql, Handler<AsyncResult<RowSet<Row>>> handler)` Execute a simple query.

- - ### Method Detail

    - #### prepare

          SqlConnection prepare(String sql,
                                Handler<AsyncResult<PreparedQuery>> handler)

      Create a prepared query.
      Parameters:
        `sql` - the sql
        `handler` - the handler notified with the prepared query asynchronously

    - #### exceptionHandler

          SqlConnection exceptionHandler(Handler<Throwable> handler)

      Set an handler called with connection errors.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### closeHandler

          SqlConnection closeHandler(Handler<Void> handler)

      Set an handler called when the connection is closed.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### begin

          Transaction begin()

      Begin a transaction and returns a `Transaction` for controlling and tracking this transaction.

      When the connection is explicitely closed, any inflight transaction is rollbacked.
      Returns:
        the transaction instance

    - #### isSSL

          boolean isSSL()

      Returns:
        whether the connection uses SSL

    - #### close

          void close()

      Close the current connection after all the pending commands have been processed.
      Specified by:
        `close` in interface `SqlClient`

    - #### preparedQuery

          SqlConnection preparedQuery(String sql,
                                      Handler<AsyncResult<RowSet<Row>>> handler)

      Description copied from interface: `SqlClient`
      Prepare and execute a query.
      Specified by:
        `preparedQuery` in interface `SqlClient`
      Parameters:
        `sql` - the prepared query SQL
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### preparedQuery

          <R> SqlConnection preparedQuery(String sql,
                                          java.util.stream.Collector<Row,?,R> collector,
                                          Handler<AsyncResult<SqlResult<R>>> handler)

      Description copied from interface: `SqlClient`
      Prepare and execute a query.
      Specified by:
        `preparedQuery` in interface `SqlClient`
      Parameters:
        `sql` - the prepared query SQL
        `collector` - the collector
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### query

          SqlConnection query(String sql,
                              Handler<AsyncResult<RowSet<Row>>> handler)

      Description copied from interface: `SqlClient`
      Execute a simple query.
      Specified by:
        `query` in interface `SqlClient`
      Parameters:
        `sql` - the query SQL
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### query

          <R> SqlConnection query(String sql,
                                  java.util.stream.Collector<Row,?,R> collector,
                                  Handler<AsyncResult<SqlResult<R>>> handler)

      Description copied from interface: `SqlClient`
      Execute a simple query.
      Specified by:
        `query` in interface `SqlClient`
      Parameters:
        `sql` - the query SQL
        `collector` - the collector
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### preparedQuery

          SqlConnection preparedQuery(String sql,
                                      Tuple arguments,
                                      Handler<AsyncResult<RowSet<Row>>> handler)

      Description copied from interface: `SqlClient`
      Prepare and execute a query.
      Specified by:
        `preparedQuery` in interface `SqlClient`
      Parameters:
        `sql` - the prepared query SQL
        `arguments` - the list of arguments
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### preparedQuery

          <R> SqlConnection preparedQuery(String sql,
                                          Tuple arguments,
                                          java.util.stream.Collector<Row,?,R> collector,
                                          Handler<AsyncResult<SqlResult<R>>> handler)

      Description copied from interface: `SqlClient`
      Prepare and execute a query.
      Specified by:
        `preparedQuery` in interface `SqlClient`
      Parameters:
        `sql` - the prepared query SQL
        `arguments` - the list of arguments
        `collector` - the collector
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### preparedBatch

          SqlConnection preparedBatch(String sql,
                                      List<Tuple> batch,
                                      Handler<AsyncResult<RowSet<Row>>> handler)

      Description copied from interface: `SqlClient`
      Prepare and execute a createBatch.
      Specified by:
        `preparedBatch` in interface `SqlClient`
      Parameters:
        `sql` - the prepared query SQL
        `batch` - the batch of tuples
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

    - #### preparedBatch

          <R> SqlConnection preparedBatch(String sql,
                                          List<Tuple> batch,
                                          java.util.stream.Collector<Row,?,R> collector,
                                          Handler<AsyncResult<SqlResult<R>>> handler)

      Description copied from interface: `SqlClient`
      Prepare and execute a createBatch.
      Specified by:
        `preparedBatch` in interface `SqlClient`
      Parameters:
        `sql` - the prepared query SQL
        `batch` - the batch of tuples
        `collector` - the collector
        `handler` - the handler notified with the execution result
      Returns:
        a reference to this, so the API can be used fluently

Copyright © 2019 Eclipse. All rights reserved.