db question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bruce

    db question

    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



Working...