From 549673753ac9a99e7ea33933b78222b2012571c0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 11 Aug 2006 18:48:59 +0000 Subject: [PATCH] added "nowait" flag to Select() [ticket:270] --- CHANGES | 1 + lib/sqlalchemy/ansisql.py | 3 +++ lib/sqlalchemy/sql.py | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 23f5031236..d88339419e 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,7 @@ return an array instead of string for SHOW CREATE TABLE call - all create()/drop() calls have a keyword argument of "connectable". "engine" is deprecated. - fixed ms-sql connect() to work with adodbapi +- added "nowait" flag to Select() 0.2.6 - big overhaul to schema to allow truly composite primary and foreign diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py index 7a76eddbe2..b85f67d47c 100644 --- a/lib/sqlalchemy/ansisql.py +++ b/lib/sqlalchemy/ansisql.py @@ -400,6 +400,9 @@ class ANSICompiler(sql.Compiled): if select.for_update: text += " FOR UPDATE" + + if select.nowait: + text += " NOWAIT" if getattr(select, 'parens', False): self.strings[select] = "(" + text + ")" diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 5d3c7692ad..33250506cf 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1337,6 +1337,7 @@ class CompoundSelect(SelectBaseMixin, FromClause): self.parens = kwargs.pop('parens', False) self.correlate = kwargs.pop('correlate', False) self.for_update = kwargs.pop('for_update', False) + self.nowait = kwargs.pop('nowait', False) for s in self.selects: s.group_by(None) s.order_by(None) @@ -1386,7 +1387,7 @@ class CompoundSelect(SelectBaseMixin, FromClause): class Select(SelectBaseMixin, FromClause): """represents a SELECT statement, with appendable clauses, as well as the ability to execute itself and return a result set.""" - def __init__(self, columns=None, whereclause = None, from_obj = [], order_by = None, group_by=None, having=None, use_labels = False, distinct=False, for_update=False, engine=None, limit=None, offset=None, scalar=False, correlate=True): + def __init__(self, columns=None, whereclause = None, from_obj = [], order_by = None, group_by=None, having=None, use_labels = False, distinct=False, for_update=False, nowait=False, engine=None, limit=None, offset=None, scalar=False, correlate=True): SelectBaseMixin.__init__(self) self._froms = util.OrderedDict() self.use_labels = use_labels @@ -1396,6 +1397,7 @@ class Select(SelectBaseMixin, FromClause): self.limit = limit self.offset = offset self.for_update = for_update + self.nowait = nowait # indicates that this select statement should not expand its columns # into the column clause of an enclosing select, and should instead -- 2.47.2