Re: Escaping optional parameter in WHERE clause

2009-03-23 Thread Steve Holden
MRAB wrote: > someone wrote: >> Hi, >> >> as you can see below I have some optional parameter for my query (mf, >> age). They are in WHERE clause only if not empty. >> In this function they are not escaped as, for example, 'search' >> parameter, cause I can't pass them to execute function, which do

Re: Escaping optional parameter in WHERE clause

2009-03-23 Thread someon
On Mar 23, 1:48 pm, MRAB wrote: > someone wrote: > > Hi, > > > as you can see below I have some optional parameter for my query (mf, > > age). They are in WHERE clause only if not empty. > > In this function they are not escaped as, for example, 'search' > > parameter, cause I can't pass them to e

Re: Escaping optional parameter in WHERE clause

2009-03-23 Thread andrew cooke
ah, sorry, from title i guess you were aware of this. andrew andrew cooke wrote: > note that your version is open to sql injection attacks, while mrab's > reply isn't. andrew > > someone wrote: >> if mf: >> mf = " AND mf = %s " % mf >> if age: >> age = "

Re: Escaping optional parameter in WHERE clause

2009-03-23 Thread andrew cooke
note that your version is open to sql injection attacks, while mrab's reply isn't. andrew someone wrote: > if mf: > mf = " AND mf = %s " % mf > if age: > age = " AND age = %s " % age -- http://mail.python.org/mailman/listinfo/python-list

Re: Escaping optional parameter in WHERE clause

2009-03-23 Thread MRAB
someone wrote: Hi, as you can see below I have some optional parameter for my query (mf, age). They are in WHERE clause only if not empty. In this function they are not escaped as, for example, 'search' parameter, cause I can't pass them to execute function, which does escaping automatically. I

Escaping optional parameter in WHERE clause

2009-03-23 Thread someone
Hi, as you can see below I have some optional parameter for my query (mf, age). They are in WHERE clause only if not empty. In this function they are not escaped as, for example, 'search' parameter, cause I can't pass them to execute function, which does escaping automatically. I could write anot