mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-04 23:06:24 -04:00
Pulled out values test that uses boolean evaluation in the SELECT in order to appropriately flag it as not supported on mssql. I sure hope I didn't jack things up for other dialects. Cleaned up a comment and removed some commented pdb statements.
This commit is contained in:
@@ -1016,9 +1016,10 @@ class MSSQLCompiler(compiler.DefaultCompiler):
|
||||
return super(MSSQLCompiler, self).visit_column(column, result_map=result_map, **kwargs)
|
||||
|
||||
def visit_binary(self, binary, **kwargs):
|
||||
"""Move bind parameters to the right-hand side of an operator, where possible."""
|
||||
#import pdb
|
||||
#pdb.set_trace()
|
||||
"""Move bind parameters to the right-hand side of an operator, where
|
||||
possible.
|
||||
|
||||
"""
|
||||
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)
|
||||
|
||||
+10
-4
@@ -1495,9 +1495,6 @@ class MixedEntitiesTest(QueryTest):
|
||||
q2 = q.order_by(User.id).values(User.name, User.name + " " + cast(User.id, String))
|
||||
self.assertEquals(list(q2), [(u'jack', u'jack 7'), (u'ed', u'ed 8'), (u'fred', u'fred 9'), (u'chuck', u'chuck 10')])
|
||||
|
||||
q2 = q.group_by([User.name.like('%j%')]).order_by(desc(User.name.like('%j%'))).values(User.name.like('%j%'), func.count(User.name.like('%j%')))
|
||||
self.assertEquals(list(q2), [(True, 1), (False, 3)])
|
||||
|
||||
q2 = q.join('addresses').filter(User.name.like('%e%')).order_by(User.id, Address.id).values(User.name, Address.email_address)
|
||||
self.assertEquals(list(q2), [(u'ed', u'ed@wood.com'), (u'ed', u'ed@bettyboop.com'), (u'ed', u'ed@lala.com'), (u'fred', u'fred@fred.com')])
|
||||
|
||||
@@ -1525,7 +1522,16 @@ class MixedEntitiesTest(QueryTest):
|
||||
# whereas this uses users.c.xxx, is not aliased and creates a new join
|
||||
q2 = q.select_from(sel).filter(users.c.id==8).filter(users.c.id>sel.c.id).values(users.c.name, sel.c.name, User.name)
|
||||
self.assertEquals(list(q2), [(u'ed', u'jack', u'jack')])
|
||||
|
||||
|
||||
@testing.fails_on('mssql')
|
||||
def test_values_with_boolean_selects(self):
|
||||
"""Tests a values clause that works with select boolean evaluations"""
|
||||
sess = create_session()
|
||||
|
||||
q = sess.query(User)
|
||||
q2 = q.group_by([User.name.like('%j%')]).order_by(desc(User.name.like('%j%'))).values(User.name.like('%j%'), func.count(User.name.like('%j%')))
|
||||
self.assertEquals(list(q2), [(True, 1), (False, 3)])
|
||||
|
||||
def test_scalar_subquery(self):
|
||||
"""test that a subquery constructed from ORM attributes doesn't leak out
|
||||
those entities to the outermost query.
|
||||
|
||||
Reference in New Issue
Block a user