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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c017287998b7b7c473e0532c44ff8f209d322158c6ef79b97a462270cc1d10ef
4
- data.tar.gz: 6939299127cda711bf3fd1c0c349737c9f943c026abc13885bb9e699ce6607b0
3
+ metadata.gz: 7d4a247037db05fc559956f4fd4e293c4dc2fe76c57be33aed61aed6e73918d0
4
+ data.tar.gz: af4650f527a0866ea9b0d09e63de11ab8b666bc01e3eb2d178e6283e8ecbac9a
5
5
  SHA512:
6
- metadata.gz: 01d12b622790f3310a94d1c5191d811a9fb481d488b55f6e00018fe704ec6a9916b67ad5998c15977bc21d29792be96b82f81bcfc90c06100f7af2b1df967d71
7
- data.tar.gz: 80e0c6c6e7825c949c5f23d3c98e8bc49ddf0653bba13bf666b0816d0e2656b788ea37af52d9009914a961cb197035dbd4643a9ad65fd9c9ccf76b9c46088f63
6
+ metadata.gz: c26a178586d36c17b2a14d1cd1090896abf9f576c574f3616d8555bcc82ce5b434e436145c0944b0729e044df2ecb22e7923a9206443fc14625c2d8628b5c367
7
+ data.tar.gz: 42404a7aeec08776c601fcd29fcb1b97f7ffeddb377b1940913082bc237ed3ae4ac1b75a44997e9ae140553420d78f54f76f3ae4dfc2272457ee62910b4aa031
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.49.0"
2
+ VERSION = "0.50.0"
3
3
  end
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_conn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.49.0
4
+ version: 0.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen