jeudi 15 octobre 2015

Python's SQLite Parameter Substitution and Integers

The following SQL command works fine in the SQLite Console:

DELETE FROM services WHERE serviceId=1241523

However, when using the following Python syntax, I can't get the relevant row to delete:

serviceID = 1241523
c.execute("DELETE FROM services WHERE serviceId=?", (serviceId,))

It has no effect and deletes nothing from the services table. I expect that the integer is getting wrapped in quotations and therefor is trying to match a string representation instead of the integer stored in the database.

Is there a way around this?

Aucun commentaire:

Enregistrer un commentaire