Business intelligence made simple
Fixed bind params for SQLite
Andrew Kanebd55f3683109
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 32fa06a6..02210f42 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -28,3 +28,4 @@ jobs:database: blazer_test- run: bundle exec rake test- run: bundle exec rake test:postgresql+ - run: bundle exec rake test:sqlitediff --git a/Gemfile b/Gemfileindex d81b5db3..4e0db597 100644--- a/Gemfile+++ b/Gemfile@@ -7,6 +7,7 @@ gem "minitest", ">= 5"gem "combustion"gem "rails", "~> 8.0.0"gem "pg"+gem "sqlite3"gem "propshaft"# data sources@@ -27,7 +28,6 @@ gem "propshaft"# gem "opensearch-ruby"# gem "presto-client"# gem "restforce"-# gem "sqlite3"# gem "tiny_tds"# gem "trilogy"# gem "activerecord-sqlserver-adapter"diff --git a/gemfiles/rails70.gemfile b/gemfiles/rails70.gemfileindex 9d6fde03..788678ac 100644--- a/gemfiles/rails70.gemfile+++ b/gemfiles/rails70.gemfile@@ -7,4 +7,5 @@ gem "minitest", ">= 5"gem "combustion"gem "rails", "~> 7.0.0"gem "pg"+gem "sqlite3", "< 2"gem "sprockets-rails"diff --git a/gemfiles/rails71.gemfile b/gemfiles/rails71.gemfileindex 3fde838b..23a849cd 100644--- a/gemfiles/rails71.gemfile+++ b/gemfiles/rails71.gemfile@@ -7,4 +7,5 @@ gem "minitest", ">= 5"gem "combustion"gem "rails", "~> 7.1.0"gem "pg"+gem "sqlite3"gem "sprockets-rails"diff --git a/gemfiles/rails72.gemfile b/gemfiles/rails72.gemfileindex dc130db3..63426364 100644--- a/gemfiles/rails72.gemfile+++ b/gemfiles/rails72.gemfile@@ -7,4 +7,5 @@ gem "minitest", ">= 5"gem "combustion"gem "rails", "~> 7.2.0"gem "pg"+gem "sqlite3"gem "sprockets-rails"diff --git a/lib/blazer/adapters/sql_adapter.rb b/lib/blazer/adapters/sql_adapter.rbindex 46064154..1c30a063 100644--- a/lib/blazer/adapters/sql_adapter.rb+++ b/lib/blazer/adapters/sql_adapter.rb@@ -24,15 +24,15 @@ module Blazerresult = nilin_transaction doset_timeout(data_source.timeout) if data_source.timeout+ binds = bind_params.map { |v| ActiveRecord::Relation::QueryAttribute.new(nil, v, ActiveRecord::Type::Value.new) }if sqlite?type_map = connection_model.connection.send(:type_map)connection_model.connection.raw_connection.prepare("#{statement} /*#{comment}*/") do |stmt|- stmt.bind_params(bind_params)+ stmt.bind_params(connection_model.connection.send(:type_casted_binds, binds))types = stmt.columns.zip(stmt.types).to_h { |c, t| [c, type_map.lookup(t)] }result = ActiveRecord::Result.new(stmt.columns, stmt.to_a, types)endelse- binds = bind_params.map { |v| ActiveRecord::Relation::QueryAttribute.new(nil, v, ActiveRecord::Type::Value.new) }result = connection_model.connection.select_all("#{statement} /*#{comment}*/", nil, binds)endend