Tests that a BindParam can be used more than once. This should be run for DB-APIs with both positional and named paramstyles.
(self, connection)
| 295 | eq_(connection.execute(s, dict(id=7)).first()._mapping["user_id"], 7) |
| 296 | |
| 297 | def test_repeated_bindparams(self, connection): |
| 298 | """Tests that a BindParam can be used more than once. |
| 299 | |
| 300 | This should be run for DB-APIs with both positional and named |
| 301 | paramstyles. |
| 302 | """ |
| 303 | users = self.tables.users |
| 304 | |
| 305 | connection.execute(users.insert(), dict(user_id=7, user_name="jack")) |
| 306 | connection.execute(users.insert(), dict(user_id=8, user_name="fred")) |
| 307 | |
| 308 | u = bindparam("userid") |
| 309 | s = users.select().where( |
| 310 | and_(users.c.user_name == u, users.c.user_name == u) |
| 311 | ) |
| 312 | r = connection.execute(s, dict(userid="fred")).fetchall() |
| 313 | assert len(r) == 1 |
| 314 | |
| 315 | def test_bindparam_detection(self): |
| 316 | dialect = default.DefaultDialect(paramstyle="qmark") |