diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-18 20:41:34 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-18 20:41:34 +0000 |
commit | 404be6e76155a5ef48f3d4a2c1a7e5538de135e9 (patch) | |
tree | ded6457b51484f57152f470b3f44077dbb164437 /lib/sqlalchemy/engine/base.py | |
parent | bc9e742b646f8dcd3e8a35c2ecda96bebed87d3c (diff) | |
download | sqlalchemy-404be6e76155a5ef48f3d4a2c1a7e5538de135e9.tar.gz |
- added _with_options() to Connection. not publicizing this yet.
- updated oursql driver with latest fixes using options. [ticket:1613]
- all the MySQL drivers get a shoutout in the docs
- marked tests that OurSQL has problems with (only three), passes 100% now
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index ddf2602c2..3fbc23312 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -706,9 +706,10 @@ class Connection(Connectable): .. index:: single: thread safety; Connection """ - + options = {} + def __init__(self, engine, connection=None, close_with_result=False, - _branch=False): + _branch=False, _options=None): """Construct a new Connection. Connection objects are typically constructed by an @@ -723,6 +724,8 @@ class Connection(Connectable): self.__savepoint_seq = 0 self.__branch = _branch self.__invalid = False + if _options: + self.options = _options def _branch(self): """Return a new Connection which references this Connection's @@ -734,7 +737,22 @@ class Connection(Connectable): """ return self.engine.Connection(self.engine, self.__connection, _branch=True) - + + def _with_options(self, **opt): + """Add keyword options to a Connection generatively. + + Experimental. May change the name/signature at + some point. + + If made public, strongly consider the name + "options()" so as to be consistent with + orm.Query.options(). + + """ + return self.engine.Connection( + self.engine, self.__connection, + _branch=self.__branch, _options=opt) + @property def dialect(self): "Dialect used by this Connection." |