|
Boost : |
Subject: Re: [boost] [std_rdb] [rdb] 0.0.09
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-09-30 11:37:11
Jean-Louis Leroy wrote:
>
> my plan is
> to support native bindings. In ODBC a transaction looks like this :
>
> set autocommit off
> do work
> commit or roll back
> do work
> commit or roll back
> etc
>
> This pattern is directly reflected in the current implementation. See
> the test suite in libs/rdb/test/test_odbc.cpp.
>
> Other vendors may have a different pattern :
>
> begin transaction
> do work
> commit or roll back
> begin transaction
> do work
> commit or roll back
If you provide an RAII class that does a start/begin/whatever in the ctor, a roll back in the dtor unless cancelled or committed, and provides member functions to commit or cancel on demand, then all back end schemes should be covered.
The ctor can throw an exception should a particular back end not support transactions.
Whether a back end supports nested transactions or not puts a wrinkle in the abstraction, of course. I suggest that you model nested transactions and simulate them for back ends that don't support them. In the latter case, the transaction class must use functions in some implementation layer that will track outstanding "nested" transaction objects in order to correctly decide whether to actually roll back when a transaction object's dtor runs or when commit() and roll_back() are called based upon what has already happened to the underlying, tracked state.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk