[ticket:2144]
- sql
+ - Some improvements to error handling inside
+ of the execute procedure to ensure auto-close
+ connections are really closed when very
+ unusual DBAPI errors occur.
+
- Added explicit check for when Column .name
is assigned as blank string [ticket:2140]
try:
# non-DBAPI error - if we already got a context,
# or theres no string statement, don't wrap it
- if not isinstance(e, self.dialect.dbapi.Error) and \
- (statement is None or context is not None):
- return
+ should_wrap = isinstance(e, self.dialect.dbapi.Error) or \
+ (statement is not None and context is None)
- if context:
+ if should_wrap and context:
context.handle_dbapi_exception(e)
is_disconnect = isinstance(e, self.dialect.dbapi.Error) and \
self._autorollback()
if self.should_close_with_result:
self.close()
+
+ if not should_wrap:
+ return
+
# Py3K
#raise exc.DBAPIError.instance(
# statement,
uses ``returning()``.
"""
- return self.context.rowcount
+ try:
+ return self.context.rowcount
+ except Exception, e:
+ self.connection._handle_dbapi_exception(
+ e, None, None, self.cursor, self.context)
+ raise
@property
def lastrowid(self):
regardless of database backend.
"""
- return self._saved_cursor.lastrowid
+ try:
+ return self._saved_cursor.lastrowid
+ except Exception, e:
+ self.connection._handle_dbapi_exception(
+ e, None, None,
+ self._saved_cursor, self.context)
+ raise
@property
def returns_rows(self):