module Geocoder::MaxmindDatabase

def insert_into_table(table, filepath)

def insert_into_table(table, filepath)
  start_time = Time.now
  print "Loading data for table #{table}"
  rows = []
  columns = table_columns(table)
  CSV.foreach(filepath, encoding: "ISO-8859-1") do |line|
    # Some files have header rows.
    # skip if starts with "Copyright" or "locId" or "startIpNum"
    next if line.first.match(/[A-z]/)
    rows << line.to_a
    if rows.size == 10000
      insert_rows(table, columns, rows)
      rows = []
      print "."
    end
  end
  insert_rows(table, columns, rows) if rows.size > 0
  puts "done (#{Time.now - start_time} seconds)"
end