summaryrefslogtreecommitdiff
path: root/test/sql/select.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-04-16 00:53:21 +0000
committerJason Kirtland <jek@discorporate.us>2008-04-16 00:53:21 +0000
commit24797113708c0f19ef0d5d81e2950b33f8c1a425 (patch)
tree7e44582f775579cf40679112a2611e1bbab84d87 /test/sql/select.py
parentf5126ab3a169b6f8a9171868fe32b2bd385f8b8f (diff)
downloadsqlalchemy-24797113708c0f19ef0d5d81e2950b33f8c1a425.tar.gz
- Support for COLLATE: collate(expr, col) and expr.collate(col)
Diffstat (limited to 'test/sql/select.py')
-rw-r--r--test/sql/select.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py
index b51e65d33..1e9683592 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -751,6 +751,35 @@ FROM mytable, myothertable WHERE foo.id = foofoo(lala) AND datetime(foo) = Today
self.assert_compile(select([extract("day", func.to_date("03/20/2005", "MM/DD/YYYY"))]), "SELECT extract(day FROM to_date(:to_date_1, :to_date_2)) AS extract_1")
+ def test_collate(self):
+ for expr in (select([table1.c.name.collate('somecol')]),
+ select([collate(table1.c.name, 'somecol')])):
+ self.assert_compile(
+ expr, "SELECT mytable.name COLLATE somecol FROM mytable")
+
+ expr = select([table1.c.name.collate('somecol').like('%x%')])
+ self.assert_compile(expr,
+ "SELECT mytable.name COLLATE somecol "
+ "LIKE :param_1 AS anon_1 FROM mytable")
+
+ expr = select([table1.c.name.like(collate('%x%', 'somecol'))])
+ self.assert_compile(expr,
+ "SELECT mytable.name "
+ "LIKE :param_1 COLLATE somecol AS anon_1 "
+ "FROM mytable")
+
+ expr = select([table1.c.name.collate('col1').like(
+ collate('%x%', 'col2'))])
+ self.assert_compile(expr,
+ "SELECT mytable.name COLLATE col1 "
+ "LIKE :param_1 COLLATE col2 AS anon_1 "
+ "FROM mytable")
+
+ expr = select([func.concat('a', 'b').collate('somecol').label('x')])
+ self.assert_compile(expr,
+ "SELECT concat(:param_1, :param_2) "
+ "COLLATE somecol AS x")
+
def test_joins(self):
self.assert_compile(
join(table2, table1, table1.c.myid == table2.c.otherid).select(),