diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-12 21:07:24 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-12 21:07:24 -0400 |
commit | 8340361bfa93dab71b18827fa0b7e7dc91b1d736 (patch) | |
tree | cdf93e83cf4d2055510f507196b7194cf7ea115f /test/dialect/test_mssql.py | |
parent | daf286fc33e4008499f5aea14dc44630c3709c11 (diff) | |
download | sqlalchemy-8340361bfa93dab71b18827fa0b7e7dc91b1d736.tar.gz |
- [bug] Fixed compiler bug whereby a given
select() would be modified if it had an "offset"
attribute, causing the construct to not compile
correctly a second time. [ticket:2545]
Diffstat (limited to 'test/dialect/test_mssql.py')
-rw-r--r-- | test/dialect/test_mssql.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/dialect/test_mssql.py b/test/dialect/test_mssql.py index 7a6f2665e..1c6f8d02a 100644 --- a/test/dialect/test_mssql.py +++ b/test/dialect/test_mssql.py @@ -426,14 +426,17 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): s = select([t]).where(t.c.x==5).order_by(t.c.y).offset(20) - self.assert_compile( - s, - "SELECT anon_1.x, anon_1.y FROM (SELECT t.x AS x, t.y " - "AS y, ROW_NUMBER() OVER (ORDER BY t.y) AS " - "mssql_rn FROM t WHERE t.x = :x_1) AS " - "anon_1 WHERE mssql_rn > :mssql_rn_1", - checkparams={u'mssql_rn_1': 20, u'x_1': 5} - ) + # test that the select is not altered with subsequent compile + # calls + for i in xrange(2): + self.assert_compile( + s, + "SELECT anon_1.x, anon_1.y FROM (SELECT t.x AS x, t.y " + "AS y, ROW_NUMBER() OVER (ORDER BY t.y) AS " + "mssql_rn FROM t WHERE t.x = :x_1) AS " + "anon_1 WHERE mssql_rn > :mssql_rn_1", + checkparams={u'mssql_rn_1': 20, u'x_1': 5} + ) def test_limit_offset_using_window(self): t = table('t', column('x', Integer), column('y', Integer)) |