Interface RawConnectionOperation<T>

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Performs raw JDBC work with a Connection managed by Database.useRawConnection(RawConnectionOperation).

The connection is valid only for the duration of the callback. Do not close it, retain it, manage transaction lifecycle directly from it, or mutate connection-wide state such as schema, catalog, client info, holdability, type map, or network timeout. Pyranid guards those operations and routes Statement.getConnection() and DatabaseMetaData.getConnection() back to the managed handle. ResultSet.getStatement() returns a guarded statement, and guarded JDBC objects refuse driver-specific unwrap(...) calls that could expose the driver's underlying connection.

Since:
4.2.0
Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull Optional<T>
    perform(@NonNull Connection connection)
    Performs raw JDBC work with the provided connection.
  • Method Details

    • perform

      @NonNull Optional<T> perform(@NonNull Connection connection) throws Exception
      Performs raw JDBC work with the provided connection.
      Parameters:
      connection - connection to use
      Returns:
      the operation result
      Throws:
      Exception - if the operation fails