pg_conn 0.7.0 → 0.7.1

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: 410aa55b50b2d9c16aa9ab8a220475b83b91aa78e5ecb1a012e1a3524b2bcedb
4
- data.tar.gz: '037319c6f45a570caedbcbb1ba1a725c738fa17771a1379ccab530d541d3270d'
3
+ metadata.gz: 515c790d7c2850a3d679f3b56601a8cd7311eeeb7c8875f23e7e24a9b1d3389a
4
+ data.tar.gz: '08b7e60560b80649d613e7469c7d544b136c5cff789d9f107eeb83a56e4449ff'
5
5
  SHA512:
6
- metadata.gz: 6d1b677fbefbffd5189c29be2a185f76d5a85227c27f8e3a2883fe8db2a5b4c6054525975a93c5b3b4c0439009a70fe41d5a762493046090fa85d18dc381f87e
7
- data.tar.gz: 03b617328dd1acd4bcfc1069c3d47b7bfc80771b924c39e7b91ad0c310f72577e6da3106e818769052f5fff7ee80ec43f2df6d127d76615b0278c353594ab70d
6
+ metadata.gz: aee7f2323e2bd7cb4893780210161c7839dd985e33dec5d1c93b6318c4f3c03494ef2108031fe0aff0e83352c94bb6c5a421830ac7e8972cd23d830159a61f08
7
+ data.tar.gz: c4ad3b31c34a19ce3c697ab9cdb318f9aee9752c7eb3bc598588da48923d488908b26c324fd29cf6381d60d08e249920a99671324b84434776fbdedeb85ad5f1
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -69,11 +69,16 @@ module PgConn
69
69
  # Last error message. The error message is the first line of the PG error
70
70
  # message that may contain additional info. It doesn't contain a
71
71
  # terminating newline
72
- def errmsg = err && err.message.sub(/\n.*/m, "")
72
+ def errmsg = err&.message =~ /^ERROR:\s*(.*?)\n/m && $1.capitalize
73
+
74
+ # The one-based line number of the last PG::Error or nil if absent in the
75
+ # Postgres error message
76
+ def errline = err&.message =~ /\n\s*LINE\s+(\d+):/m && $1.to_i
77
+
78
+ # The one-based character number of the error in the last PG::Error or nil
79
+ # if absent in the Postgres error message
80
+ def errchar = err&.message =~ /\n(\s*LINE\s+\d+: ).*?\n(\s+)\^\n/m && ($2.size - $1.size + 1)
73
81
 
74
- # The line number of the last PG::Error. It is not always present
75
- def errline() err && err.message =~ /\n\s*LINE\s+(\d+):/m and $1.to_i end
76
-
77
82
  # :call-seq:
78
83
  # initialize(dbname = nil, user = nil, field_name_class: Symbol)
79
84
  # initialize(connection_hash, field_name_class: Symbol)
@@ -676,6 +681,7 @@ module PgConn
676
681
  if fail
677
682
  if !silent # FIXME Why do we handle this?
678
683
  $stderr.puts arg
684
+ $stderr.puts
679
685
  $stderr.puts ex.message
680
686
  $stderr.flush
681
687
  end
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.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen