pg_conn 0.38.1 → 0.38.2

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: a643fd02f7ad3296edd58d09adf028634f865d24e1eccad2ad1cdd70bc222eaf
4
- data.tar.gz: e07e79bde8c45423493fea5028bf8f920fede7b313efc25ff2883f77e3316540
3
+ metadata.gz: 27da5832145c359fa1472604184f836add4fabceb458dee4b609c05b6eec5196
4
+ data.tar.gz: 109029c0961d83cb35710d2f716a31412eb1fcf68d55b05b1d1d6dc26af6b8d3
5
5
  SHA512:
6
- metadata.gz: 452b57a9bbf438d9158eb32a1c21a951fe57024232a33c4c4d4c7409d2c44e66649ae393f03620825a25a550650341f6cb6b6e265b726a5113bb2e5e270d65b6
7
- data.tar.gz: 4bdfd665f9285206af32bfa537157a2aeee37400d271477c2a1fb26387b7f98974072c99540a8dc211822e90f8f5a72b6980ac74539379c483c8e985d0ec6b52
6
+ metadata.gz: f787e6859f348afd97657c15f6fce1c75ab8e1dc0eeb04ef703879b6b50c493246eb71ec1690b8eb3f2c3f98fefd0b204d7ddde5e6e5d9fe76de5f46c21ff964
7
+ data.tar.gz: 15968312f5b7f5b0835ebd694484deb6ac84c4dd51c57b99d710b72b08d51d154c040f61acef2751037a7f1d0967f3d7ccdcf271d29ce5cbd4432055e61dc003
@@ -152,7 +152,7 @@ module PgConn
152
152
  end
153
153
  end
154
154
 
155
- # Set the serial value for the table
155
+ # Set current serial value for the table
156
156
  def set_serial(schema, table, value)
157
157
  uid = "#{schema}.#{table}"
158
158
  seq = sequence(schema, table) or raise ArgumentError, "Table #{uid} does not have a sequence"
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.38.1"
2
+ VERSION = "0.38.2"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -664,9 +664,11 @@ module PgConn
664
664
 
665
665
  # TODO: #group - same as table but partitions a table on the given keys
666
666
  # returning a map from key to array of records
667
-
667
+ #
668
668
  # TODO: An #array method that returns a map from id to tuple. Hmm... almost
669
669
  # the same as #map
670
+ #
671
+ # TODO: Swap key and query arguments
670
672
 
671
673
  # Return a hash from the record id column to an OpenStruct representation
672
674
  # of the record. If the :key_column option is defined it will be used
@@ -718,6 +720,7 @@ module PgConn
718
720
  # group-by on the key and array_agg on the remaining values. The value is
719
721
  # an array of tuples if the query has more than one value field and an
720
722
  # array of values if there is only one value field
723
+ #
721
724
  def multimap(query, key = nil, symbol: false)
722
725
  r = pg_exec(query)
723
726
  begin
@@ -913,6 +916,7 @@ module PgConn
913
916
  #
914
917
  # TODO: Make sure the transaction stack is emptied on postgres errors
915
918
  def exec(sql, commit: true, fail: true, silent: self.silent)
919
+ return nil if sql.nil? || Array[sql].empty?
916
920
  transaction(commit: commit) {
917
921
  begin
918
922
  execute(sql, fail: fail, silent: silent)
@@ -928,6 +932,7 @@ module PgConn
928
932
  # #execute? method because any failure rolls back the whole transaction
929
933
  # stack. TODO: Check which exceptions that should be captured
930
934
  def exec?(sql, commit: true, silent: true)
935
+ return nil if sql.nil? || Array[sql].empty?
931
936
  begin
932
937
  exec(sql, commit: commit, fail: true, silent: silent)
933
938
  rescue PG::Error
@@ -945,6 +950,7 @@ module PgConn
945
950
  #
946
951
  # TODO: Handle postgres exceptions wrt transaction state and stack
947
952
  def execute(sql, fail: true, silent: self.silent)
953
+ return nil if sql.nil? || Array[sql].empty?
948
954
  if @pg_connection
949
955
  begin
950
956
  pg_exec(sql, silent: silent)&.cmd_tuples
@@ -1320,7 +1326,7 @@ module PgConn
1320
1326
  #
1321
1327
  # Execute statement(s) on the server. If the argument is an array of
1322
1328
  # commands, the commands are concatenated with ';' before being sent to the
1323
- # server. #pg_exec returns a PG::Result object or nil if +arg+ was empty
1329
+ # server. #pg_exec returns a PG::Result object or nil if +arg+ was nil or empty
1324
1330
  #
1325
1331
  # Postgres errors are passed through and #error and #err set to the last
1326
1332
  # statement's SQL errors or nil if it succeeded
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.38.1
4
+ version: 0.38.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen