You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to specify transactions in the processing and not just globally on the entire connection? Maybe with some tag or some script? Or when certain conditions are met in a script/query?
e.g. something like:
<connectionid="in"driver="org.h2.Driver"/>
<connectionid="out"driver="org.h2.Driver"/>
<queryconnection-id="in">
select col11, col12, col13 from table1_in
<scriptconnection-id="out">
insert into table1_out (col11_out, col12_out, col13_out) values (?col11,?col12,?col13)
</script>
</query>
<queryconnection-id="in">
select col21, col22, col23 from table2_in
<scriptconnection-id="out">
insert into table2_out (col21_out, col22_out, col23_out) values (?col21,?col22,?col23)
</script>
</query>
<!-- Commit after the first 2 tables are ready! -->
<commit/>
<queryconnection-id="in">
select col31, col32, col33 from table3_in
<scriptconnection-id="out">
insert into table3_out (col31_out, col32_out, col33_out) values (?col31,?col32,?col33)
</script>
</query>
<queryconnection-id="in">
select col41, col42, col43 from table4_in
<scriptconnection-id="out">
insert into table4_out (col41_out, col42_out, col43_out) values (?col41,?col42,?col43)
</script>
</query>
<!-- Another Commit ! -->
<commit/>
<queryconnection-id="in">
select col51, col52, col53 from table5_in
<scriptconnection-id="out">
insert into table5_out (col51_out, col52_out, col53_out) values (?col51,?col52,?col53)
</script>
</query>
I've added this functionality in this pull (#7). I called it query based commit (sounds kind of strange, but it essentially triggers a commit around finishing a query element). Hope to find the time to fix the comments for that pull request.
Explicit transaction boundaries are a useful enhancement: the example would allow the first two table copies to be committed before processing subsequent tables.
Keeping this open for design. Transaction operations should target a specific connection, with clear semantics for rollback, nested execution, and failures after an earlier commit. The exact syntax is still to be determined.
This is related to #19, since early connection closure also needs defined transaction handling.
Activity
bhuesemann commentedon May 24, 2015
I've added this functionality in this pull (#7). I called it query based commit (sounds kind of strange, but it essentially triggers a commit around finishing a query element). Hope to find the time to fix the comments for that pull request.
hansgru commentedon May 26, 2015
@bhuesemann
This sounds good.
I hope it gets merged soon.
Any examples how to use it? The diffs do not show any docs changes regarding this issue.
aadrian commentedon May 30, 2015
+1
ejboy commentedon Oct 21, 2026
Explicit transaction boundaries are a useful enhancement: the example would allow the first two table copies to be committed before processing subsequent tables.
Keeping this open for design. Transaction operations should target a specific connection, with clear semantics for rollback, nested execution, and failures after an earlier commit. The exact syntax is still to be determined.
This is related to #19, since early connection closure also needs defined transaction handling.