desc
Ruby
code posted
by
asish
created at 28 Mar 23:32
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
class PatstatResqueWorker @queue = :patstat_worker_q def self.perform(queryid) puts "*******************************************************I'm a ResqueWorker and I'm working...***************************************************" patstatrouterPathquery = PatstatrouterPathquery.find(queryid) # puts patstatrouterPathquery.sql_query results = ActiveRecord::Base.connection.execute(patstatrouterPathquery.sql_query) # results = ActiveRecord::Base.connection.execute("Delete FROM idp.patstatrouter_pathqueries where id = 11") directory = "public" fileName = DateTime.now.to_s(:number) puts fileName File.open(File.join(directory, "#{fileName}.xls"), 'w') do |f| f.puts patstatrouterPathquery.sql_query results.each do |res| # puts res #prints hole row # puts res[0], res[1], res[2] #catch each column this way f.puts "#{res[0]} \t #{res[1]} \t #{res[2]}" #string congcatanation with tab. >> "#{variable} normal string" end end puts "******************************************************* I'm still alive :) *******************************************************" end end |
1.15 KB in 3 ms with coderay