]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
MSSQL/PyODBC no longer has a global set nocount on
authorPaul Johnston <paj@pajhome.org.uk>
Sun, 25 Nov 2007 22:46:22 +0000 (22:46 +0000)
committerPaul Johnston <paj@pajhome.org.uk>
Sun, 25 Nov 2007 22:46:22 +0000 (22:46 +0000)
CHANGES
lib/sqlalchemy/databases/mssql.py

diff --git a/CHANGES b/CHANGES
index d453bda38d95027f7c553f7c7925b6b0f65c332d..007691d3ad37c626884e4c11d579f687b1d3d68a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,10 @@ CHANGES
      We also copy the instances over without using any events now, so that
      the 'dirty' list on the new session remains unaffected.
 
+- dialects
+
+   - MSSQL/PyODBC no longer has a global "set nocount on".
+
 0.4.1
 -----
 
index f8c7f23e5873d703b3991ae56e3af76e509b092d..c24e28dfdeafec20015190f17d339c2a16bd7514 100644 (file)
@@ -345,17 +345,10 @@ class MSSQLExecutionContext(default.DefaultExecutionContext):
 
 class MSSQLExecutionContext_pyodbc (MSSQLExecutionContext):    
     def pre_exec(self):
-        """execute "set nocount on" on all connections, as a partial 
-        workaround for multiple result set issues."""
-                
-        if not getattr(self.connection, 'pyodbc_done_nocount', False):
-            self.connection.execute('SET nocount ON')
-            self.connection.pyodbc_done_nocount = True
-            
+        """where appropriate, issue "select scope_identity()" in the same statement"""                
         super(MSSQLExecutionContext_pyodbc, self).pre_exec()
-
-        # where appropriate, issue "select scope_identity()" in the same statement
-        if self.compiled.isinsert and self.HASIDENT and (not self.IINSERT) and self.dialect.use_scope_identity:
+        if self.compiled.isinsert and self.HASIDENT and (not self.IINSERT) \
+                and len(self.parameters) == 1 and self.dialect.use_scope_identity:
             self.statement += "; select scope_identity()"
 
     def post_exec(self):