« Return to Thread: escape string to store in a database?

Re: escape string to store in a database?

by Rainy-3 :: Rate this Message:

Reply to Author | View in Thread

On Mar 14, 1:36 am, Dennis Lee Bieber <wlfr...@...> wrote:

> On Thu, 13 Mar 2008 19:55:27 -0700 (PDT), andrei....@... declaimed
> the following in comp.lang.python:
>
>
>
> > Thanks for the reply, Carsten, how would this work with UPDATE
> > command? I get this error:
>
> >         cmd = "UPDATE items SET content = ? WHERE id=%d" % id
>
>                 cmd = "update items set content = ? where id = ?"
>
> >     self.cursor.execute(cmd, content)
>
>                 self.cursor.execute(cmd, (content, id))
>
> would be the preferred method...

Thanks very much - this works perfectly -ak

>
> --
>         Wulfraed        Dennis Lee Bieber               KD6MOG
>         wlfr...@...               wulfr...@...
>                 HTTP://wlfraed.home.netcom.com/
>         (Bestiaria Support Staff:               web-a...@...)
>                 HTTP://www.bestiaria.com/

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

 « Return to Thread: escape string to store in a database?