From e9aaf8eb66343f247b1ec2189707f820e20a0629 Mon Sep 17 00:00:00 2001 From: Mario Lassnig Date: Thu, 28 Nov 2013 14:50:41 +0100 Subject: added LockmodeArgs --- lib/sqlalchemy/dialects/oracle/base.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'lib/sqlalchemy/dialects/oracle/base.py') diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index 74441e9a8..c0d9732b4 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -664,14 +664,24 @@ class OracleCompiler(compiler.SQLCompiler): tmp = ' FOR UPDATE' - 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) + # 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 == 'nowait': + if select.for_update.mode == 'update_nowait': return tmp + ' NOWAIT' - elif select.for_update: + elif select.for_update.mode == 'update': return tmp else: return super(OracleCompiler, self).for_update_clause(select) -- cgit v1.2.1