Nov 092010

Saw someone on Twitter need this, so I whipped something up pretty quick. It’s not pretty, but it gets the job done.

You run it with:
ruby adif_to_sql.rb [ADIF_FILENAME] [MYSQL_TABLENAME]

You just specify the ADIF file and the name of the MySQL table name. The script creates an SQL file that can be imported directly into MySQL.

Get the script here:


Feb 182010

So I needed a way to replicate the ‘INSERT IGNORE’ statement in DataMapper and being that the code documentation is sparse, and I didn’t feel like force feeding an SQL statement into DM, I wrote some ruby code to replicate it.

If anyone has a better, or more refined solution, please let me know!

      rescue DataObjects::IntegrityError => e
        @logger.error e
        unless e.code == 1062
          throw e