pg_conn 0.32.0 → 0.32.1
Sign up to get free protection for your applications and to get access to all the features.
- 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: de05fd7cb9954d248fa17a1d770526254d3041581bd854c2e7ac1a3afd07d6c4
|
4
|
+
data.tar.gz: 47b0579c83826d3946fff342c9d95ec8ab3efc2119c6c7f117056d7188442582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b77f809d2d2d8c431f78cd82b1f4359189731212f5cfa1b3818e043e886277951a2127a670b97259a311f05b750629cc431580eee110eab98eedaa02ff4217b
|
7
|
+
data.tar.gz: d9208f1e696f538e2502351a54c4ef17ef43cd8b59692ab2a5216976334b1333b0b1886c8d6e9031ae15b835e44023a77244ea586f0d6b4b9ddb50bed08a6dee
|
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] }
|
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.1
|
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
|