db question

Discussion in 'Python' started by bruce, Jul 21, 2008.

  1. bruce

    bruce Guest

    update...

    in using the mysql_query log function, i get the following query being
    registered:

    select * from foo where dog like "%'small'%"

    so.. if i can figure out how to get rid of the "'" inside the "%" the query
    should/will work...

    thanks




    Hi...

    simple test

    mysql cmd - select * from foo where dog like "%small%";

    sql ="""select * from foo where dog like "%%%s%%" """
    c.execute(sql, (var,))


    the above doesn't work, and I can't seem to figure out how to display/print
    out the sql as i't actually been excuted, so I can see where the issue is.

    i've tried to "/" escape, as well as a few other things, now of which shed
    any light on the issue. haven't found any information via google either.

    the above works if i have something like
    sql="""select * from foo where dog=%s"""
    c.execute(sql,(var,))

    so.. any help/pointers on what i've screwed up/missed would be helpful.

    thanks
     
    bruce, Jul 21, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sean
    Replies:
    1
    Views:
    594
    Cowboy \(Gregory A. Beamer\)
    Oct 20, 2003
  2. =?Utf-8?B?UnlhbiBTbWl0aA==?=

    Quick Question - Newby Question

    =?Utf-8?B?UnlhbiBTbWl0aA==?=, Feb 14, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    658
    Iain Norman
    Feb 16, 2005
  3. =?Utf-8?B?YW5kcmV3MDA3?=

    question row filter (more of sql query question)

    =?Utf-8?B?YW5kcmV3MDA3?=, Oct 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    947
    Scott Allen
    Oct 6, 2005
  4. Philip Meyer
    Replies:
    0
    Views:
    422
    Philip Meyer
    Nov 30, 2003
  5. Bit Byte
    Replies:
    1
    Views:
    844
    Teemu Keiski
    Jan 28, 2007
Loading...

Share This Page