pg_conn 0.32.1 → 0.33.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: de05fd7cb9954d248fa17a1d770526254d3041581bd854c2e7ac1a3afd07d6c4
4
- data.tar.gz: 47b0579c83826d3946fff342c9d95ec8ab3efc2119c6c7f117056d7188442582
3
+ metadata.gz: d008acfbbae8f338d5f83bcdacc35b40b67b986b04068dc82b9ae7fd8053e8d4
4
+ data.tar.gz: 617b133d7c15c9e358b23331883b3ec7228227d3d70db59b5e7a74b01f111bf5
5
5
  SHA512:
6
- metadata.gz: 4b77f809d2d2d8c431f78cd82b1f4359189731212f5cfa1b3818e043e886277951a2127a670b97259a311f05b750629cc431580eee110eab98eedaa02ff4217b
7
- data.tar.gz: d9208f1e696f538e2502351a54c4ef17ef43cd8b59692ab2a5216976334b1333b0b1886c8d6e9031ae15b835e44023a77244ea586f0d6b4b9ddb50bed08a6dee
6
+ metadata.gz: 9c742a5c22f61d1add1b77b0c50047c596d901416b32d202e16eddc38f6718fe5357550e029fe863406c0243d157632dbe61bea85dc9428d9b862f8ec512fe8f
7
+ data.tar.gz: adae387af6cf778c870bdae60beb94d12634c079048748d146bab24b6035ce4295968f72467a3283be5afe79360306e22279ce94d1e36d5c893e90918cd5f952
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.32.1"
2
+ VERSION = "0.33.0"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -644,15 +644,15 @@ module PgConn
644
644
  # of the function. If the :proc option is true the "function" is assumed
645
645
  # to be a procedure
646
646
  #
647
- def call(name, *args, elem_type: nil, proc: false) # :proc may interfere with hashes
647
+ def call(name, *args, elem_type: nil, silent: false, proc: false) # :proc may interfere with hashes
648
648
  args_seq = quote_values(args, elem_type: elem_type)
649
649
  if proc
650
- pg_exec "call #{name}(#{args_seq})"
650
+ pg_exec "call #{name}(#{args_seq})", silent: silent
651
651
  return nil
652
652
  else
653
- r = pg_exec "select * from #{name}(#{args_seq})"
653
+ r = pg_exec "select * from #{name}(#{args_seq})", silent: silent
654
654
  if r.ntuples == 0
655
- raise Error, "No records returned"
655
+ raise Error, "No value returned"
656
656
  elsif r.ntuples == 1
657
657
  if r.nfields == 1
658
658
  r.values[0][0]
@@ -668,8 +668,8 @@ module PgConn
668
668
  end
669
669
 
670
670
  # Like #call with :proc set to true
671
- def proc(name, *args)
672
- call(name, *args, proc: true)
671
+ def proc(name, *args, silent: false)
672
+ call(name, *args, silent: silent, proc: true)
673
673
  end
674
674
 
675
675
  # :call-seq:
@@ -1050,7 +1050,7 @@ module PgConn
1050
1050
  literals = datas.map { |data|
1051
1051
  values =
1052
1052
  case data
1053
- when Hash; fields.map { |f| data.key?(f) && data[f] || data.key?(f.to_s) && data[f.to_s] }
1053
+ when Hash; fields.map { |f| (data.key?(f) ? data[f] : (data.key?(f.to_s) ? data[f.to_s] : nil)) }
1054
1054
  when OpenStruct; fields.map { |f| data.send(f) }
1055
1055
  when Array; data
1056
1056
  else
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.32.1
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen