Avoid backslashes to escape SQL statements, as this usage is deprecated. Convert backslash plus single quote to two single quotes, and remove any backslashes before double quotes. See new function pm_generic_escape_to_sql_escape().