google-code-export / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

pymssql defaults to auto-commit=True #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
new connections opened with pymssql should probably execute "SET 
IMPLICIT_TRANSACTIONS ON;" before returning to the user.  this is to maintain 
compliance with the DB-API spec.

from http://www.python.org/dev/peps/pep-0249/:

"Note that if the database supports an auto-commit feature, this must be 
initially off.  An interface method may be provided to turn it back on."

>>> pymssql.__version__
'1.0.2'

Original issue reported on code.google.com by pub...@kered.org on 11 Aug 2010 at 9:53

GoogleCodeExporter commented 9 years ago
This is fixed in trunk now, autocommit already defaults to False in trunk but 
now also calls SET IMPLICIT_TRANSACTIONS ON, thanks for the suggestion.

Original comment by dam...@gmail.com on 4 Jan 2011 at 7:53

GoogleCodeExporter commented 9 years ago
I am going to revert this actually in hindsight. I think you may have 
misinterpreted how IMPLICIT_TRANSACTIONS work, it opens a transaction and then 
leaves it open, which is quite odd behaviour and just caused a few hours 
debugging.

pymssql opens a transaction when it initially connects so there is no 
autocommit, at least in 1.9.909.

Original comment by dam...@gmail.com on 24 Feb 2011 at 3:42

GoogleCodeExporter commented 9 years ago
> in hindsight. I think you may have misinterpreted how IMPLICIT_TRANSACTIONS 
work

I agree.  Still the issue remains in 1.0.2 that pymssql autocommits after every 
execute.  Glad to hear it's fixed in head tho.  :)

Original comment by pub...@kered.org on 24 Feb 2011 at 4:58