diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-05 00:46:11 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-05 00:46:11 -0500 |
| commit | 8e24584d8d242d40d605752116ac05be33f697d3 (patch) | |
| tree | 3bd83f533b0743e4eef7f377e74a62d60adc4995 /lib/sqlalchemy/pool.py | |
| parent | af75fdf60fd3498ab3c5757e81a5d6b5e52f590d (diff) | |
| download | sqlalchemy-8e24584d8d242d40d605752116ac05be33f697d3.tar.gz | |
- ResultProxy and friends always reference the DBAPI connection at the same time
as the cursor. There is no reason for CursorFairy - the only use case would be,
end-user is using the pool or pool.manage with DBAPI connections, uses a cursor,
deferences the owning connection and continues using cursor. This is an almost
nonexistent use case and isn't correct usage at a DBAPI level. Take out CursorFairy.
- move the "check for a dot in the colname" logic out to the sqlite dialect.
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 387ef830d..02d56dead 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -419,8 +419,7 @@ class _ConnectionFairy(object): def cursor(self, *args, **kwargs): try: - c = self.connection.cursor(*args, **kwargs) - return _CursorFairy(self, c) + return self.connection.cursor(*args, **kwargs) except Exception, e: self.invalidate(e=e) raise @@ -487,42 +486,6 @@ class _ConnectionFairy(object): self.connection = None self._connection_record = None -class _CursorFairy(object): - __slots__ = '_parent', 'cursor', 'execute' - - def __init__(self, parent, cursor): - self._parent = parent - self.cursor = cursor - self.execute = cursor.execute - - def invalidate(self, e=None): - self._parent.invalidate(e=e) - - def __iter__(self): - return iter(self.cursor) - - def close(self): - try: - self.cursor.close() - except Exception, e: - try: - ex_text = str(e) - except TypeError: - ex_text = repr(e) - self._parent._logger.warn("Error closing cursor: %s", ex_text) - - if isinstance(e, (SystemExit, KeyboardInterrupt)): - raise - - def __setattr__(self, key, value): - if key in self.__slots__: - object.__setattr__(self, key, value) - else: - setattr(self.cursor, key, value) - - def __getattr__(self, key): - return getattr(self.cursor, key) - class SingletonThreadPool(Pool): """A Pool that maintains one connection per thread. |
