pg_conn 0.13.1 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30f37deaa02a7ce6c10c42be3b5432ac3e80c21fd82ec8a0d33d10cfc29ad904
4
- data.tar.gz: b78696618951f214e39f5e075ad1d657e86d0d5dda691b5f9b081e51b45b40a1
3
+ metadata.gz: 5a1eb7cce679245ec285129507e3d56948c2239b930ea18a757dd90c2e293404
4
+ data.tar.gz: c60efa88bb84530b91a58fd296781052b500968010808f9fa2c3dca4873db772
5
5
  SHA512:
6
- metadata.gz: 68bab843ada37c8214bd7281bda915a6ec509dd337b4cae40384308d60408bfdc7de4abd10eefc94123248d438db4f01942ba7bdc2fd4e17f3dd28096e07aaac
7
- data.tar.gz: 1a64027e97471f53ab114f617de495be2f4adab7e64cd30cf63b91a9a698462cae13531b990c3f96241d008e7a343b7163bcde8bd1d0371efb1935a741215384
6
+ metadata.gz: de7cea3519b5dbd3763c24681ed917ae525fb87e359bc17461e0c950cc70ea47d3c79e230840d878a14533b7921a55384bf17235d32020787e22c37b8fb5e16c
7
+ data.tar.gz: 6dde3d8a9ea145db3e28b2467df50333042f3243da9d7b741e1195bb2d17856577541ff8df09744cc94517f9e02c7e6de44eba52fb3ba0ca363d0103edc89d13
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.13.1"
2
+ VERSION = "0.13.2"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -562,14 +562,28 @@ module PgConn
562
562
  def update(schema = nil, table, expr, hash)
563
563
  table = [schema, table].compact.join(".")
564
564
  assignments = hash.map { |k,v| "#{k} = #{quote_literal(v)}" }.join(", ")
565
- constraint = (expr.is_a?(String) ? expr : "id = #{quote_literal(expr)}")
565
+ constraint =
566
+ case expr
567
+ when String; expr
568
+ when Integer; "id = #{quote_literal(expr)}"
569
+ when Array; "id in #{quote_literal_list(expr)}"
570
+ else
571
+ raise ArgumentError
572
+ end
566
573
  exec %(update #{table} set #{assignments} where #{constraint})
567
574
  end
568
575
 
569
576
  # Delete record(s)
570
577
  def delete(schema = nil, table, expr)
571
578
  table = [schema, table].compact.join(".")
572
- constraint = (expr.is_a?(String) ? expr : "id = #{quote_literal(expr)}")
579
+ constraint =
580
+ case expr
581
+ when String; expr
582
+ when Integer; "id = #{quote_literal(expr)}"
583
+ when Array; "id in #{quote_literal_list(expr)}"
584
+ else
585
+ raise ArgumentError
586
+ end
573
587
  exec %(delete from #{table} where #{constraint})
574
588
  end
575
589
 
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.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen