What do you think about making explicit transactions, starting one
when connection is retrieved from the pool, and ending it when it
is released back? (Question here is: how do we decide if we need
to commit the transaction or roll it back. Does explicit transaction
get rolled back if an exception is thrown by a stored proc?)
Alexey Parshin wrote:
Ilya,2008/12/23 Ilya A. Volynets-Evenbakh <email@example.com <mailto:firstname.lastname@example.org>>
The database exceptions are thrown in several different situations. This includes both read-only data access and data modifications. Normally, exceptions thrown by the stored procedures (any data access is done through stored procs) are re-thrown by sptk::CQuery as sptk::CException.
By the definition, any call of the stored procedure is a transaction. If the exception is thrown from within the stored procedure, the transaction is terminated and rolled back by PG server, to the state before the procedure call. If no exceptions are thrown, stored proc exits and transaction is committed by PG server.
The exception from the above rule is the manual transaction start (using CTransaction) and performing several procedure calls followed by explicit commit (rollback happens on exceptions), but this isn't used in UU at this point.
I have a few questions regarding UU database.
What happens if database exception is thrown in UU?
Does anything rollback? To what point?
Also, when does commit of a transaction happen?
Authoright © Total Knowledge: 2001-2008