Skip to content

Instantly share code, notes, and snippets.

@JakeAustwick
Created January 1, 2012 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakeAustwick/1545770 to your computer and use it in GitHub Desktop.
Save JakeAustwick/1545770 to your computer and use it in GitHub Desktop.
# Individual SQL statement take too long, one insert is by far the fastest
connection = ActiveRecord::Base.connection
#This is in a looop
results.push "(#{resp.response_header.status}, #{url[0]}, #{status_code(resp.response_header.status)}, \"#{resp.response_header}\")"
sql = "INSERT INTO reports (`code`, `site_id`, `status`, `headers`) VALUES #{results.join(", ")}"
connection.execute sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment