From 5fd371fa9cd8d57aa04d21a704db6fad0a2f2350 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 28 Feb 2010 21:29:20 +0000 Subject: some ms/odbc fixes --- lib/sqlalchemy/dialects/mssql/base.py | 4 ++-- lib/sqlalchemy/test/requires.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 988088fae..d1ccf44e2 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -803,9 +803,9 @@ class MSExecutionContext(default.DefaultExecutionContext): if self._select_lastrowid: if self.dialect.use_scope_identity: - self.cursor.execute("SELECT scope_identity() AS lastrowid") + self.cursor.execute("SELECT scope_identity() AS lastrowid", ()) else: - self.cursor.execute("SELECT @@identity AS lastrowid") + self.cursor.execute("SELECT @@identity AS lastrowid", ()) # fetchall() ensures the cursor is consumed without closing it row = self.cursor.fetchall()[0] self._lastrowid = int(row[0]) diff --git a/lib/sqlalchemy/test/requires.py b/lib/sqlalchemy/test/requires.py index 0bf4689df..6cfab18ce 100644 --- a/lib/sqlalchemy/test/requires.py +++ b/lib/sqlalchemy/test/requires.py @@ -66,6 +66,15 @@ def identity(fn): no_support('sybase', 'not supported by database'), ) +def independent_cursors(fn): + """Target must support simultaneous, independent database cursors on a single connection.""" + + return _chain_decorators_on( + fn, + no_support('mssql+pyodbc', 'no driver support'), + no_support('mssql+mxodbc', 'no driver support'), + ) + def independent_connections(fn): """Target must support simultaneous, independent database connections.""" -- cgit v1.2.1