100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/blazer/data_source.rb', line 100
def run_statement(statement, options = {})
statement = Statement.new(statement, self) if statement.is_a?(String)
statement.bind unless statement.bind_statement
result = nil
if cache_mode != "off"
if options[:refresh_cache]
clear_cache(statement) else
result = result_cache.read_statement(statement)
end
end
unless result
= "blazer"
if options[:user].respond_to?(:id)
<< ",user_id:#{options[:user].id}"
end
if options[:user].respond_to?(Blazer.user_name)
<< ",user_name:#{options[:user].send(Blazer.user_name).to_s.gsub(/[^a-zA-Z0-9 ]/, "")}"
end
if options[:query].respond_to?(:id)
<< ",query_id:#{options[:query].id}"
end
if options[:check]
<< ",check_id:#{options[:check].id},check_emails:#{options[:check].emails}"
end
if options[:run_id]
<< ",run_id:#{options[:run_id]}"
end
result = run_statement_helper(statement, , options)
end
if options[:async] && options[:run_id]
run_id = options[:run_id]
begin
result_cache.write_run(run_id, result)
rescue
result = Blazer::Result.new(self, [], [], "Error storing the results of this query :(", nil, false)
result_cache.write_run(run_id, result)
end
end
result
end
|