[#5058] Add DSLContext.batch(Queries) and other overloads where Query[] or Collection<? extends Query> are accepted
This commit is contained in:
parent
4c1795f30c
commit
753797a025
@ -6555,6 +6555,25 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support
|
||||
Batch batch(Query... queries);
|
||||
|
||||
/**
|
||||
* Create a batch statement to execute a set of queries in batch mode
|
||||
* (without bind values).
|
||||
* <p>
|
||||
* This essentially runs the following logic: <code><pre>
|
||||
* Statement s = connection.createStatement();
|
||||
*
|
||||
* for (Query query : queries) {
|
||||
* s.addBatch(query.getSQL(true));
|
||||
* }
|
||||
*
|
||||
* s.execute();
|
||||
* </pre></code>
|
||||
*
|
||||
* @see Statement#executeBatch()
|
||||
*/
|
||||
@Support
|
||||
Batch batch(Queries queries);
|
||||
|
||||
/**
|
||||
* Create a batch statement to execute a set of queries in batch mode
|
||||
* (without bind values).
|
||||
|
||||
@ -285,6 +285,7 @@ import org.jooq.tools.StopWatchListener;
|
||||
* {@link InsertResultStep#fetch()}</li>
|
||||
* <li>Used with {@link DSLContext#batch(Query)}</li>
|
||||
* <li>Used with {@link DSLContext#batch(Query[])}</li>
|
||||
* <li>Used with {@link DSLContext#batch(Queries)}</li>
|
||||
* <li>Used with a {@link Routine} standalone call</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
|
||||
@ -49,8 +49,8 @@ import static org.jooq.impl.DSL.sequence;
|
||||
import static org.jooq.impl.DSL.sql;
|
||||
import static org.jooq.impl.DSL.table;
|
||||
import static org.jooq.impl.DSL.trueCondition;
|
||||
import static org.jooq.impl.Utils.list;
|
||||
import static org.jooq.impl.Utils.blocking;
|
||||
import static org.jooq.impl.Utils.list;
|
||||
import static org.jooq.tools.Convert.convert;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -160,6 +160,7 @@ import org.jooq.MergeUsingStep;
|
||||
import org.jooq.Meta;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Param;
|
||||
import org.jooq.Queries;
|
||||
import org.jooq.Query;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.Record;
|
||||
@ -2205,6 +2206,11 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new BatchMultiple(configuration(), queries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Batch batch(Queries queries) {
|
||||
return batch(queries.queries());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Batch batch(String... queries) {
|
||||
Query[] result = new Query[queries.length];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user