MySQL problem
wes weston
wweston at att.net
Fri Mar 18 11:22:37 EST 2005
Dennis Lee Bieber wrote:
> On Thu, 17 Mar 2005 16:45:57 GMT, wes weston <wweston at att.net> declaimed
> the following in comp.lang.python:
>
>
>>str = "INSERT INTO produkt1 (MyNumber) VALUES(%d)" % (MyNumber)
>>cursor.execute(str)
>>
>
> Think you meant "MyValue" for the second item... However...
>
> Try neither, the recommended method is to let the execute() do
> the formatting... That way /it/ can apply the needed quoting of
> arguments based upon the type of the data.
>
> cursor.execute("insert into produkt1 (MyNumber) values (%d)", (MyValue))
>
Dennis,
Do you know if this has some efficiency advantage
or is it just an agreed upon custom.
wes
More information about the Python-list
mailing list