diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-08 16:14:47 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-08 16:14:47 -0500 |
| commit | 4e9e0f041c151cfa08d57773b49b254f1b4f8b6a (patch) | |
| tree | d562a026e88c93edae2f41ab3c1605881be3b3cd /lib/sqlalchemy/engine | |
| parent | 411cbf29e9742806bd76a69008981fee1371fe78 (diff) | |
| download | sqlalchemy-4e9e0f041c151cfa08d57773b49b254f1b4f8b6a.tar.gz | |
- merge r43460573c27a:4993c7eae8e5d117ff342bdc59f3b0635b898e2c of 0.6 branch
Diffstat (limited to 'lib/sqlalchemy/engine')
| -rw-r--r-- | lib/sqlalchemy/engine/__init__.py | 10 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/threadlocal.py | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/__init__.py b/lib/sqlalchemy/engine/__init__.py index aebf35436..e33dff53b 100644 --- a/lib/sqlalchemy/engine/__init__.py +++ b/lib/sqlalchemy/engine/__init__.py @@ -175,6 +175,16 @@ def create_engine(*args, **kwargs): be applied to all connections. See :meth:`~sqlalchemy.engine.base.Connection.execution_options` + :param implicit_returning=True: When ``False``, the RETURNING + feature of the database, if available, will not be used + to fetch newly generated primary key values. This applies + to those backends which support RETURNING or a compatible + construct, including Postgresql, Firebird, Oracle, Microsoft + SQL Server. The default behavior is to use a compatible RETURNING + construct when a single-row INSERT statement is emitted with no + existing returning() clause in order to fetch newly generated + primary key values. + :param label_length=None: optional integer value which limits the size of dynamically generated column labels to that many characters. If less than 6, labels are generated as diff --git a/lib/sqlalchemy/engine/threadlocal.py b/lib/sqlalchemy/engine/threadlocal.py index 2ce0922bf..d4d0488a9 100644 --- a/lib/sqlalchemy/engine/threadlocal.py +++ b/lib/sqlalchemy/engine/threadlocal.py @@ -71,16 +71,28 @@ class TLEngine(base.Engine): if not hasattr(self._connections, 'trans'): self._connections.trans = [] self._connections.trans.append(self.contextual_connect().begin_twophase(xid=xid)) + return self def begin_nested(self): if not hasattr(self._connections, 'trans'): self._connections.trans = [] self._connections.trans.append(self.contextual_connect().begin_nested()) + return self def begin(self): if not hasattr(self._connections, 'trans'): self._connections.trans = [] self._connections.trans.append(self.contextual_connect().begin()) + return self + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + if type is None: + self.commit() + else: + self.rollback() def prepare(self): if not hasattr(self._connections, 'trans') or \ |
