mysql - How to do a WHERE ... IN in Python safely? -
this question has answer here:
- using ___ in ___ statement 1 answer
i have list of integer id's correspond rows in database, , need out specific rows specific set of id's. query follows:
select id, name locations id in (1,4,5,7,8,...)
i imploding list comma separated string, not safe sql injection. there way, using prepared statements, bind list of integers?
if not, suitable workaround check each item in list numeric, , proceeding query?
as far know there s no way in mysql this. implode list of '?' length of locations list, , bind parameters normal prepared statement.
Comments
Post a Comment