pg_conn 0.49.0 → 0.50.0
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 +8 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d4a247037db05fc559956f4fd4e293c4dc2fe76c57be33aed61aed6e73918d0
|
|
4
|
+
data.tar.gz: af4650f527a0866ea9b0d09e63de11ab8b666bc01e3eb2d178e6283e8ecbac9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c26a178586d36c17b2a14d1cd1090896abf9f576c574f3616d8555bcc82ce5b434e436145c0944b0729e044df2ecb22e7923a9206443fc14625c2d8628b5c367
|
|
7
|
+
data.tar.gz: 42404a7aeec08776c601fcd29fcb1b97f7ffeddb377b1940913082bc237ed3ae4ac1b75a44997e9ae140553420d78f54f76f3ae4dfc2272457ee62910b4aa031
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
|
@@ -731,10 +731,10 @@ module PgConn
|
|
|
731
731
|
# of the record. If the :key_column option is defined it will be used
|
|
732
732
|
# instead of id as the key. It is an error if the id field value is not
|
|
733
733
|
# unique
|
|
734
|
-
def set(query, key_column: :id)
|
|
734
|
+
def set(*query, key_column: :id)
|
|
735
735
|
key_column = key_column.to_sym
|
|
736
736
|
keys = {}
|
|
737
|
-
r = pg_exec(query)
|
|
737
|
+
r = pg_exec(parse_query *query)
|
|
738
738
|
begin
|
|
739
739
|
r.fnumber(key_column.to_s) # Check that key column exists
|
|
740
740
|
rescue ArgumentError
|
|
@@ -754,8 +754,12 @@ module PgConn
|
|
|
754
754
|
# If there is only one remaining field then that value is used instead of a
|
|
755
755
|
# tuple. The optional +key+ argument sets the mapping field and the
|
|
756
756
|
# +symbol+ option convert key to Symbol objects when true
|
|
757
|
+
#
|
|
758
|
+
# The query is a single-argument query expression (either a full SQL query
|
|
759
|
+
# string or the name of a table/view). TODO: Make key an option so we can
|
|
760
|
+
# use full query expressions
|
|
757
761
|
def map(query, key = nil, symbol: false) # TODO Swap arguments
|
|
758
|
-
r = pg_exec(query)
|
|
762
|
+
r = pg_exec(parse_query query)
|
|
759
763
|
begin
|
|
760
764
|
key = (key || r.fname(0)).to_s
|
|
761
765
|
key_index = r.fnumber(key.to_s)
|
|
@@ -779,7 +783,7 @@ module PgConn
|
|
|
779
783
|
# array of values if there is only one value field
|
|
780
784
|
#
|
|
781
785
|
def multimap(query, key = nil, symbol: false)
|
|
782
|
-
r = pg_exec(query)
|
|
786
|
+
r = pg_exec(parse_query query)
|
|
783
787
|
begin
|
|
784
788
|
key = (key || r.fname(0)).to_s
|
|
785
789
|
key_index = r.fnumber(key.to_s)
|