#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment'
before_time = Time.now
config = Rails::Configuration.new
db_config = config.database_configuration[RAILS_ENV]
{
:table=>"statement"
}.each do |table, statement|
system(%{cd #{RAILS_ROOT}/public && mysql -u #{db_config["username"]} -h #{db_config["host"]} -p#{db_config["password"]} #{db_config["database"]} -e '#{statement}' --xml > #{table}.xml})
end
after_time = Time.now
puts "Took: #{after_time - before_time}"
So awesome, I am.
0 Responses to Efficient XML generation in Ruby (RAILS)
Something to say?