summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-09-23 23:03:50 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-09-23 23:03:50 +0000
commit66a152bb77d226f3dd0a09581e2aea9bfeb28c2b (patch)
tree4a081693f681014928b5133ce7692a2b36848728 /lib/sqlalchemy/engine
parent929d09a2ede0c97332ca1507f60e69f0e16ee54c (diff)
downloadsqlalchemy-66a152bb77d226f3dd0a09581e2aea9bfeb28c2b.tar.gz
descriptive error message when an executioncontext-requiring call is called off a ResultProxy which was created via literal statement execution and therefore does not have an execution context.
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/base.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 1285e8490..3382a4217 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -540,13 +540,13 @@ class ResultProxy:
self.cursor = cursor
self.engine = engine
self.closed = False
- self.executioncontext = executioncontext
- self.echo = engine.echo=="debug"
- self.__key_cache = {}
- if executioncontext:
+ if executioncontext is not None:
+ self.__executioncontext = executioncontext
self.rowcount = executioncontext.get_rowcount(cursor)
else:
self.rowcount = cursor.rowcount
+ self.echo = engine.echo=="debug"
+ self.__key_cache = {}
metadata = cursor.description
self.props = {}
self.keys = []
@@ -566,6 +566,13 @@ class ResultProxy:
self.keys.append(colname)
self.props[i] = rec
i+=1
+ def _executioncontext(self):
+ try:
+ return self.__executioncontext
+ except AttributeError:
+ raise exceptions.InvalidRequestError("This ResultProxy does not have an execution context with which to complete this operation. Execution contexts are not generated for literal SQL execution.")
+ executioncontext = property(_executioncontext)
+
def close(self):
if not self.closed:
self.closed = True