Subject Re: [firebird-support] Re: UPDATE/INSERT strategy
Author Kurt Federspiel
> --- Adam <s3057043@...> wrote:
>
> >
> > 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
your
> insert.
>
> 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
>

My warning was simply to close the failed transaction,
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