Business intelligence made simple
Raise error when timeout not supported
Andrew Kane06d5ef638fe1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 10a7e7a6..83648d80 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,7 @@- Switched to Chart.js for charts- Better output for explain- Support for MySQL timeouts+- Raise error when timeout not supported## 1.2.1diff --git a/lib/blazer.rb b/lib/blazer.rbindex b3ba56cf..d817d76e 100644--- a/lib/blazer.rb+++ b/lib/blazer.rb@@ -6,6 +6,8 @@ require "blazer/data_source"require "blazer/engine"module Blazer+ class TimeoutNotSupported < StandardError; end+class << selfattr_accessor :auditattr_reader :time_zonediff --git a/lib/blazer/data_source.rb b/lib/blazer/data_source.rbindex 6d341020..2554bba7 100644--- a/lib/blazer/data_source.rb+++ b/lib/blazer/data_source.rb@@ -84,6 +84,8 @@ module Blazerconnection_model.connection.execute("SET statement_timeout = #{timeout.to_i * 1000}")elsif mysql?connection_model.connection.execute("SET max_execution_time = #{timeout.to_i * 1000}")+ else+ raise Blazer::TimeoutNotSupported, "Timeout not supported for #{adapter_name} adapter"endend@@ -146,11 +148,8 @@ module Blazerdef in_transactionif use_transaction?connection_model.transaction do- begin- yield- ensure- raise ActiveRecord::Rollback- end+ yield+ raise ActiveRecord::Rollbackendelseyield