Re: escape string to store in a database?

2008-03-14 Thread andrei . avk
On Mar 14, 1:36 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 13 Mar 2008 19:55:27 -0700 (PDT), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > > > Thanks for the reply, Carsten, how would this work with UPDATE > > command? I get this error: > > >         cmd = "

Re: escape string to store in a database?

2008-03-14 Thread jim-on-linux
> > -- > > Carsten > > Haesehttp://informixdb.sourceforge.net > > 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 try this; ("update items set contents = (?) where id =(?)", [ x, y]

Re: escape string to store in a database?

2008-03-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > how would this work with UPDATE > command? I get this error: > > cmd = "UPDATE items SET content = ? WHERE id=%d" % id > > self.cursor.execute(cmd, content) > pysqlite2.dbapi2.ProgrammingError: Incorrect number of bindings > supplied. The c > rrent statement

Re: escape string to store in a database?

2008-03-13 Thread andrei . avk
On Mar 12, 8:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Wed, 2008-03-12 at 18:18 -0700, [EMAIL PROTECTED] wrote: > > These pieces of text may have single and double quotes in > > them, I tried escaping them using re module and string module and > > either I did something wrong, or they e

Re: escape string to store in a database?

2008-03-12 Thread Carsten Haese
On Wed, 2008-03-12 at 18:18 -0700, [EMAIL PROTECTED] wrote: > These pieces of text may have single and double quotes in > them, I tried escaping them using re module and string module and > either I did something wrong, or they escape either single quotes or > double quotes, not both of these. So t

escape string to store in a database?

2008-03-12 Thread andrei . avk
Hi, I'd like to store chunks of text, some of them may be very large, in a database, and have them searchable using 'LIKE %something%' construct. These pieces of text may have single and double quotes in them, I tried escaping them using re module and string module and either I did something wrong,