blazer 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6deb8aff915dbda37c6d49f0469e9d0244faf48ee24bff2e486ac467ab13e90e
4
- data.tar.gz: 8b93cfc07025251e4a216f0cb42e5d91baa739d0107c874bbc41d7cd28653823
3
+ metadata.gz: ecc87353b5a9b96402e82c59b497929b5544f320d6c9f82316b92d005c18f74d
4
+ data.tar.gz: 19b1a0697e3901e25c8b77f2ce769d427849c97f8012240fdce26a74f069c03d
5
5
  SHA512:
6
- metadata.gz: 17e7e661e5a0339baf19bd7278e1661645890bc59d3db06db00ceacdc7671471f41c66f5e8dadaf8ba1746bc072d374b97328d9178dc099a25943ede2f33d29a
7
- data.tar.gz: f4cf77965a7f906f790da30205e28f43ec1c22fbda3dfa3d0e4091be95fd007435a5a079caac616f6096fd2927c064f1d216976924b67080bc9b33534f780666
6
+ metadata.gz: c090577a5e80ac9ae9a870e096d1317b78cd7815fb6f9e65a1e59bb41fb779d2cbac6f37ec3cb3854351069d57b52b5937fa7cb1e0a85d73919ee59229501d8a
7
+ data.tar.gz: 1590b68605c634a98a3ee4794eae49c5b19b9d683ff453871117983684e70c3b0c3222298e63a312719b9a676aa3d364a56dcc1664c10c2146800736103e4638
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 3.0.3 (2024-01-10)
2
+
3
+ - Fixed error with Trilogy, non-ASCII column names, and charts
4
+
5
+ ## 3.0.2 (2023-11-28)
6
+
7
+ - Fixed error with SQLite and prepared statements
8
+
1
9
  ## 3.0.1 (2023-10-08)
2
10
 
3
11
  - Fixed error with Rails 7.1 when no user model
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2023 Andrew Kane
1
+ Copyright (c) 2014-2024 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -10,7 +10,7 @@ Blazer is also available as a [Docker image](https://github.com/ankane/blazer-do
10
10
 
11
11
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
12
12
 
13
- [![Build Status](https://github.com/ankane/blazer/workflows/build/badge.svg?branch=master)](https://github.com/ankane/blazer/actions)
13
+ [![Build Status](https://github.com/ankane/blazer/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/blazer/actions)
14
14
 
15
15
  ## Features
16
16
 
@@ -30,6 +30,8 @@ module Blazer
30
30
 
31
31
  layout "blazer/application"
32
32
 
33
+ default_form_builder ::ActionView::Helpers::FormBuilder
34
+
33
35
  private
34
36
 
35
37
  def process_vars(statement, var_params = nil)
@@ -21,15 +21,21 @@ module Blazer
21
21
  error = nil
22
22
 
23
23
  begin
24
+ result = nil
24
25
  in_transaction do
25
26
  set_timeout(data_source.timeout) if data_source.timeout
26
-
27
27
  binds = bind_params.map { |v| ActiveRecord::Relation::QueryAttribute.new(nil, v, ActiveRecord::Type::Value.new) }
28
28
  result = connection_model.connection.select_all("#{statement} /*#{comment}*/", nil, binds)
29
- columns = result.columns
30
- result.rows.each do |untyped_row|
31
- rows << (result.column_types.empty? ? untyped_row : columns.each_with_index.map { |c, i| untyped_row[i] && result.column_types[c] ? result.column_types[c].send(:cast_value, untyped_row[i]) : untyped_row[i] })
32
- end
29
+ end
30
+
31
+ columns = result.columns
32
+ result.rows.each do |untyped_row|
33
+ rows << (result.column_types.empty? ? untyped_row : columns.each_with_index.map { |c, i| untyped_row[i] && result.column_types[c] ? result.column_types[c].send(:cast_value, untyped_row[i]) : untyped_row[i] })
34
+ end
35
+
36
+ # fix for non-ASCII column names and charts
37
+ if adapter_name == "Trilogy"
38
+ columns.map! { |k| k.dup.force_encoding(Encoding::UTF_8) }
33
39
  end
34
40
  rescue => e
35
41
  error = e.message.sub(/.+ERROR: /, "")
@@ -194,10 +200,10 @@ module Blazer
194
200
 
195
201
  # Redshift adapter silently ignores binds
196
202
  def parameter_binding
197
- if postgresql? && (ActiveRecord::VERSION::STRING.to_f >= 6.1 || prepared_statements?)
198
- # Active Record < 6.1 silently ignores binds with Postgres when prepared statements are disabled
203
+ if postgresql?
199
204
  :numeric
200
- elsif sqlite?
205
+ elsif sqlite? && prepared_statements?
206
+ # Active Record silently ignores binds with SQLite when prepared statements are disabled
201
207
  :numeric
202
208
  elsif mysql? && prepared_statements?
203
209
  # Active Record silently ignores binds with MySQL when prepared statements are disabled
@@ -1,3 +1,3 @@
1
1
  module Blazer
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blazer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-08 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: csv
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email: andrew@ankane.org
71
85
  executables: []
@@ -237,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
251
  - !ruby/object:Gem::Version
238
252
  version: '0'
239
253
  requirements: []
240
- rubygems_version: 3.4.10
254
+ rubygems_version: 3.5.3
241
255
  signing_key:
242
256
  specification_version: 4
243
257
  summary: Explore your data with SQL. Easily create charts and dashboards, and share