@@ -80,7 +80,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
private final DefaultDatabaseClientBuilder builder;
|
||||
|
||||
DefaultDatabaseClient(ConnectionFactory connector, R2dbcExceptionTranslator exceptionTranslator,
|
||||
ReactiveDataAccessStrategy dataAccessStrategy, DefaultDatabaseClientBuilder builder) {
|
||||
ReactiveDataAccessStrategy dataAccessStrategy, DefaultDatabaseClientBuilder builder) {
|
||||
|
||||
this.connector = connector;
|
||||
this.exceptionTranslator = exceptionTranslator;
|
||||
@@ -201,15 +201,15 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
*/
|
||||
protected Connection createConnectionProxy(Connection con) {
|
||||
return (Connection) Proxy.newProxyInstance(ConnectionProxy.class.getClassLoader(),
|
||||
new Class<?>[]{ConnectionProxy.class}, new CloseSuppressingInvocationHandler(con));
|
||||
new Class<?>[] { ConnectionProxy.class }, new CloseSuppressingInvocationHandler(con));
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate the given {@link R2dbcException} into a generic {@link DataAccessException}.
|
||||
*
|
||||
* @param task readable text describing the task being attempted.
|
||||
* @param sql SQL query or update that caused the problem (may be {@literal null}).
|
||||
* @param ex the offending {@link R2dbcException}.
|
||||
* @param sql SQL query or update that caused the problem (may be {@literal null}).
|
||||
* @param ex the offending {@link R2dbcException}.
|
||||
* @return a DataAccessException wrapping the {@link R2dbcException} (never {@literal null}).
|
||||
*/
|
||||
protected DataAccessException translateException(String task, @Nullable String sql, R2dbcException ex) {
|
||||
@@ -222,7 +222,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
* Customization hook.
|
||||
*/
|
||||
protected <T> DefaultTypedExecuteSpec<T> createTypedExecuteSpec(Map<Integer, SettableValue> byIndex,
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier, Class<T> typeToRead) {
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier, Class<T> typeToRead) {
|
||||
return new DefaultTypedExecuteSpec<>(byIndex, byName, sqlSupplier, typeToRead);
|
||||
}
|
||||
|
||||
@@ -230,8 +230,8 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
* Customization hook.
|
||||
*/
|
||||
protected <T> DefaultTypedExecuteSpec<T> createTypedExecuteSpec(Map<Integer, SettableValue> byIndex,
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier,
|
||||
BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier,
|
||||
BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
return new DefaultTypedExecuteSpec<>(byIndex, byName, sqlSupplier, mappingFunction);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
* Customization hook.
|
||||
*/
|
||||
protected ExecuteSpecSupport createGenericExecuteSpec(Map<Integer, SettableValue> byIndex,
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier) {
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier) {
|
||||
return new DefaultGenericExecuteSpec(byIndex, byName, sqlSupplier);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
}
|
||||
|
||||
private static void doBind(Statement<?> statement, Map<String, SettableValue> byName,
|
||||
Map<Integer, SettableValue> byIndex) {
|
||||
Map<Integer, SettableValue> byIndex) {
|
||||
|
||||
byIndex.forEach((i, o) -> {
|
||||
|
||||
@@ -377,7 +377,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
}
|
||||
|
||||
protected ExecuteSpecSupport createInstance(Map<Integer, SettableValue> byIndex, Map<String, SettableValue> byName,
|
||||
Supplier<String> sqlSupplier) {
|
||||
Supplier<String> sqlSupplier) {
|
||||
return new ExecuteSpecSupport(byIndex, byName, sqlSupplier);
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
protected class DefaultGenericExecuteSpec extends ExecuteSpecSupport implements GenericExecuteSpec {
|
||||
|
||||
DefaultGenericExecuteSpec(Map<Integer, SettableValue> byIndex, Map<String, SettableValue> byName,
|
||||
Supplier<String> sqlSupplier) {
|
||||
Supplier<String> sqlSupplier) {
|
||||
super(byIndex, byName, sqlSupplier);
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
|
||||
@Override
|
||||
protected ExecuteSpecSupport createInstance(Map<Integer, SettableValue> byIndex, Map<String, SettableValue> byName,
|
||||
Supplier<String> sqlSupplier) {
|
||||
Supplier<String> sqlSupplier) {
|
||||
return createGenericExecuteSpec(byIndex, byName, sqlSupplier);
|
||||
}
|
||||
}
|
||||
@@ -471,7 +471,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
private final BiFunction<Row, RowMetadata, T> mappingFunction;
|
||||
|
||||
DefaultTypedExecuteSpec(Map<Integer, SettableValue> byIndex, Map<String, SettableValue> byName,
|
||||
Supplier<String> sqlSupplier, Class<T> typeToRead) {
|
||||
Supplier<String> sqlSupplier, Class<T> typeToRead) {
|
||||
|
||||
super(byIndex, byName, sqlSupplier);
|
||||
|
||||
@@ -480,7 +480,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
}
|
||||
|
||||
DefaultTypedExecuteSpec(Map<Integer, SettableValue> byIndex, Map<String, SettableValue> byName,
|
||||
Supplier<String> sqlSupplier, BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
Supplier<String> sqlSupplier, BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
|
||||
super(byIndex, byName, sqlSupplier);
|
||||
|
||||
@@ -541,7 +541,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
|
||||
@Override
|
||||
protected DefaultTypedExecuteSpec<T> createInstance(Map<Integer, SettableValue> byIndex,
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier) {
|
||||
Map<String, SettableValue> byName, Supplier<String> sqlSupplier) {
|
||||
return createTypedExecuteSpec(byIndex, byName, sqlSupplier, typeToRead);
|
||||
}
|
||||
}
|
||||
@@ -628,7 +628,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
}
|
||||
|
||||
protected abstract DefaultSelectSpecSupport createInstance(String table, List<String> projectedFields, Sort sort,
|
||||
Pageable page);
|
||||
Pageable page);
|
||||
}
|
||||
|
||||
private class DefaultGenericSelectSpec extends DefaultSelectSpecSupport implements GenericSelectSpec {
|
||||
@@ -695,7 +695,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
|
||||
@Override
|
||||
protected DefaultGenericSelectSpec createInstance(String table, List<String> projectedFields, Sort sort,
|
||||
Pageable page) {
|
||||
Pageable page) {
|
||||
return new DefaultGenericSelectSpec(table, projectedFields, sort, page);
|
||||
}
|
||||
}
|
||||
@@ -706,8 +706,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
@SuppressWarnings("unchecked")
|
||||
private class DefaultTypedSelectSpec<T> extends DefaultSelectSpecSupport implements TypedSelectSpec<T> {
|
||||
|
||||
private final @Nullable
|
||||
Class<T> typeToRead;
|
||||
private final @Nullable Class<T> typeToRead;
|
||||
private final BiFunction<Row, RowMetadata, T> mappingFunction;
|
||||
|
||||
DefaultTypedSelectSpec(Class<T> typeToRead) {
|
||||
@@ -719,12 +718,12 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
}
|
||||
|
||||
DefaultTypedSelectSpec(String table, List<String> projectedFields, Sort sort, Pageable page,
|
||||
BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
this(table, projectedFields, sort, page, null, mappingFunction);
|
||||
}
|
||||
|
||||
DefaultTypedSelectSpec(String table, List<String> projectedFields, Sort sort, Pageable page, Class<T> typeToRead,
|
||||
BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
BiFunction<Row, RowMetadata, T> mappingFunction) {
|
||||
super(table, projectedFields, sort, page);
|
||||
this.typeToRead = typeToRead;
|
||||
this.mappingFunction = mappingFunction;
|
||||
@@ -784,7 +783,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
|
||||
@Override
|
||||
protected DefaultTypedSelectSpec<T> createInstance(String table, List<String> projectedFields, Sort sort,
|
||||
Pageable page) {
|
||||
Pageable page) {
|
||||
return new DefaultTypedSelectSpec<>(table, projectedFields, sort, page, typeToRead, mappingFunction);
|
||||
}
|
||||
}
|
||||
@@ -1022,8 +1021,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
} catch (R2dbcException e) {
|
||||
|
||||
String sql = getSql(action);
|
||||
return Flux.error(new UncategorizedR2dbcException("doInConnectionMany", sql, e) {
|
||||
});
|
||||
return Flux.error(new UncategorizedR2dbcException("doInConnectionMany", sql, e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,8 +1032,7 @@ class DefaultDatabaseClient implements DatabaseClient, ConnectionAccessor {
|
||||
} catch (R2dbcException e) {
|
||||
|
||||
String sql = getSql(action);
|
||||
return Mono.error(new UncategorizedR2dbcException("doInConnection", sql, e) {
|
||||
});
|
||||
return Mono.error(new UncategorizedR2dbcException("doInConnection", sql, e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user