Top Description Fields Constructors Methods
org.jooq.tools.r2dbc

public Class LoggingConnection

extends DefaultConnection
Class Inheritance
Imports
java.time.Duration, org.jooq.tools.JooqLogger, org.reactivestreams.Publisher, io.r2dbc.spi.Batch, .Connection, .IsolationLevel, .Statement, .TransactionDefinition, .ValidationDepth

An R2DBC Connection proxy that logs all statements that are prepared or executed using it.
Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private static final JooqLogger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Publisher<Void>
public Publisher<Void>
beginTransaction(TransactionDefinition
attributes for the transaction.
definition
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.beginTransaction.

Implements io.r2dbc.spi.Connection.beginTransaction.

Begins a new transaction.
public Publisher<Void>
close()

Overrides org.jooq.tools.r2dbc.DefaultConnection.close.

Implements io.r2dbc.spi.Connection.close.

Release any resources held by the Connection.
public Publisher<Void>
public Batch
createBatch()

Overrides org.jooq.tools.r2dbc.DefaultConnection.createBatch.

Implements io.r2dbc.spi.Connection.createBatch.

Creates a new Batch instance for building a batched request.
public Publisher<Void>
createSavepoint(String
the name of the savepoint to create
name
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.createSavepoint.

Implements io.r2dbc.spi.Connection.createSavepoint.

Creates a savepoint in the current transaction.
public Statement
createStatement(String
the SQL of the statement
sql
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.createStatement.

Implements io.r2dbc.spi.Connection.createStatement.

Creates a new statement for building a statement-based request.
public Publisher<Void>
releaseSavepoint(String
the name of the savepoint to release
name
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.releaseSavepoint.

Implements io.r2dbc.spi.Connection.releaseSavepoint.

Releases a savepoint in the current transaction.
public Publisher<Void>
public Publisher<Void>
rollbackTransactionToSavepoint(String
the name of the savepoint to rollback to
name
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.rollbackTransactionToSavepoint.

Implements io.r2dbc.spi.Connection.rollbackTransactionToSavepoint.

Rolls back to a savepoint in the current transaction.
public Publisher<Void>
setAutoCommit(boolean
the isolation level for this transaction
autoCommit
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setAutoCommit.

Implements io.r2dbc.spi.Connection.setAutoCommit.

Configures the auto-commit mode for the current transaction.
public Publisher<Void>
setLockWaitTimeout(Duration
the lock timeout for this connection. Support for no timeout is vendor-specific.
timeout
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setLockWaitTimeout.

Implements io.r2dbc.spi.Connection.setLockWaitTimeout.

Configures the lock acquisition timeout for statements to be executed using the current connection.
public Publisher<Void>
setStatementTimeout(Duration
the statement timeout for this connection. Duration#ZERO indicates no timeout.
timeout
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setStatementTimeout.

Implements io.r2dbc.spi.Connection.setStatementTimeout.

Configures the statement timeout for statements to be executed using the current connection.
public Publisher<Void>
setTransactionIsolationLevel(IsolationLevel
the isolation level for this transaction
isolationLevel
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setTransactionIsolationLevel.

Implements io.r2dbc.spi.Connection.setTransactionIsolationLevel.

Configures the isolation level for the connection.
public Publisher<Boolean>
validate(ValidationDepth
the validation depth
depth
)

Overrides org.jooq.tools.r2dbc.DefaultConnection.validate.

Implements io.r2dbc.spi.Connection.validate.

Validates the connection according to the given ValidationDepth.
Inherited from org.jooq.tools.r2dbc.DefaultConnection:
getDelegategetMetadatagetTransactionIsolationLevelisAutoCommit

Field Detail

logback to summary
private static final JooqLogger log

Constructor Detail

LoggingConnectionback to summary
public LoggingConnection(Connection delegate)

Method Detail

beginTransactionback to summary
public Publisher<Void> beginTransaction()

Overrides org.jooq.tools.r2dbc.DefaultConnection.beginTransaction.

Implements io.r2dbc.spi.Connection.beginTransaction.

Doc from io.r2dbc.spi.Connection.beginTransaction.

Begins a new transaction. Calling this method disables auto-commit mode.

Returns:Publisher<Void>

a Publisher that indicates that the transaction is open

Annotations
@Override
beginTransactionback to summary
public Publisher<Void> beginTransaction(TransactionDefinition definition)

Overrides org.jooq.tools.r2dbc.DefaultConnection.beginTransaction.

Implements io.r2dbc.spi.Connection.beginTransaction.

Doc from io.r2dbc.spi.Connection.beginTransaction.

Begins a new transaction. Calling this method disables auto-commit mode. Beginning the transaction may fail if the TransactionDefinition conflicts with the connection configuration.

Parameters
definition:TransactionDefinition

attributes for the transaction.

Returns:Publisher<Void>

a Publisher that indicates that the transaction is open

Annotations
@Override
closeback to summary
public Publisher<Void> close()

Overrides org.jooq.tools.r2dbc.DefaultConnection.close.

Implements io.r2dbc.spi.Connection.close.

Doc from io.r2dbc.spi.Connection.close.

Release any resources held by the Connection.

Returns:Publisher<Void>

a Publisher that termination is complete

Annotations
@Override
commitTransactionback to summary
public Publisher<Void> commitTransaction()

Overrides org.jooq.tools.r2dbc.DefaultConnection.commitTransaction.

Implements io.r2dbc.spi.Connection.commitTransaction.

Doc from io.r2dbc.spi.Connection.commitTransaction.

Commits the current transaction.

Returns:Publisher<Void>

a Publisher that indicates that a transaction has been committed

Annotations
@Override
createBatchback to summary
public Batch createBatch()

Overrides org.jooq.tools.r2dbc.DefaultConnection.createBatch.

Implements io.r2dbc.spi.Connection.createBatch.

Doc from io.r2dbc.spi.Connection.createBatch.

Creates a new Batch instance for building a batched request.

Returns:Batch

a new Batch instance

Annotations
@Override
createSavepointback to summary
public Publisher<Void> createSavepoint(String name)

Overrides org.jooq.tools.r2dbc.DefaultConnection.createSavepoint.

Implements io.r2dbc.spi.Connection.createSavepoint.

Doc from io.r2dbc.spi.Connection.createSavepoint.

Creates a savepoint in the current transaction.

Parameters
name:String

the name of the savepoint to create

Returns:Publisher<Void>

a Publisher that indicates that a savepoint has been created

Annotations
@Override
createStatementback to summary
public Statement createStatement(String sql)

Overrides org.jooq.tools.r2dbc.DefaultConnection.createStatement.

Implements io.r2dbc.spi.Connection.createStatement.

Doc from io.r2dbc.spi.Connection.createStatement.

Creates a new statement for building a statement-based request.

Parameters
sql:String

the SQL of the statement

Returns:Statement

a new Statement instance

Annotations
@Override
releaseSavepointback to summary
public Publisher<Void> releaseSavepoint(String name)

Overrides org.jooq.tools.r2dbc.DefaultConnection.releaseSavepoint.

Implements io.r2dbc.spi.Connection.releaseSavepoint.

Doc from io.r2dbc.spi.Connection.releaseSavepoint.

Releases a savepoint in the current transaction. Calling this for drivers not supporting savepoint release results in a no-op.

Parameters
name:String

the name of the savepoint to release

Returns:Publisher<Void>

a Publisher that indicates that a savepoint has been released

Annotations
@Override
rollbackTransactionback to summary
public Publisher<Void> rollbackTransaction()

Overrides org.jooq.tools.r2dbc.DefaultConnection.rollbackTransaction.

Implements io.r2dbc.spi.Connection.rollbackTransaction.

Doc from io.r2dbc.spi.Connection.rollbackTransaction.

Rolls back the current transaction.

Returns:Publisher<Void>

a Publisher that indicates that a transaction has been rolled back

Annotations
@Override
rollbackTransactionToSavepointback to summary
public Publisher<Void> rollbackTransactionToSavepoint(String name)

Overrides org.jooq.tools.r2dbc.DefaultConnection.rollbackTransactionToSavepoint.

Implements io.r2dbc.spi.Connection.rollbackTransactionToSavepoint.

Doc from io.r2dbc.spi.Connection.rollbackTransactionToSavepoint.

Rolls back to a savepoint in the current transaction.

Parameters
name:String

the name of the savepoint to rollback to

Returns:Publisher<Void>

a Publisher that indicates that a savepoint has been rolled back to

Annotations
@Override
setAutoCommitback to summary
public Publisher<Void> setAutoCommit(boolean autoCommit)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setAutoCommit.

Implements io.r2dbc.spi.Connection.setAutoCommit.

Doc from io.r2dbc.spi.Connection.setAutoCommit.

Configures the auto-commit mode for the current transaction. If a connection is in auto-commit mode, then all Statements will be executed and committed as individual transactions. Otherwise, in explicit transaction mode, transactions have to be started explicitly. A transaction needs to be either committed or rolled back to clean up the transaction state.

Calling this method during an active transaction and the auto-commit mode is changed, the transaction is committed. Calling this method without changing auto-commit mode this invocation results in a no-op.

Parameters
autoCommit:boolean

the isolation level for this transaction

Returns:Publisher<Void>

a Publisher that indicates that auto-commit mode has been configured

Annotations
@Override
setLockWaitTimeoutback to summary
public Publisher<Void> setLockWaitTimeout(Duration timeout)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setLockWaitTimeout.

Implements io.r2dbc.spi.Connection.setLockWaitTimeout.

Doc from io.r2dbc.spi.Connection.setLockWaitTimeout.

Configures the lock acquisition timeout for statements to be executed using the current connection. The default lock acquisition timeout is vendor-specific and can be specified for new connections through ConnectionFactoryOptions. If the timeout is exceeded, a R2dbcTimeoutException is raised.

In the case of Batch/Statement batching, it is vendor-specific as to whether the timeout is applied to individual SQL commands or the entire batch.

Parameters
timeout:Duration

the lock timeout for this connection. Support for no timeout is vendor-specific.

Returns:Publisher<Void>

a Publisher that indicates that a lock timeout has been configured

Annotations
@Override
setStatementTimeoutback to summary
public Publisher<Void> setStatementTimeout(Duration timeout)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setStatementTimeout.

Implements io.r2dbc.spi.Connection.setStatementTimeout.

Doc from io.r2dbc.spi.Connection.setStatementTimeout.

Configures the statement timeout for statements to be executed using the current connection. By default, there is no limit on the amount of time allowed for a running statement to complete unless specified through ConnectionFactoryOptions. If the limit is exceeded, a R2dbcTimeoutException is raised.

The minimum amount of time can be used to either let the data source cancel the statement or attempt a client-side cancellation. The timeout applies to statements through a combination of Statement#execute() and Result consumption. In the case of Batch/Statement batching, it is vendor-specific whether the timeout is applied to individual SQL commands or the entire batch.

Note that the timeout applies until receiving the first response from the data source and does not span until publisher completion.

Parameters
timeout:Duration

the statement timeout for this connection. Duration#ZERO indicates no timeout.

Returns:Publisher<Void>

a Publisher that indicates that a statement timeout has been configured

Annotations
@Override
setTransactionIsolationLevelback to summary
public Publisher<Void> setTransactionIsolationLevel(IsolationLevel isolationLevel)

Overrides org.jooq.tools.r2dbc.DefaultConnection.setTransactionIsolationLevel.

Implements io.r2dbc.spi.Connection.setTransactionIsolationLevel.

Doc from io.r2dbc.spi.Connection.setTransactionIsolationLevel.

Configures the isolation level for the connection. When called outside a transaction, then the isolation level applies for all subsequent transactions. Setting the isolation level within a transaction results in vendor-specific behavior.

Isolation level is typically one of the following constants:

IsolationLevel is extensible so drivers can accept a vendor-specific IsolationLevel.

Parameters
isolationLevel:IsolationLevel

the isolation level for this transaction

Returns:Publisher<Void>

a Publisher that indicates that a transaction level has been configured

Annotations
@Override
validateback to summary
public Publisher<Boolean> validate(ValidationDepth depth)

Overrides org.jooq.tools.r2dbc.DefaultConnection.validate.

Implements io.r2dbc.spi.Connection.validate.

Doc from io.r2dbc.spi.Connection.validate.

Validates the connection according to the given ValidationDepth. Emits true if the validation was successful or false if the validation failed. Does not emit errors and does not complete empty.

Parameters
depth:ValidationDepth

the validation depth

Returns:Publisher<Boolean>

a Publisher that indicates whether the validation was successful

Annotations
@Override