thank for answering so thoroughly. i should have said is this specific to a specific database type (or is it type-agnostic)? after reading you answers, i think it's db-agnostic/generic for sql. (if i'm reading it correctly) Thanks again, Greg ----------------------- Visit My Sites! http://1-4-u.info | Don't send insanely long links! www.syrbot.com | My Site www.syrbotwebdesign.com | My Site New Design (Under Construction) www.attackr.com | Latest Blog Posts www.superantispyware.com/superantispyware.html?rid=3971 Remove All The Spyware - Not Just The Easy Ones!
On Thu, Mar 11, 2010 at 8:45 AM, Anand Chitipothu <[email protected]>wrote: > On Thu, Mar 11, 2010 at 5:34 PM, Greg Milby <[email protected]> wrote: > > re: automatically escape % characters in the db query > > is this for a specific application, or everything (asking/wasn't > specified) > > I'm not sure what you mean by specific to an application. > > In web.py 0.33, the following query would fail. > > >>> db.query("SELECT * FROM thing WHERE key LIKE 'foo%'") > ERR: SELECT * FROM thing WHERE key LIKE 'foo%' > Traceback (most recent call last): > ... > IndexError: list index out of range > > The work around was to escape % with %%. > > >>> db.query("SELECT * FROM thing WHERE key LIKE 'foo%%'") > 0.22 (1): SELECT * FROM thing WHERE key LIKE 'foo%' > <web.utils.IterBetter instance at 0x16676e8> > > In 0.34 this has been fixed. > > >>> db.query("SELECT * FROM thing WHERE key LIKE 'foo%'") > 0.0 (1): SELECT * FROM thing WHERE key LIKE 'foo%' > <web.utils.IterBetter instance at 0x1667580> > > %% works still to provide backward-compatibility. > > >>> db.query("SELECT * FROM thing WHERE key LIKE 'foo%%'") > 0.0 (1): SELECT * FROM thing WHERE key LIKE 'foo%' > <web.utils.IterBetter instance at 0x16676e8> > > Does this answer your question? > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] <webpy%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
