[jOOQ/jOOQ#14445] Delay ExecuteContext::connection in BatchMultiple and BatchSingle
This commit is contained in:
parent
6db826afa7
commit
a90243a275
@ -537,9 +537,6 @@ implements
|
||||
try {
|
||||
// [#8968] Keep start() event inside of lifecycle management
|
||||
listener.start(ctx);
|
||||
|
||||
Connection connection = ctx.connection();
|
||||
|
||||
listener.renderStart(ctx);
|
||||
// [#1520] TODO: Should the number of bind values be checked, here?
|
||||
ctx.sql(create(configuration).render(this));
|
||||
@ -547,7 +544,7 @@ implements
|
||||
|
||||
listener.prepareStart(ctx);
|
||||
if (ctx.statement() == null)
|
||||
ctx.statement(connection.prepareCall(ctx.sql()));
|
||||
ctx.statement(ctx.connection().prepareCall(ctx.sql()));
|
||||
Tools.setFetchSize(ctx, 0);
|
||||
// [#1856] TODO: Add Statement flags like timeout here
|
||||
listener.prepareEnd(ctx);
|
||||
|
||||
@ -92,7 +92,6 @@ final class BatchMultiple extends AbstractBatch {
|
||||
static int[] execute(Configuration configuration, Query[] queries) {
|
||||
DefaultExecuteContext ctx = new DefaultExecuteContext(configuration, BatchMode.MULTIPLE, queries);
|
||||
ExecuteListener listener = ExecuteListeners.get(ctx);
|
||||
Connection connection = ctx.connection();
|
||||
|
||||
try {
|
||||
|
||||
@ -101,7 +100,7 @@ final class BatchMultiple extends AbstractBatch {
|
||||
ctx.transformQueries(listener);
|
||||
|
||||
if (ctx.statement() == null)
|
||||
ctx.statement(new SettingsEnabledPreparedStatement(connection));
|
||||
ctx.statement(new SettingsEnabledPreparedStatement(ctx.connection()));
|
||||
|
||||
String[] batchSQL = ctx.batchSQL();
|
||||
for (int i = 0; i < ctx.batchQueries().length; i++) {
|
||||
|
||||
@ -189,7 +189,6 @@ final class BatchSingle extends AbstractBatch implements BatchBindStep {
|
||||
private final int[] executePrepared() {
|
||||
DefaultExecuteContext ctx = new DefaultExecuteContext(configuration, BatchMode.SINGLE, new Query[] { query });
|
||||
ExecuteListener listener = ExecuteListeners.get(ctx);
|
||||
Connection connection = ctx.connection();
|
||||
|
||||
Param<?>[] params = extractParams();
|
||||
|
||||
@ -205,7 +204,7 @@ final class BatchSingle extends AbstractBatch implements BatchBindStep {
|
||||
|
||||
listener.prepareStart(ctx);
|
||||
if (ctx.statement() == null)
|
||||
ctx.statement(connection.prepareStatement(ctx.sql()));
|
||||
ctx.statement(ctx.connection().prepareStatement(ctx.sql()));
|
||||
listener.prepareEnd(ctx);
|
||||
|
||||
// [#9295] use query timeout from settings
|
||||
|
||||
Loading…
Reference in New Issue
Block a user