Subject Re: [IBO] Newbie transaction questions
Author joe@jmmsoftware.com
> >I guess I'm basically asking two questions: 1) Does the
> >insert reserve the key, or does the commit reserve it?
>
> As above. The Post of the insert doesn't reserve anything. The first to
> commit wins and the other(s) get key violations.
>
> > 2) Does in insert
> >trigger a key violation, or does the commit trigger it?
>
> See above.

Ok, some clarifications:

If User A and User B both insert with the same key before either commits, will both
INSERTS succeed without Key Violations, and the Key Violation occurs with the
second COMMIT (not INSERT)?

What if User A inserts and commits, then User B inserts? Will User B get a Key
Violation on the INSERT, or on it's COMMIT?

Can both inserts and commits generate Key Violations (depending on the situation),
or is it only commits?

Another question: If I start a transaction and try to insert (or insert and commit) and
get a Key Violation, and I need to change the query (or paramaters) and retry, what
exactly would I do?
Rollback transaction, Start transaction, change SQL, Execute again
or, do I even have to bother rolling back and restarting? Can I just change the SQL
and re-Execute? What if the insert succeeded, but the commit failed?

-Joe