summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/engine/base.py6
-rw-r--r--lib/sqlalchemy/test/requires.py6
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 79cadaea9..4d6912ce4 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -2249,7 +2249,7 @@ class ResultProxy(object):
self.context = context
self.dialect = context.dialect
self.closed = False
- self.cursor = context.cursor
+ self.cursor = self._saved_cursor = context.cursor
self.connection = context.root_connection
self._echo = self.connection._echo and \
context.engine._should_log_debug()
@@ -2304,12 +2304,12 @@ class ResultProxy(object):
regardless of database backend.
"""
- return self.cursor.lastrowid
+ return self._saved_cursor.lastrowid
def _cursor_description(self):
"""May be overridden by subclasses."""
- return self.cursor.description
+ return self._saved_cursor.description
def _autoclose(self):
"""called by the Connection to autoclose cursors that have no pending
diff --git a/lib/sqlalchemy/test/requires.py b/lib/sqlalchemy/test/requires.py
index 501f0e24d..dc0b29228 100644
--- a/lib/sqlalchemy/test/requires.py
+++ b/lib/sqlalchemy/test/requires.py
@@ -247,6 +247,12 @@ def sane_rowcount(fn):
skip_if(lambda: not testing.db.dialect.supports_sane_rowcount)
)
+def dbapi_lastrowid(fn):
+ return _chain_decorators_on(
+ fn,
+ fails_on_everything_except('mysql+mysqldb', 'sqlite+pysqlite')
+ )
+
def sane_multi_rowcount(fn):
return _chain_decorators_on(
fn,