summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index b1c807df6..8b02d12a9 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -28,6 +28,7 @@ from sqlalchemy.engine import default
from sqlalchemy.dialects import mysql, mssql, postgresql, oracle, \
sqlite, sybase
from sqlalchemy.ext.compiler import compiles
+from sqlalchemy.sql import compiler
table1 = table('mytable',
column('myid', Integer),
@@ -181,6 +182,34 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
checkparams=params
)
+ def test_select_precol_compile_ordering(self):
+ s1 = select([column('x')]).select_from('a').limit(5).as_scalar()
+ s2 = select([s1]).limit(10)
+
+ class MyCompiler(compiler.SQLCompiler):
+ def get_select_precolumns(self, select):
+ result = ""
+ if select._limit:
+ result += "FIRST %s " % self.process(literal(select._limit))
+ if select._offset:
+ result += "SKIP %s " % self.process(literal(select._offset))
+ return result
+
+ def limit_clause(self, select):
+ return ""
+
+ dialect = default.DefaultDialect()
+ dialect.statement_compiler = MyCompiler
+ dialect.paramstyle = 'qmark'
+ dialect.positional = True
+ self.assert_compile(
+ s2,
+ "SELECT FIRST ? (SELECT FIRST ? x FROM a) AS anon_1",
+ checkpositional=(10, 5),
+ dialect=dialect
+ )
+
+
def test_from_subquery(self):
"""tests placing select statements in the column clause of
another select, for the