summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mssql.py
diff options
context:
space:
mode:
authorPaul Johnston <paj@pajhome.org.uk>2007-11-25 22:46:22 +0000
committerPaul Johnston <paj@pajhome.org.uk>2007-11-25 22:46:22 +0000
commiteda2fc7c04ab003c5ec727ce92e4310519e0a0c2 (patch)
treedab143022b7befd85bc0d8e51513221d253a3bf2 /lib/sqlalchemy/databases/mssql.py
parentf5701297b119eb73287934e68ec6b1f9da3a6278 (diff)
downloadsqlalchemy-eda2fc7c04ab003c5ec727ce92e4310519e0a0c2.tar.gz
MSSQL/PyODBC no longer has a global set nocount on
Diffstat (limited to 'lib/sqlalchemy/databases/mssql.py')
-rw-r--r--lib/sqlalchemy/databases/mssql.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index f8c7f23e5..c24e28dfd 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -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):