Class: Blazer::RunStatementJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/blazer/run_statement_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(data_source_id, statement, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/blazer/run_statement_job.rb', line 5

def perform(data_source_id, statement, options)
  statement = Blazer::Statement.new(statement, data_source_id)
  statement.values = options.delete(:values)
  data_source = statement.data_source
  begin
    ActiveRecord::Base.connection_pool.with_connection do
      Blazer::RunStatement.new.perform(statement, options)
    end
  rescue Exception => e
    result = Blazer::Result.new(data_source, [], [], "Unknown error", nil, false)
    data_source.result_cache.write_run(options[:run_id], result)
    raise e
  end
end