Subject | Re: [firebird-support] Re: UPDATE/INSERT strategy |
---|---|
Author | Kurt Federspiel |
Post date | 2007-05-03T16:24:37Z |
> --- Adam <s3057043@...> wrote:your
>
> >
> > Don't forget to roll back the original INSERT.
> >
>
> Why? If an insert statement raises an exception, it
> has no effect. Firebird automatically undoes
> anything it did within the operation if
> there is an unhandled exception.
>
> You only need to rollback if prior operations within
> your transactions should be considered atomic to
> insert.My warning was simply to close the failed transaction,
>
> Start Transaction T1
> Insert -> fails with Unique constraint violation
> Rollback T1
>
> has exactly the same effect as:
>
> Start Transaction T1
> Insert -> fails with Unique constraint violation
> Commit T1
>
> Adam
>
which I did not do upon trapping the error. In my
program, I did neither a commit not a rollback. In
the Classic Server (WinXP), this created about a dozen
fb_inet_server processes waiting to timeout.
I was not offering rollback as a better solution than
a commit for a failed transaction; I was offering
advice on how to avoid writing bugs...from personal
experience...doh.
Regards.
Kurt.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com