Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.
Currently, we have the ability to use arbitrary SQL commands via addSqlChange():
MyDb.addSqlChange(ctx -> {
for(int i = 0; i < N; i++) {
"[.sql/] insert into country (country) values (:value)".execute( ctx, "name" + i );
}
});
This is nice, however in this case it is more performant to batch the insert commands in one call.
Proposal
Add a batch counterpart to addSqlChange, say addBatchChange.
MyDb.addBatchChange(ctx -> {
for(int i = 0; i < N; i++) {
"[.sql/] insert into country (country) values (:value)".execute( ctx, "name" + i );
}
});
Basically, make it so one can easily change any addSqlChange to an addBatchChange where SQL calls are automatically batched where possible.
Since there are two kinds of batch modes: parameterized vs unparameterized. A resulting batch will consist of one batch for all non-parameterized commands and N batches corresponding with parameterized commands.
Note, although entity CRUD calls may be used within addSqlChange they are not amenable to batching, therefor SQL commands generated from those calls will remain unchanged inside addBatchChange.
Currently, we have the ability to use arbitrary SQL commands via addSqlChange():
This is nice, however in this case it is more performant to batch the insert commands in one call.
Proposal
Add a batch counterpart to addSqlChange, say addBatchChange.
Basically, make it so one can easily change any addSqlChange to an addBatchChange where SQL calls are automatically batched where possible.
Since there are two kinds of batch modes: parameterized vs unparameterized. A resulting batch will consist of one batch for all non-parameterized commands and N batches corresponding with parameterized commands.
Note, although entity CRUD calls may be used within addSqlChange they are not amenable to batching, therefor SQL commands generated from those calls will remain unchanged inside addBatchChange.