[#2236] Add DSLContext.batch(String...) and batch(String, Object[]...)
to easily create batch statements from SQL strings
This commit is contained in:
parent
fff27acbeb
commit
c49763fd6f
@ -4019,6 +4019,19 @@ public interface DSLContext {
|
||||
@Support
|
||||
Batch batch(Query... queries);
|
||||
|
||||
/**
|
||||
* Execute a set of queries in batch mode (without bind values).
|
||||
* <p>
|
||||
* This is a convenience method for calling
|
||||
* <code><pre>batch(query(queries[0]), query(queries[1]), ...)</pre></code>.
|
||||
*
|
||||
* @see #query(String)
|
||||
* @see #batch(Query...)
|
||||
* @see Statement#executeBatch()
|
||||
*/
|
||||
@Support
|
||||
Batch batch(String... queries);
|
||||
|
||||
/**
|
||||
* Execute a set of queries in batch mode (without bind values).
|
||||
* <p>
|
||||
@ -4070,6 +4083,19 @@ public interface DSLContext {
|
||||
@Support
|
||||
BatchBindStep batch(Query query);
|
||||
|
||||
/**
|
||||
* Execute a set of queries in batch mode (with bind values).
|
||||
* <p>
|
||||
* This is a convenience method for calling
|
||||
* <code><pre>batch(query(sql))</pre></code>.
|
||||
*
|
||||
* @see #query(String)
|
||||
* @see #batch(Query)
|
||||
* @see Statement#executeBatch()
|
||||
*/
|
||||
@Support
|
||||
BatchBindStep batch(String sql);
|
||||
|
||||
/**
|
||||
* Execute a set of queries in batch mode (with bind values).
|
||||
* <p>
|
||||
@ -4086,6 +4112,19 @@ public interface DSLContext {
|
||||
@Support
|
||||
Batch batch(Query query, Object[]... bindings);
|
||||
|
||||
/**
|
||||
* Execute a set of queries in batch mode (with bind values).
|
||||
* <p>
|
||||
* This is a convenience method for calling
|
||||
* <code><pre>batch(query(sql), bindings)</pre></code>.
|
||||
*
|
||||
* @see #query(String)
|
||||
* @see #batch(Query, Object[][])
|
||||
* @see Statement#executeBatch()
|
||||
*/
|
||||
@Support
|
||||
Batch batch(String sql, Object[]... bindings);
|
||||
|
||||
/**
|
||||
* Execute a set of <code>INSERT</code> and <code>UPDATE</code> queries in
|
||||
* batch mode (with bind values).
|
||||
|
||||
@ -1362,6 +1362,18 @@ class DSLContextImpl implements DSLContext, Serializable {
|
||||
return new BatchMultiple(configuration, queries);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Support
|
||||
public final Batch batch(String... queries) {
|
||||
Query[] result = new Query[queries.length];
|
||||
|
||||
for (int i = 0; i < queries.length; i++) {
|
||||
result[i] = query(queries[i]);
|
||||
}
|
||||
|
||||
return batch(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Support
|
||||
public final Batch batch(Collection<? extends Query> queries) {
|
||||
@ -1374,12 +1386,24 @@ class DSLContextImpl implements DSLContext, Serializable {
|
||||
return new BatchSingle(configuration, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Support
|
||||
public final BatchBindStep batch(String sql) {
|
||||
return batch(query(sql));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Support
|
||||
public final Batch batch(Query query, Object[]... bindings) {
|
||||
return batch(query).bind(bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Support
|
||||
public final Batch batch(String sql, Object[]... bindings) {
|
||||
return batch(query(sql), bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Support
|
||||
public final Batch batchStore(UpdatableRecord<?>... records) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user