Multiple statements + Warnings = Exception

Help
2011-03-01
2012-09-19
  • Tommy Ellqvist
    Tommy Ellqvist
    2011-03-01

    I am using MySQLdb and I need to use multiple INSERT statement queries like
    this:

    "INSERT ...; INSERT ...;"

    However, one of these inserts generate a type conversion warning and I get an
    exception saying "commands out of sync".

    The problem seems to be that the warning mechanism (connections.show_warnings)
    makes the query "SHOW WARNINGS". But since this occurs in the middle of my
    .nextset() loop the commands are out of sync. Can you suggest a solution?

    It seems that the warning mechanism will not work in this scenario. Can the
    warning call be postponed or ignored?

    Is it even possible to rearrange these commands to make it work, or will I
    have to make sure I don't get any warnings?