diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-28 11:52:50 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-28 11:52:50 -0500 |
| commit | 106e793d0573b5bcd1ddee549bca1a546aa13972 (patch) | |
| tree | b7a5686e8c47be0fc1988dd184b00286f39ea101 /lib/sqlalchemy/dialects/oracle | |
| parent | 33e77c3077a15c51f30ac5aae724c768b9a06911 (diff) | |
| parent | e9aaf8eb66343f247b1ec2189707f820e20a0629 (diff) | |
| download | sqlalchemy-106e793d0573b5bcd1ddee549bca1a546aa13972.tar.gz | |
Merge branch 'for_update_of' of github.com:mlassnig/sqlalchemy into for_update_of
Diffstat (limited to 'lib/sqlalchemy/dialects/oracle')
| -rw-r--r-- | lib/sqlalchemy/dialects/oracle/base.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index e7263ba52..0bd009807 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -663,8 +663,28 @@ class OracleCompiler(compiler.SQLCompiler): def for_update_clause(self, select): if self.is_subquery(): return "" - elif select.for_update == "nowait": - return " FOR UPDATE NOWAIT" + + tmp = ' FOR UPDATE' + + # backwards compatibility + if isinstance(select.for_update, bool): + if select.for_update: + return tmp + elif isinstance(select.for_update, str): + if select.for_update == 'nowait': + return tmp + ' NOWAIT' + else: + return tmp + + if isinstance(select.for_update.of, list): + tmp += ' OF ' + ', '.join(['.'.join(of) for of in select.for_update.of]) + elif isinstance(select.for_update.of, tuple): + tmp += ' OF ' + '.'.join(select.for_update.of) + + if select.for_update.mode == 'update_nowait': + return tmp + ' NOWAIT' + elif select.for_update.mode == 'update': + return tmp else: return super(OracleCompiler, self).for_update_clause(select) |
