Anyone know, if I have a nested transaction, will it be the outer most
transaction (i.e. from outermost transaction start, to outermost
transaction end) that will be used?
i.e. noting Rails doesn't currently support nested transactions.
Another way to ask would be to say, if there was a database statement
error between the end of the innermost transaction and the end of the
outmost transaction, would the innermost transaction database
statements be rolled back?
Anyone know, if I have a nested transaction, will it be the outer most
transaction (i.e. from outermost transaction start, to outermost
transaction end) that will be used?
i.e. noting Rails doesn't currently support nested transactions.
Another way to ask would be to say, if there was a database statement
error between the end of the innermost transaction and the end of the
outmost transaction, would the innermost transaction database
statements be rolled back?
THis is probably database dependant but on mysql at least a nested
begin will commit the existing transaction and begin a new one (which
is why rails is careful not to start a new actual transaction in this
case). rails 2.3 supports savepoints for what it's worth.
thanks - so this means for the moment at least (until v2.3) one has to
be careful re having a method with a transaction begin, that within
may call another method that itself has a transaction begin. So
really group your methods into ones that use & don't use transactions
explicitly I guess...
thanks - so this means for the moment at least (until v2.3) one has to
be careful re having a method with a transaction begin, that within
may call another method that itself has a transaction begin. So
really group your methods into ones that use & don't use transactions
explicitly I guess...
You're ok if you're not doing things by hand: if you do
Foo.transaction do
Foo.transaction do
...
end
end
then the inner call to transaction is basically a no-op.