Transactions

cTDS utilizes the IMPLICIT_TRANSACTIONS feature of Microsoft SQL Server for transaction management. This approach was chosen given the similarities to the DB API 2.0 specification . The spec implies that transactions are implicitly created, but must be explicitly committed, using the k_ctds.Connection.commit() method, or rolled back, using the k_ctds.Connection.rollback() method.

cTDS supports disabling of the use of IMPLICIT_TRANSACTIONS if desired. In this case the k_ctds.Connection.commit() and k_ctds.Connection.rollback() methods have no affect and transactions are implicitly commited after each call to k_ctds.Cursor.execute(), k_ctds.Cursor.executemany() or k_ctds.Cursor.callproc().

Autocommit

The autocommit parameter to k_ctds.connect() and k_ctds.Connection.autocommit controls the use of IMPLICIT_TRANSACTIONS. When True, transactions are implicitly committed after an operation and calls to k_ctds.Connection.commit() are unnecessary (IMPLICIT_TRANSACTIONS is set to OFF).