|
@@ -37,8 +37,8 @@ module Blazer
|
|
def run_statement(statement, options = {})
|
|
def run_statement(statement, options = {})
|
|
rows = []
|
|
rows = []
|
|
error = nil
|
|
error = nil
|
|
- begin
|
|
|
|
- connection_model.transaction do
|
|
|
|
|
|
+ connection_model.transaction do
|
|
|
|
+ begin
|
|
connection_model.connection.execute("SET statement_timeout = #{timeout.to_i * 1000}") if timeout && postgresql?
|
|
connection_model.connection.execute("SET statement_timeout = #{timeout.to_i * 1000}") if timeout && postgresql?
|
|
comment = "blazer"
|
|
comment = "blazer"
|
|
if options[:user].respond_to?(:id)
|
|
if options[:user].respond_to?(:id)
|
|
@@ -55,10 +55,11 @@ module Blazer
|
|
end
|
|
end
|
|
rows << row
|
|
rows << row
|
|
end
|
|
end
|
|
|
|
+ rescue ActiveRecord::StatementInvalid => e
|
|
|
|
+ error = e.message.sub(/.+ERROR: /, "")
|
|
|
|
+ ensure
|
|
raise ActiveRecord::Rollback
|
|
raise ActiveRecord::Rollback
|
|
end
|
|
end
|
|
- rescue ActiveRecord::StatementInvalid => e
|
|
|
|
- error = e.message.sub(/.+ERROR: /, "")
|
|
|
|
end
|
|
end
|
|
[rows, error]
|
|
[rows, error]
|
|
end
|
|
end
|