2 ms·
If you learn SQL, please take the time to learn how to pass parameters without putting them in the query. Example in python: query = """Update employee set
by mikewarot 5y ago
If you learn SQL, please take the time to learn how to pass parameters without putting them in the query.
Example in python:
query = """Update employee set Salary = %s where id = %s"""
tuple1 = (8000, 5)
cursor.execute(query, tuple1)
It is very important that the parameters of a query never become part of the command string, or a whole class of injection attacks become possible.
At this point, you could still run into problems if your parameters and command string aren't in sync, so watch out for that as well. (Usually this would happen later as the code was modified for new requirements)