diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-07 16:47:00 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-07 16:47:00 +0000 |
| commit | 7bf90e2f4dc211423a409a747a2392922ed7a9c7 (patch) | |
| tree | 87500a8d9d1d4bca626fc7a8e51f6ffe2a4e5a28 /test/sql/query.py | |
| parent | 3715e10bf82786920bf8c018a99221f0d1713b3d (diff) | |
| download | sqlalchemy-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/query.py')
| -rw-r--r-- | test/sql/query.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/test/sql/query.py b/test/sql/query.py index 6233de743..f675c9114 100644 --- a/test/sql/query.py +++ b/test/sql/query.py @@ -170,18 +170,14 @@ class QueryTest(PersistTest): users.insert().execute(user_id = 8, user_name = 'fred') u = bindparam('userid') - s = users.select(or_(users.c.user_name==u, users.c.user_name==u)) + s = users.select(and_(users.c.user_name==u, users.c.user_name==u)) r = s.execute(userid='fred').fetchall() assert len(r) == 1 - def test_unique_conflict(self): u = bindparam('userid', unique=True) - s = users.select(or_(users.c.user_name==u, users.c.user_name==u)) - try: - str(s) - assert False - except exceptions.CompileError, e: - assert str(e) == "Bind parameter '{ANON %d userid}' conflicts with unique bind parameter of the same name" % id(u) + s = users.select(and_(users.c.user_name==u, users.c.user_name==u)) + r = s.execute({u:'fred'}).fetchall() + assert len(r) == 1 def test_bindparams_in_params(self): """test that a _BindParamClause itself can be a key in the params dict""" |
