pg_conn 0.32.0 → 0.32.2
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 +4 -4
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +14 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfb662385fd9e2cc88b6f06b7169b06b0daa5d893613eb9a917d0c0cc449ebb7
|
4
|
+
data.tar.gz: '09648f01535b6afe6c8e78f347e8e27215f8ac558488b2eafd9b46998835fc25'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c56b84dee0d6e7073fec4b98466a03a8d88aae2c3a97bb98b855b1d48889f5611d90596bdefffe972ad4fb2602e46ae918d25e7ccbb7d88e6e2f40191967c7d
|
7
|
+
data.tar.gz: b36e951ac7073bae385b1fbf9a6e15ccdc93ffb30209e9476474723684d434fb655131a007c6d4e5caa71402713320deac21048a35f17788b400b4b7991e302e
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
@@ -58,8 +58,8 @@ module PgConn
|
|
58
58
|
# or 'jsonb'
|
59
59
|
#
|
60
60
|
# Note that a tuple value (an array) must be quoted using #quote_tuple
|
61
|
-
# because #quote_value would quote the tuple as an array instead of a
|
62
|
-
# of values
|
61
|
+
# because #quote_value would quote the tuple as an array value instead of a
|
62
|
+
# list of values
|
63
63
|
#
|
64
64
|
# The :elem_type option can be a postgres type name (String or Symbol) or
|
65
65
|
# an array of type names. It is used as the required explicit element
|
@@ -329,6 +329,8 @@ module PgConn
|
|
329
329
|
end
|
330
330
|
end
|
331
331
|
|
332
|
+
# Mark argument as already being quoted. TODO: Make this the default in all
|
333
|
+
# quote methods
|
332
334
|
def literal(arg) Literal.new(arg) end
|
333
335
|
|
334
336
|
# Connection member method variations of the PgConn quote class methods
|
@@ -1022,8 +1024,15 @@ module PgConn
|
|
1022
1024
|
end
|
1023
1025
|
|
1024
1026
|
# Common implementation for #quote_record and #quote_records that avoids
|
1025
|
-
#
|
1026
|
-
#
|
1027
|
+
# querying the database multiple times or duplication the code. The :array
|
1028
|
+
# flag is true when called via #quote_records
|
1029
|
+
#
|
1030
|
+
# @data can be a Hash, Array, or OpenStruct. Hash keys must be symbols or
|
1031
|
+
# strings, they belong to the same namespace so :k and "k" refer to the
|
1032
|
+
# same value
|
1033
|
+
#
|
1034
|
+
# Note that #quote_record_impl queries the database for information about
|
1035
|
+
# the type. TODO Cache this information?
|
1027
1036
|
def quote_record_impl(datas, schema_name = nil, type, elem_types: nil, array: nil)
|
1028
1037
|
pg_type = [schema_name, type].compact.join('.')
|
1029
1038
|
fields = self.values(%(
|
@@ -1041,7 +1050,7 @@ module PgConn
|
|
1041
1050
|
literals = datas.map { |data|
|
1042
1051
|
values =
|
1043
1052
|
case data
|
1044
|
-
when Hash; fields.map { |f| data[f] }
|
1053
|
+
when Hash; fields.map { |f| (data.key?(f) ? data[f] : (data.key?(f.to_s) ? data[f.to_s] : nil)) }
|
1045
1054
|
when OpenStruct; fields.map { |f| data.send(f) }
|
1046
1055
|
when Array; data
|
1047
1056
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_conn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.32.
|
4
|
+
version: 0.32.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|