SMF2 to discourse - Troubles importing attachments

Thanks a lot @pfaffman.
If I understood correctly your suggestion, I had to adapt it to the smf2.rb import script.
Since there is no such method as mysql_query(sql) in the script, I have updated what I think is the most likely equivalent of it.

def __query(db, sql, **opts)
    db.query(sql.gsub('{prefix}', options.prefix),
      { symbolize_keys: true, cache_rows: false }.merge(opts))
    rescue Exception => e
      puts '=' * 50
      puts "Problem with database. Trying again in 5"
      sleep 5
      puts e.message
      db = create_db_connection
      db.query(sql.gsub('{prefix}', options.prefix),
        { symbolize_keys: true, cache_rows: false }.merge(opts))
    end

What do you think?

Later today I’ll give it a try and come back with feedback.