arel-extensions 7.0.0 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bf2e8f56e1ddcbbad8174dae4355722b1ae038c39a828b1168685bbbdb4f05a
4
- data.tar.gz: 5ae312e7b320d222c785ed573279bb605f6e8ef27eaff194cd2f37843fc106f1
3
+ metadata.gz: 25d31b82bda12cbddc9ff7110b040e74d827a97d430259c7c4be9c1c50071f38
4
+ data.tar.gz: 727762032b716e7c8c4cde9d9867702e717a7bad8e772aca649cd200fcd292a1
5
5
  SHA512:
6
- metadata.gz: 9262f694b5daa13b0d87799a4d88a8b4a8850d49d76415cb75f19d803030cbd699410b850168ee2053c2f7804d050ae05d965feb5f04b17af3df8c99453c4cdd
7
- data.tar.gz: 1a72cb377d66c28872b89ddb9cce81fc735e0a500fd30291e45336156ab1c3fb68bac3b9a012f1a52a80abd717e79560a2d608f73e8534c5253d489f2161f657
6
+ metadata.gz: fa40b55d8bd479d4947594d2d56e9a0ff6c8cbb045d2dfd7ab8b64ef987bfada7658a5f1bad2432e3db889d48cfc89f628cb5b06109960148478f59c260ce147
7
+ data.tar.gz: aafe42cbb6f0e1739457c19f3c9de60d76e5879b973dd7125a23bd8dc1aa9beb0aeb2a734fd5bef30f8200f50951a6948f46b17a847e974d89f3b95be8a86ef7
@@ -1,5 +1,5 @@
1
1
  module Arel
2
2
  module Extensions
3
- VERSION = '7.0.0'
3
+ VERSION = '7.0.1'
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require "arel"
2
- require File.expand_path('../nodes/hex_encoded_binary', __FILE__)
2
+ require File.expand_path('../nodes/binary_value', __FILE__)
3
+ require File.expand_path('../nodes/hex_encoded_binary_value', __FILE__)
3
4
 
4
5
  require File.expand_path('../nodes/within', __FILE__)
5
6
  require File.expand_path('../nodes/excludes', __FILE__)
@@ -0,0 +1,7 @@
1
+ module Arel
2
+ module Nodes
3
+ class BinaryValue < Arel::Nodes::Unary
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Arel
2
+ module Nodes
3
+ class HexEncodedBinaryValue < Arel::Nodes::Unary
4
+
5
+ end
6
+ end
7
+ end
@@ -139,11 +139,14 @@ module Arel
139
139
  collector << ')'
140
140
  collector
141
141
  end
142
-
143
- def visit_Arel_Nodes_HexEncodedBinary(o, collector)
144
- collector << "E'\\\\x"
145
- collector << o.expr
146
- collector << "'"
142
+
143
+ def visit_Arel_Nodes_BinaryValue(o, collector)
144
+ collector << quote(@connection.escape_bytea(o.expr))
145
+ collector
146
+ end
147
+
148
+ def visit_Arel_Nodes_HexEncodedBinaryValue(o, collector)
149
+ collector << quote("\\x" + o.expr)
147
150
  collector
148
151
  end
149
152
 
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+
3
+ class BinaryValueTest < ActiveSupport::TestCase
4
+
5
+ test 'binary value' do
6
+ query = Property.where( Arel::Nodes::BinaryValue.new("\x01\x01\x00\x00\x00\xC0K\x9B\x84\xD0.<@\b\x96\xA2n\x84%&@") )
7
+
8
+ assert_equal(<<~SQL.gsub(/( +|\n)/, ' ').strip, query.to_sql)
9
+ SELECT "properties".* FROM "properties"
10
+ WHERE '\\x0101000000c04b9b84d02e3c400896a26e84252640'
11
+ SQL
12
+ end
13
+
14
+ test 'hex encoded binary value' do
15
+ query = Property.where( Arel::Nodes::HexEncodedBinaryValue.new("0101000000c04b9b84d02e3c400896a26e84252640") )
16
+
17
+ assert_equal(<<~SQL.gsub(/( +|\n)/, ' ').strip, query.to_sql)
18
+ SELECT "properties".* FROM "properties"
19
+ WHERE '\\x0101000000c04b9b84d02e3c400896a26e84252640'
20
+ SQL
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arel-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-07 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -175,12 +175,13 @@ files:
175
175
  - lib/arel/extensions/version.rb
176
176
  - lib/arel/gis_predications.rb
177
177
  - lib/arel/json_predications.rb
178
+ - lib/arel/nodes/binary_value.rb
178
179
  - lib/arel/nodes/contained_by.rb
179
180
  - lib/arel/nodes/excludes.rb
180
181
  - lib/arel/nodes/has_any_key.rb
181
182
  - lib/arel/nodes/has_key.rb
182
183
  - lib/arel/nodes/has_keys.rb
183
- - lib/arel/nodes/hex_encoded_binary.rb
184
+ - lib/arel/nodes/hex_encoded_binary_value.rb
184
185
  - lib/arel/nodes/random.rb
185
186
  - lib/arel/nodes/relation.rb
186
187
  - lib/arel/nodes/ts_match.rb
@@ -193,6 +194,7 @@ files:
193
194
  - lib/arel/visitors/postgresql_extensions.rb
194
195
  - lib/arel/visitors/sunstone_extensions.rb
195
196
  - lib/arel/visitors/to_sql_extensions.rb
197
+ - test/binary_value_test.rb
196
198
  - test/database.rb
197
199
  - test/order_test.rb
198
200
  - test/sunstone_test.rb
@@ -217,11 +219,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
219
  - !ruby/object:Gem::Version
218
220
  version: '0'
219
221
  requirements: []
220
- rubygems_version: 3.2.22
222
+ rubygems_version: 3.4.13
221
223
  signing_key:
222
224
  specification_version: 4
223
225
  summary: Adds support for missing SQL operators and functions to Arel
224
226
  test_files:
227
+ - test/binary_value_test.rb
225
228
  - test/database.rb
226
229
  - test/order_test.rb
227
230
  - test/sunstone_test.rb
@@ -1,7 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class HexEncodedBinary < Arel::Nodes::Unary
4
-
5
- end
6
- end
7
- end