On 22/06/2015 11:05, George Neuner wrote:
Hi all,

I have what I hope is a quick question. WIth appropriate care to pair start and commit/rollback, is it safe to use call-with-transaction and start-transaction together?

e.g.,

  (call-with-transaction dbc
    (lambda ()
      :

      (start-transaction dbc #:isolation 'serializable)
         :
      (if (needs-rollback? dbc)
          (rollback-transaction dbc)
          (commit-transaction dbc))

      :
    ) #:isolation 'read-committed )

or the reverse:

  (start-transaction dbc #:isolation 'repeatable-read)
     :

    (call-with-transaction dbc
      (lambda ()
        :
      ) #:isolation 'serializable)

     :
  (if (needs-rollback? dbc)
      (rollback-transaction dbc)
      (commit-transaction dbc))



I am adding functionality involving sub-transactions to an existing code base that uses call-with-transaction pretty much exclusively and I'm hoping not to have to change the existing framework.

Thanks,
George

--
You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com <mailto:racket-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

The documentation says: "Calling either commit-transaction or rollback-transaction when the open transaction was created by call-with-transaction causes an exception to be raised." But they can be nested by further call-with-transaction calls, it says.

Last time I did an O/R mapper (in Java) I decided to put in a safety belt and use transaction tokens because non local jumps in GUI code are known to occur and involontary nesting may be hard to detect. My O/R mapper requested to use a valid transaction token from the GUI code each time an object wanted to start a transaction. Different transaction used different tokens and unmatched tokens produced an error. I think I saw three of these error conditions packed nicely into error messages - all in all three of them with testing included. There is the overhead of token passing but it's still worth it.

BTW Requesting isolation level support info from MySQL DB made me shudder back then: or there was some hidden HyperOracle release beneath mysql or that thing just lied about it's capabilities.

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to