Open FaFre opened 1 year ago
Thanks for the suggestion and for offering to help :) I think this idea would be neat, but I also don't have any obvious ideas on how to expose this.
For transactions, we can use keep the interface as it is and push the information that we're in a transaction into the current zone. This doesn't work for batches, since batches don't directly execute the SQL when customStatement
is called. Maybe there could be a marker in a .drift
file to indicate whether the statement should be used in a batch? Then we can expose it under a different interface (perhaps even as an extension on Batch
).
I have two more ideas to add, I don't know what is preferable tbh, I don't have the complete picture:
Batch? batch
to the generated function and act accordingly if not null. This could be added to all generated functions.@rawSql: SELECT 1
to define statements as pure strings
I use some custom inserts during my
Batch
which I add ascustomStatement
. The downside here is, that I have now two different sources for SQL statements: somewhere inside code and in my drift files. I would like to have all SQL statements neatly in my drift files, where it belongs to.I'm willing to contribute code, but I don't know what would be a good way to achieve that.
One idea I have would be to generate a
GenerationContext
that could be added to the batch.