Business intelligence made simple
Fixed error with Postgres when prepared statements are disabled with Rails < 6.1 - fixes #397
Andrew Kane207a38fd9531
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4e1f679b..7ee718ce 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,3 +1,7 @@+## 2.6.2 (unreleased)++- Fixed error with Postgres when prepared statements are disabled with Rails < 6.1+## 2.6.1 (2022-04-21)- Added `region` setting to Amazon Athenadiff --git a/lib/blazer/adapters/sql_adapter.rb b/lib/blazer/adapters/sql_adapter.rbindex cae8b232..4b2260d4 100644--- a/lib/blazer/adapters/sql_adapter.rb+++ b/lib/blazer/adapters/sql_adapter.rb@@ -191,9 +191,11 @@ module Blazer# Redshift adapter silently ignores bindsdef parameter_binding- if postgresql? || sqlite?+ if postgresql? && (ActiveRecord::VERSION::STRING.to_f >= 6.1 || prepared_statements?):numeric- elsif mysql? && connection_model.connection.prepared_statements+ elsif sqlite?+ :numeric+ elsif mysql? && prepared_statements?# Active Record silently ignores binds with MySQL when prepared statements are disabled:positionalelsif sqlserver?@@ -309,6 +311,10 @@ module Blazerendendend++ def prepared_statements?+ connection_model.connection.prepared_statements+ endendendend