News123 <news1...@free.fr> wrote:
>
>I'm using MYSQLdb
>
>and have following code
>
>db = MySQLdb.connect(**cfg)
>c = db.cursor()
>qrystr = "insert mytable set id = %s ,  other_field = %s"
>c.execute(qrystr, (id_val,other_field_val) )
>
>What I wondered is whether there is any way to print the 'filled in'
>query string for debuggin.
>
>The reason I'm askng is, that I'd like to copy paste the 'filled in'
>query string and try it from the command line.

You have the source code in front of you.  After you do the execute, the
actual query string that was transmitted is available in "c._executed".

If you need to know the result before you submit it, you can scan the
source for the "execute" method and see how they do the quoting.  It's not
that complicated.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to