]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Corrected case in mssql where binary expression has bind parameters on both sides.
authorMichael Trier <mtrier@gmail.com>
Thu, 23 Oct 2008 01:47:40 +0000 (01:47 +0000)
committerMichael Trier <mtrier@gmail.com>
Thu, 23 Oct 2008 01:47:40 +0000 (01:47 +0000)
lib/sqlalchemy/databases/mssql.py

index 4bbc2caf770a006b75fd0cab787e03b014d2f6b7..e6da0d3fc1c55df0a2f78895382b3933f61a303f 100644 (file)
@@ -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)