[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Database exceptions
Thanks.
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?)
Ilya.
Alexey Parshin wrote:
Ilya,
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.
2008/12/23 Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com
<mailto:ilya@total-knowledge.com>>
Alexey,
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?
Ilya.
--
Alexey Parshin,
http://www.sptk.net