lib/blazer/adapters/sql_adapter.rb in sql-jarvis-2.0.1 vs lib/blazer/adapters/sql_adapter.rb in sql-jarvis-2.0.2
- old
+ new
@@ -153,10 +153,16 @@
def set_timeout(timeout)
if postgresql? || redshift?
execute("SET #{use_transaction? ? "LOCAL " : ""}statement_timeout = #{timeout.to_i * 1000}")
elsif mysql?
- execute("SET max_execution_time = #{timeout.to_i * 1000}")
+ # use send as this method is private in Rails 4.2
+ mariadb = connection_model.connection.send(:mariadb?) rescue false
+ if mariadb
+ execute("SET max_statement_time = #{timeout.to_i * 1000}")
+ else
+ execute("SET max_execution_time = #{timeout.to_i * 1000}")
+ end
else
raise Blazer::TimeoutNotSupported, "Timeout not supported for #{adapter_name} adapter"
end
end