From: Michael Trier Date: Thu, 23 Oct 2008 01:47:40 +0000 (+0000) Subject: Corrected case in mssql where binary expression has bind parameters on both sides. X-Git-Tag: rel_0_5rc3~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f919df47c7fa2524a0b943473612595baa0140b1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Corrected case in mssql where binary expression has bind parameters on both sides. --- diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 4bbc2caf77..e6da0d3fc1 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -1009,7 +1009,8 @@ class MSSQLCompiler(compiler.DefaultCompiler): def visit_binary(self, binary, **kwargs): """Move bind parameters to the right-hand side of an operator, where possible.""" - if isinstance(binary.left, expression._BindParamClause) and binary.operator == operator.eq: + if isinstance(binary.left, expression._BindParamClause) and binary.operator == operator.eq \ + and not isinstance(binary.right, expression._BindParamClause): return self.process(expression._BinaryExpression(binary.right, binary.left, binary.operator), **kwargs) else: return super(MSSQLCompiler, self).visit_binary(binary, **kwargs)