En Mon, 29 Jun 2009 10:32:40 -0300, Petr Messner <petr.mess...@gmail.com> escribió:

use %s instead of %d in SQL statements, because (AFAIK) conversions
(including SQL escaping) from Python values to SQL values are done
before the % operator is called - that value is not a number by that
point.

I hope you understood it, sorry for my English :-) You can also check
MySQLdb module source, it's pretty clear.

It's best to think of %s as just a marker; other adapters use ? or :3 for the same purpose, and other styles exist too. The fact that it's the same character used for formatting strings with the % operator is an unfortunate coincidence (or a very bad choice, I don't know).

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to