summaryrefslogtreecommitdiff
path: root/test/sql/select.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-12-07 16:47:00 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-12-07 16:47:00 +0000
commit7bf90e2f4dc211423a409a747a2392922ed7a9c7 (patch)
tree87500a8d9d1d4bca626fc7a8e51f6ffe2a4e5a28 /test/sql/select.py
parent3715e10bf82786920bf8c018a99221f0d1713b3d (diff)
downloadsqlalchemy-7bf90e2f4dc211423a409a747a2392922ed7a9c7.tar.gz
fix to unique bind params, you *can* use the same unique bindparam multiple times
in a statement. the collision check is strictly detecting non-unique's that happen to have the same name.
Diffstat (limited to 'test/sql/select.py')
-rw-r--r--test/sql/select.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/sql/select.py b/test/sql/select.py
index d36703af4..66a87d6a0 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -968,7 +968,15 @@ EXISTS (select yay from foo where boo = lar)",
assert s2.compile().params == {'myid':8, 'myotherid':7}
assert s3.compile().params == {'myid':9, 'myotherid':7}
-
+ # test using same 'unique' param object twice in one compile
+ s = select([table1.c.myid]).where(table1.c.myid==12).as_scalar()
+ s2 = select([table1, s], table1.c.myid==s)
+ self.assert_compile(s2,
+ "SELECT mytable.myid, mytable.name, mytable.description, (SELECT mytable.myid FROM mytable WHERE mytable.myid = :mytable_myid_2) AS anon_1 FROM mytable WHERE mytable.myid = (SELECT mytable.myid FROM mytable WHERE mytable.myid = :mytable_myid_2)")
+ positional = s2.compile(dialect=sqlite.dialect())
+ pp = positional.get_params()
+ assert [pp[k] for k in positional.positiontup] == [12, 12]
+
# check that conflicts with "unique" params are caught
s = select([table1], or_(table1.c.myid==7, table1.c.myid==bindparam('mytable_myid_1')))
try: