Skip to content

Transaction Tag? #17

Open
Open

Description

@hansgru

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:

<connection id="in" driver="org.h2.Driver"/>
<connection id="out" driver="org.h2.Driver"/>

<query connection-id="in">
   select col11, col12, col13 from table1_in
   <script connection-id="out">
        insert into table1_out (col11_out, col12_out, col13_out) values (?col11,?col12,?col13)
   </script>
</query>

<query connection-id="in">
   select col21, col22, col23 from table2_in
   <script connection-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/>

<query connection-id="in">
   select col31, col32, col33 from table3_in
   <script connection-id="out">
        insert into table3_out (col31_out, col32_out, col33_out) values (?col31,?col32,?col33)
   </script>
</query>

<query connection-id="in">
   select col41, col42, col43 from table4_in
   <script connection-id="out">
        insert into table4_out (col41_out, col42_out, col43_out) values (?col41,?col42,?col43)
   </script>
</query>

<!-- Another Commit ! -->
<commit/>

<query connection-id="in">
   select col51, col52, col53 from table5_in
   <script connection-id="out">
        insert into table5_out (col51_out, col52_out, col53_out) values (?col51,?col52,?col53)
   </script>
</query>

Thank you.

Activity

  1. bhuesemann commented on May 24, 2015

    @bhuesemann

    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.

  2. hansgru commented on May 26, 2015

    @hansgru
    Author

    @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.

  3. aadrian commented on May 30, 2015

    @aadrian

    +1

  4. ejboy commented on Oct 21, 2026

    @ejboy
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions