Thread: BEGIN Behaviour

BEGIN Behaviour

From
"Constantin S. Svintsoff"
Date:
hello, there!

I think correct behaviour for issuing BEGIN in ODBC is:

 All the statements that are issued when autocommit is off should
be executed inside transaction block, because there is no
possibility to determine if particular statement modifies database
state or no. (SELECT can be used to execute stored procedure
that modifies database state, etc. It would be very bad if
changes made by such SELECT will be rolled back if there was
some INSERT/UPDATE/DELETE, etc, before it, and not rolled back
if no).

So I think it would be correct to issue BEGIN in SQLSetConnectAttr what
sets autocommit off, and in SQLEndTran after COMMIT or ROLLBACK.
And issue COMMIT in SQLSetConnectAttr that sets autocommit ON.

P.S. Sorry for my poor English

/Constantin