@@ -386,7 +386,7 @@ <T> FetchSpec<T> exchange(Supplier<String> sqlSupplier, BiFunction<Row, RowMetad
386
386
return statement ;
387
387
};
388
388
389
- Function <Connection , Flux <Result >> resultFunction = it -> Flux . from ( executeFunction . apply ( it ). execute () );
389
+ Function <Connection , Flux <Result >> resultFunction = toExecuteFunction ( sql , executeFunction );
390
390
391
391
return new DefaultSqlResult <>(DefaultDatabaseClient .this , //
392
392
sql , //
@@ -707,7 +707,7 @@ <R> FetchSpec<R> execute(PreparedOperation<?> preparedOperation, BiFunction<Row,
707
707
708
708
String sql = getRequiredSql (preparedOperation );
709
709
Function <Connection , Statement > selectFunction = wrapPreparedOperation (sql , preparedOperation );
710
- Function <Connection , Flux <Result >> resultFunction = it -> Flux . from ( selectFunction . apply ( it ). execute () );
710
+ Function <Connection , Flux <Result >> resultFunction = DefaultDatabaseClient . toExecuteFunction ( sql , selectFunction );
711
711
712
712
return new DefaultSqlResult <>(DefaultDatabaseClient .this , //
713
713
sql , //
@@ -1377,7 +1377,7 @@ private <R> FetchSpec<R> exchangeInsert(BiFunction<Row, RowMetadata, R> mappingF
1377
1377
String sql = getRequiredSql (operation );
1378
1378
Function <Connection , Statement > insertFunction = wrapPreparedOperation (sql , operation )
1379
1379
.andThen (statement -> statement .returnGeneratedValues ());
1380
- Function <Connection , Flux <Result >> resultFunction = it -> Flux . from ( insertFunction . apply ( it ). execute () );
1380
+ Function <Connection , Flux <Result >> resultFunction = toExecuteFunction ( sql , insertFunction );
1381
1381
1382
1382
return new DefaultSqlResult <>(this , //
1383
1383
sql , //
@@ -1390,7 +1390,7 @@ private UpdatedRowsFetchSpec exchangeUpdate(PreparedOperation<?> operation) {
1390
1390
1391
1391
String sql = getRequiredSql (operation );
1392
1392
Function <Connection , Statement > executeFunction = wrapPreparedOperation (sql , operation );
1393
- Function <Connection , Flux <Result >> resultFunction = it -> Flux . from ( executeFunction . apply ( it ). execute () );
1393
+ Function <Connection , Flux <Result >> resultFunction = toExecuteFunction ( sql , executeFunction );
1394
1394
1395
1395
return new DefaultSqlResult <>(this , //
1396
1396
sql , //
@@ -1421,6 +1421,16 @@ private Function<Connection, Statement> wrapPreparedOperation(String sql, Prepar
1421
1421
};
1422
1422
}
1423
1423
1424
+ private static Function <Connection , Flux <Result >> toExecuteFunction (String sql ,
1425
+ Function <Connection , Statement > executeFunction ) {
1426
+
1427
+ return it -> {
1428
+
1429
+ Flux <Result > from = Flux .defer (() -> executeFunction .apply (it ).execute ()).cast (Result .class );
1430
+ return from .checkpoint ("SQL \" " + sql + "\" [DatabaseClient]" );
1431
+ };
1432
+ }
1433
+
1424
1434
private static <T > Flux <T > doInConnectionMany (Connection connection , Function <Connection , Flux <T >> action ) {
1425
1435
1426
1436
try {
0 commit comments