diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-01-28 01:28:20 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-01-28 01:28:20 +0000 |
| commit | 397ba5d73d8486a2092cacfaaa743d92731ce67c (patch) | |
| tree | c8703adb47ed04f345374242a25055c2749f04e4 /test/sql/select.py | |
| parent | 7e7aa8f7c28628c4b5de7428c33ed63552e8f5b9 (diff) | |
| download | sqlalchemy-397ba5d73d8486a2092cacfaaa743d92731ce67c.tar.gz | |
- _CalculatedClause is gone
- Function rolls the various standalone execution functionality of CC into itself,
accesses its internal state more directly
- collate just uses _BinaryExpression, don't know why it didn't do this already
- added new _Case construct, compiles directly
- the world is a happier place
Diffstat (limited to 'test/sql/select.py')
| -rw-r--r-- | test/sql/select.py | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/test/sql/select.py b/test/sql/select.py index aff4a8670..2b721ba10 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -357,7 +357,7 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A select([x.label('foo')]), 'SELECT a AND b AND c AS foo' ) - + self.assert_compile( and_(table1.c.myid == 12, table1.c.name=='asdf', table2.c.othername == 'foo', "sysdate() = today()"), "mytable.myid = :myid_1 AND mytable.name = :name_1 "\ @@ -807,20 +807,28 @@ 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')])): + for expr in (select([table1.c.name.collate('latin1_german2_ci')]), + select([collate(table1.c.name, 'latin1_german2_ci')])): self.assert_compile( - expr, "SELECT mytable.name COLLATE somecol FROM mytable") + expr, "SELECT mytable.name COLLATE latin1_german2_ci AS anon_1 FROM mytable") + + assert table1.c.name.collate('latin1_german2_ci').type is table1.c.name.type + + expr = select([table1.c.name.collate('latin1_german2_ci').label('k1')]).order_by('k1') + self.assert_compile(expr,"SELECT mytable.name COLLATE latin1_german2_ci AS k1 FROM mytable ORDER BY k1") - expr = select([table1.c.name.collate('somecol').like('%x%')]) + expr = select([collate('foo', 'latin1_german2_ci').label('k1')]) + self.assert_compile(expr,"SELECT :param_1 COLLATE latin1_german2_ci AS k1") + + expr = select([table1.c.name.collate('latin1_german2_ci').like('%x%')]) self.assert_compile(expr, - "SELECT mytable.name COLLATE somecol " + "SELECT mytable.name COLLATE latin1_german2_ci " "LIKE :param_1 AS anon_1 FROM mytable") - expr = select([table1.c.name.like(collate('%x%', 'somecol'))]) + expr = select([table1.c.name.like(collate('%x%', 'latin1_german2_ci'))]) self.assert_compile(expr, "SELECT mytable.name " - "LIKE :param_1 COLLATE somecol AS anon_1 " + "LIKE :param_1 COLLATE latin1_german2_ci AS anon_1 " "FROM mytable") expr = select([table1.c.name.collate('col1').like( @@ -830,10 +838,14 @@ FROM mytable, myothertable WHERE foo.id = foofoo(lala) AND datetime(foo) = Today "LIKE :param_1 COLLATE col2 AS anon_1 " "FROM mytable") - expr = select([func.concat('a', 'b').collate('somecol').label('x')]) + expr = select([func.concat('a', 'b').collate('latin1_german2_ci').label('x')]) self.assert_compile(expr, "SELECT concat(:param_1, :param_2) " - "COLLATE somecol AS x") + "COLLATE latin1_german2_ci AS x") + + + expr = select([table1.c.name]).order_by(table1.c.name.collate('latin1_german2_ci')) + self.assert_compile(expr, "SELECT mytable.name FROM mytable ORDER BY mytable.name COLLATE latin1_german2_ci") def test_percent_chars(self): t = table("table%name", |
