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)
| 271 | ) |
| 272 | |
| 273 | def test_repeated_bindparams(self, connection): |
| 274 | """Tests that a BindParam can be used more than once. |
| 275 | |
| 276 | This should be run for DB-APIs with both positional and named |
| 277 | paramstyles. |
| 278 | """ |
| 279 | users = self.tables.users |
| 280 | |
| 281 | connection.execute(users.insert(), dict(user_id=7, user_name="jack")) |
| 282 | connection.execute(users.insert(), dict(user_id=8, user_name="fred")) |
| 283 | |
| 284 | u = bindparam("userid") |
| 285 | s = users.select().where( |
| 286 | and_(users.c.user_name == u, users.c.user_name == u) |
| 287 | ) |
| 288 | r = connection.execute(s, dict(userid="fred")).fetchall() |
| 289 | assert len(r) == 1 |
| 290 | |
| 291 | def test_bindparam_detection(self): |
| 292 | dialect = default.DefaultDialect(paramstyle="qmark") |