Re: strange use of %s

2011-04-25 Thread Chris Angelico
On Tue, Apr 26, 2011 at 8:01 AM, John Nagle wrote: > Don't worry about having MySQL do the CONCAT.  That happens > once during query parsing here, because all the arguments to > CONCAT are defined in the statement. > Good point. Although the abstraction is still a little leaky in that you can't u

Re: strange use of %s

2011-04-25 Thread John Nagle
On 4/18/2011 1:44 AM, Tim Golden wrote: On 18/04/2011 09:29, Tracubik wrote: Hi all, i'm reading a python tutorial in Ubuntu's Full Circle Magazine and i've found this strange use of %s: sql = "SELECT pkid,name,source,servings FROM Recipes WHERE name like '%%%s% %'" %response response is a str

Re: strange use of %s

2011-04-18 Thread Chris Angelico
On Tue, Apr 19, 2011 at 3:22 PM, Dennis Lee Bieber wrote: > On Mon, 18 Apr 2011 09:44:40 +0100, Tim Golden > declaimed the following in gmane.comp.python.general: > > >>    sql = "SELECT ... WHERE name LIKE '%' + ? + '%'" >>    q = db.cursor () >>    q.execute (sql, [response]) >> >        That w

Re: strange use of %s

2011-04-18 Thread Chris Angelico
On Mon, Apr 18, 2011 at 6:29 PM, Tracubik wrote: > Hi all, > i'm reading a python tutorial in Ubuntu's Full Circle Magazine and i've > found this strange use of %s: > > sql = "SELECT pkid,name,source,servings FROM Recipes WHERE name like '%%%s% > %'" %response > > response is a string. I've newbie

Re: strange use of %s

2011-04-18 Thread Tim Golden
On 18/04/2011 09:29, Tracubik wrote: Hi all, i'm reading a python tutorial in Ubuntu's Full Circle Magazine and i've found this strange use of %s: sql = "SELECT pkid,name,source,servings FROM Recipes WHERE name like '%%%s% %'" %response response is a string. I've newbie in sql. why do the code